Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
core

Namespaces

namespace  core
  
 
namespace  core\access
  
 
namespace  core\analytics\analyser
  
 
namespace  core\analytics\indicator
  
 
namespace  core\analytics\time_splitting
  
 
namespace  core\check
  
 
namespace  core\check\access
  
 
namespace  core\check\environment
  
 
namespace  core\check\http
  
 
namespace  core\check\performance
  
 
namespace  core\check\security
  
 
namespace  core\content\export
  
 
namespace  core\content\export\exportable_items
  
 
namespace  core\content\export\exporters
  
 
namespace  core\dataformat
  
 
namespace  core\dml
  
 
namespace  core\event
  
 
namespace  core\external
  
 
namespace  core\external\output\icon_system
  
 
namespace  core\files
  
 
namespace  core\form
  
 
namespace  core\hook
  
 
namespace  core\hook\navigation
  
 
namespace  core\hub
  
 
namespace  core\local\cli
  
 
namespace  core\local\guzzle
  
 
namespace  core\lock
  
 
namespace  core\log
  
 
namespace  core\moodlenet
  
 
namespace  core\navigation\output
  
 
namespace  core\navigation\views
  
 
namespace  core\oauth2
  
 
namespace  core\oauth2\client
  
 
namespace  core\oauth2\discovery
  
 
namespace  core\oauth2\service
  
 
namespace  core\output
  
 
namespace  core\output\dynamic_tabs
  
 
namespace  core\output\local\dropdown
  
 
namespace  core\plugininfo
  
 
namespace  core\privacy
  
 
namespace  core\progress
  
 
namespace  core\reportbuilder\local\entities
  
 
namespace  core\session
  
 
namespace  core\session\utility
  
 
namespace  core\task
  
 
namespace  core\update
  
 
namespace  core\upgrade
  
 
namespace  core_admin\form
  
 
namespace  core_admin\local\settings
  
 
namespace  core_badges
  
 
namespace  core_badges\form
  
 
namespace  core_badges\output
  
 
namespace  core_cache
  
 
namespace  core_cache\local
  
 
namespace  core_course\analytics\indicator
  
 
namespace  core_course\cache
  
 
namespace  core_course\local\entity
  
 
namespace  core_course\local\exporters
  
 
namespace  core_course\local\repository
  
 
namespace  core_course\local\service
  
 
namespace  core_course\output
  
 
namespace  core_h5p\event
  
 
namespace  core_question\statistics\questions
  
 
namespace  core_table\local\filter
  
 
namespace  core_user
  
 
namespace  core_user\analytics\target
  
 
namespace  core_user\external
  
 
namespace  core_user\table
  
 
namespace  Html2Text
  
 
namespace  mod_quiz\event
  
 
namespace  Moodle\BehatExtension\Context
  
 
namespace  Moodle\BehatExtension\Context\ContextClass
  
 
namespace  Moodle\BehatExtension\Context\Initializer
  
 
namespace  Moodle\BehatExtension\Context\Step
  
 
namespace  Moodle\BehatExtension\Definition\Cli
  
 
namespace  Moodle\BehatExtension\Definition\Printer
  
 
namespace  Moodle\BehatExtension\Driver
  
 
namespace  Moodle\BehatExtension\EventDispatcher\Tester
  
 
namespace  Moodle\BehatExtension\Exception
  
 
namespace  Moodle\BehatExtension\Output\Formatter
  
 
namespace  Moodle\BehatExtension\Output\Printer
  
 
namespace  Moodle\BehatExtension\ServiceContainer
  
 

Classes

class  action_link
 Data structure describing html link with special action attached. More...
 
class  action_menu
 An action menu. More...
 
class  action_menu_filler
 An action menu filler. More...
 
class  action_menu_link
 An action menu action. More...
 
class  action_menu_link_primary
 A primary action menu action. More...
 
class  action_menu_link_secondary
 A secondary action menu action. More...
 
class  admin_category
 The object used to represent folders (a.k.a. More...
 
class  admin_externalpage
 Links external PHP pages into the admin tree. More...
 
class  admin_page_manageblocks
 Blocks manage page. More...
 
class  admin_page_managefilters
 Special class for filter administration. More...
 
class  admin_page_managemessageoutputs
 Message outputs configuration. More...
 
class  admin_page_managemods
 Module manage page. More...
 
class  admin_page_manageportfolios
 
class  admin_page_manageqbehaviours
 Manage question behaviours page. More...
 
class  admin_page_manageqtypes
 Question type manage page. More...
 
class  admin_page_managerepositories
 
class  admin_page_pluginsoverview
 General plugins manager. More...
 
class  admin_root
 Root of admin settings tree, does not have any parent. More...
 
class  admin_setting
 Admin settings class. More...
 
class  admin_setting_agedigitalconsentmap
 Used to validate the content and format of the age of digital consent map and ensuring it is parsable. More...
 
class  admin_setting_bloglevel
 Select for blog's bloglevel setting: if set to 0, will set blog_menu block to hidden. More...
 
class  admin_setting_configcheckbox
 Checkbox. More...
 
class  admin_setting_configcheckbox_with_advanced
 Checkbox with an advanced checkbox that controls an additional $name. More...
 
class  admin_setting_configcheckbox_with_lock
 Checkbox with an advanced checkbox that controls an additional $name. More...
 
class  admin_setting_configcolourpicker
 Colour picker. More...
 
class  admin_setting_configdirectory
 Path to directory. More...
 
class  admin_setting_configduration
 Seconds duration setting. More...
 
class  admin_setting_configduration_with_advanced
 Seconds duration setting with an advanced checkbox, that controls a additional $name. More...
 
class  admin_setting_configempty
 Empty setting used to allow flags (advanced) on settings that can have no sensible default. More...
 
class  admin_setting_configexecutable
 Path to executable file. More...
 
class  admin_setting_configfile
 Path to directory. More...
 
class  admin_setting_confightmleditor
 General text area with html editor. More...
 
class  admin_setting_configiplist
 Used to validate a textarea used for ip addresses. More...
 
class  admin_setting_configmixedhostiplist
 Used to validate a textarea used for domain names, wildcard domain names and IP addresses/ranges (both IPv4 and IPv6 format). More...
 
class  admin_setting_configmulticheckbox
 Multiple checkboxes, each represents different value, stored in csv format. More...
 
class  admin_setting_configmulticheckbox2
 Multiple checkboxes 2, value stored as string 00101011. More...
 
class  admin_setting_configmultiselect
 Select multiple items from list. More...
 
class  admin_setting_configmultiselect_modules
 Multiselect for current modules. More...
 
class  admin_setting_configpasswordunmask
 Password field, allows unmasking of password. More...
 
class  admin_setting_configpasswordunmask_with_advanced
 Password field, allows unmasking of password, with an advanced checkbox that controls an additional $name. More...
 
class  admin_setting_configportlist
 Used to validate a textarea used for port numbers. More...
 
class  admin_setting_configselect
 Select one value from list. More...
 
class  admin_setting_configselect_autocomplete
 Autocomplete as you type form element. More...
 
class  admin_setting_configselect_with_advanced
 Dropdown menu with an advanced checkbox, that controls a additional $name. More...
 
class  admin_setting_configselect_with_lock
 Select with an advanced checkbox that controls an additional $name. More...
 
class  admin_setting_configstoredfile
 Class used for uploading of one file into file storage, the file name is stored in config table. More...
 
class  admin_setting_configtext
 The most flexible setting, the user enters text. More...
 
class  admin_setting_configtext_with_advanced
 Text field with an advanced checkbox, that controls a additional $name. More...
 
class  admin_setting_configtext_with_maxlength
 Text input with a maximum length constraint. More...
 
class  admin_setting_configtextarea
 General text area without html editor. More...
 
class  admin_setting_configthemepreset
 Used to validate theme presets code and ensuring they compile well. More...
 
class  admin_setting_configtime
 Time selector. More...
 
class  admin_setting_countrycodes
 Allows to specify comma separated list of known country codes. More...
 
class  admin_setting_courselist_frontpage
 Special select - lists on the frontpage - hacky. More...
 
class  admin_setting_description
 No setting - just name and description in same row. More...
 
class  admin_setting_devicedetectregex
 Administration interface for user specified regular expressions for device detection. More...
 
class  admin_setting_emoticons
 Administration interface for emoticon_manager settings. More...
 
class  admin_setting_enablemobileservice
 Special checkbox for enable mobile web service If enable then we store the service id of the mobile service into config table If disable then we unstore the service id from the config table. More...
 
class  admin_setting_encryptedpassword
 Admin setting class for encrypted values using secure encryption. More...
 
class  admin_setting_filetypes
 Administration setting to define a list of file types. More...
 
class  admin_setting_flag
 An additional option that can be applied to an admin setting. More...
 
class  admin_setting_forcetimezone
 Forced user timezone setting. More...
 
class  admin_setting_grade_profilereport
 Selection of grade report in user profiles. More...
 
class  admin_setting_gradecat_combo
 Grade category settings. More...
 
class  admin_setting_heading
 No setting - just heading and text. More...
 
class  admin_setting_langlist
 Special setting for limiting of the list of available languages. More...
 
class  admin_setting_manage_fileconverter_plugins
 Generic class for managing plugins in a table that allows re-ordering and enable/disable of each plugin. More...
 
class  admin_setting_manage_plugins
 Generic class for managing plugins in a table that allows re-ordering and enable/disable of each plugin. More...
 
class  admin_setting_manageantiviruses
 Special class for antiviruses administration. More...
 
class  admin_setting_manageauths
 Special class for authentication administration. More...
 
class  admin_setting_managecontentbankcontenttypes
 Content bank content types manager. More...
 
class  admin_setting_managecustomfields
 Custom fields manager. More...
 
class  admin_setting_managedataformats
 Data formats manager. More...
 
class  admin_setting_manageenrols
 Special class for enrol plugins management. More...
 
class  admin_setting_manageexternalservices
 Special class for management of external services. More...
 
class  admin_setting_manageformats
 Course formats manager. More...
 
class  admin_setting_managemediaplayers
 Special class for media player plugins management. More...
 
class  admin_setting_managerepository
 Manage repository settings. More...
 
class  admin_setting_managewebserviceprotocols
 Special class for web service protocol administration. More...
 
class  admin_setting_my_grades_report
 Provides a selection of grade reports to be used for "grades". More...
 
class  admin_setting_php_extension_enabled
 Admin setting to show if a php extension is enabled or not. More...
 
class  admin_setting_pickfilters
 Admin setting that is a list of installed filter plugins. More...
 
class  admin_setting_pickroles
 Admin setting that allows a user to pick appropriate roles for something. More...
 
class  admin_setting_question_behaviour
 Admin setting that allows a user to pick a behaviour. More...
 
class  admin_setting_regradingcheckbox
 
class  admin_setting_requiredpasswordunmask
 This type of field should be used for mandatory config settings where setting password is required. More...
 
class  admin_setting_requiredtext
 This type of field should be used for mandatory config settings. More...
 
class  admin_setting_scsscode
 Used to validate the contents of SCSS code and ensuring they are parsable. More...
 
class  admin_setting_searchsetupinfo
 Search setup steps info. More...
 
class  admin_setting_servertimezone
 Server timezone setting. More...
 
class  admin_setting_sitesetcheckbox
 Special checkbox for frontpage - stores data in course table. More...
 
class  admin_setting_sitesetselect
 Special select for frontpage - stores data in course table. More...
 
class  admin_setting_sitesettext
 Special text for frontpage - stores data in course table. More...
 
class  admin_setting_special_adminseesall
 Special checkbox for calendar - resets SESSION vars. More...
 
class  admin_setting_special_backup_auto_destination
 Special setting for backup auto destination. More...
 
class  admin_setting_special_backupdays
 Special control for selecting days to backup. More...
 
class  admin_setting_special_calendar_weekend
 Special admin control. More...
 
class  admin_setting_special_coursecontact
 Which roles to show on course description page. More...
 
class  admin_setting_special_debug
 Special debug setting. More...
 
class  admin_setting_special_frontpagedesc
 Special text editor for site description. More...
 
class  admin_setting_special_gradebookroles
 Graded roles in gradebook. More...
 
class  admin_setting_special_gradeexport
 Primary grade export plugin - has state tracking. More...
 
class  admin_setting_special_gradelimiting
 
class  admin_setting_special_grademinmaxtouse
 Special setting for $CFG->grade_minmaxtouse. More...
 
class  admin_setting_special_gradepointdefault
 A setting for setting the default grade point value. More...
 
class  admin_setting_special_gradepointmax
 A setting for setting the maximum grade value. More...
 
class  admin_setting_special_registerauth
 Special class for register auth selection. More...
 
class  admin_setting_special_selectsetup
 Special select for settings that are altered in setup.php and can not be altered on the fly. More...
 
class  admin_setting_users_with_capability
 An admin setting for selecting one or more users who have a capability in the system context. More...
 
class  admin_setting_webservicesoverview
 Special class for overview of external services. More...
 
class  admin_settingdependency
 Used to store details of the dependency between two settings elements. More...
 
class  admin_settingpage
 Used to group a number of admin_setting objects into a page and add them to the admin tree. More...
 
class  admin_settings_country_select
 Selection of one of the recognised countries using the list returned by get_list_of_countries(). More...
 
class  admin_settings_coursecat_select
 Course category selection. More...
 
class  admin_settings_h5plib_handler_select
 Selection of plugins that can work as H5P libraries handlers. More...
 
class  admin_settings_num_course_sections
 admin_setting_configselect for the default number of sections in a course, simply so we can lazy-load the choices. More...
 
class  admin_settings_sitepolicy_handler_select
 Selection of plugins that can work as site policy handlers. More...
 
class  advanced_testcase
 Advanced PHPUnit test case customised for Moodle. More...
 
class  alignment_form
 Form to edit alignment. More...
 
class  async_helper
 Helper functions for asynchronous backups and restores. More...
 
class  auth_plugin_base
 Abstract authentication plugin. More...
 
class  award_criteria
 Award criteria abstract definition. More...
 
class  award_criteria_activity
 Badge award criteria – award on activity completion. More...
 
class  award_criteria_badge
 Badge award criteria – award on badge completion. More...
 
class  award_criteria_cohort
 Badge award criteria – award on cohort membership. More...
 
class  award_criteria_competency
 Badge award criteria – award on competency completion. More...
 
class  award_criteria_course
 Badge award criteria – award on course completion. More...
 
class  award_criteria_courseset
 Badge award criteria – award on courseset completion. More...
 
class  award_criteria_manual
 Manual badge award criteria. More...
 
class  award_criteria_overall
 Overall badge award criteria. More...
 
class  award_criteria_profile
 Profile completion badge award criteria. More...
 
class  backup_cron_automated_helper
 This class is an abstract class with methods that can be called to aid the running of automated backups over cron. More...
 
class  badge_award_selector_base
 
class  badge_existing_users_selector
 A user selector control for existing users to award badge. More...
 
class  badge_potential_users_selector
 A user selector control for potential users to award badge. More...
 
class  badges_preferences_form
 
class  base_converter
 Base converter class. More...
 
class  base_testcase
 Base class for PHPUnit test cases customised for Moodle. More...
 
class  basic_testcase
 The simplest PHPUnit test case customised for Moodle. More...
 
class  behat_accessibility
 Steps definitions to assist with accessibility testing. More...
 
class  behat_action_menu
 Steps definitions to open and close action menus. More...
 
class  behat_base
 Steps definitions base class. More...
 
class  behat_command
 Behat command related utils. More...
 
class  behat_component_named_replacement
 A class for recording the definition of Mink replacements for use in Mink selectors. More...
 
class  behat_component_named_selector
 Class representing a named selector that can be used in Behat tests. More...
 
class  behat_config_manager
 Behat configuration manager. More...
 
class  behat_config_util
 Behat configuration manager. More...
 
class  behat_context_helper
 Helper to get behat contexts. More...
 
class  behat_data_generators
 Class to set up quickly a Given environment. More...
 
class  behat_deprecated
 
class  behat_deprecated_base
 
class  behat_exact_named_selector
 Moodle selectors manager. More...
 
class  behat_field_manager
 Helper to interact with form fields. More...
 
class  behat_filters
 Steps definitions related to filters. More...
 
class  behat_general
 Cross component steps definitions. More...
 
class  behat_init_context
 Loads main subcontexts. More...
 
class  behat_login
 Contains functions used by behat to test functionality. More...
 
class  behat_moodlenet
 
class  behat_navigation
 Steps definitions to navigate through the navigation tree nodes. More...
 
class  behat_partial_named_selector
 Moodle selectors manager. More...
 
class  behat_permissions
 Steps definitions to set up permissions to capabilities. More...
 
class  behat_selectors
 Moodle selectors manager. More...
 
interface  behat_session_interface
 The Interface for a behat root context. More...
 
class  behat_transformations
 Transformations to apply to steps arguments. More...
 
class  behat_util
 Init/reset utilities for Behat database and dataroot. More...
 
class  block_contents
 This class represents how a block appears on a page. More...
 
class  block_manager
 This class keeps track of the block that should appear on a moodle_page. More...
 
class  block_move_target
 This class represents a target for where a block can go when it is being moved. More...
 
class  block_not_on_page_exception
 Exception thrown when someone tried to do something with a block that does not exist on a page. More...
 
class  bootstrap_renderer
 This class solves the problem of how to initialise $OUTPUT. More...
 
class  breadcrumb_navigation_node
 Subclass of navigation_node allowing different rendering for the breadcrumbs in particular adding extra metadata for search engine robots to leverage. More...
 
class  cache
 The main cache class. More...
 
class  cache_application
 An application cache. More...
 
class  cache_config
 Cache configuration reader. More...
 
class  cache_config_disabled
 The cache config class used when the Cache has been disabled. More...
 
interface  cache_data_source
 Cache Data Source. More...
 
interface  cache_data_source_versionable
 Versionable cache data source. More...
 
class  cache_definition
 The cache definition class. More...
 
class  cache_definition_mappings_form
 Form to set definition mappings. More...
 
class  cache_definition_sharing_form
 Form to set definition sharing option. More...
 
class  cache_disabled
 Required as it is needed for cache_config_disabled which extends cache_config_writer. More...
 
class  cache_factory
 The cache factory class. More...
 
class  cache_factory_disabled
 The cache factory class used when the Cache has been disabled. More...
 
class  cache_helper
 The cache helper class. More...
 
interface  cache_is_configurable
 Cache store feature: configurable. More...
 
interface  cache_is_key_aware
 Cache store feature: key awareness. More...
 
interface  cache_is_lockable
 Cache store feature: locking. More...
 
interface  cache_is_searchable
 Cache store feature: keys are searchable. More...
 
interface  cache_loader
 Cache Loader. More...
 
interface  cache_loader_with_locking
 Cache Loader supporting locking. More...
 
class  cache_lock_form
 Form to add a cache lock instance. More...
 
interface  cache_lock_interface
 Cache lock interface. More...
 
class  cache_mode_mappings_form
 Form to set the mappings for a mode. More...
 
class  cache_request
 An request cache. More...
 
class  cache_session
 A session cache. More...
 
class  cache_store
 Abstract cache store class. More...
 
interface  cache_store_interface
 Cache store interface. More...
 
interface  cacheable_object
 Cacheable object. More...
 
class  cached_cm_info
 Class that is the return value for the _get_coursemodule_info module API function. More...
 
class  cachestore_addinstance_form
 Add store instance form. More...
 
class  cachestore_dummy
 The cache dummy store. More...
 
class  calc_formula
 This class abstracts evaluation of spreadsheet formulas. More...
 
class  cm_info
 
class  coding_exception
 Exception indicating programming error, must be fixed by a programer. More...
 
class  combined_progress_trace
 Special type of trace that can be used for redirecting to multiple other traces. More...
 
class  comment
 Comment is helper class to add/delete comments anywhere in moodle. More...
 
class  comment_exception
 Comment exception class. More...
 
class  completion_info
 Class represents completion information for a course. More...
 
class  component_action
 Helper class used by other components that involve an action on the page (URL or JS). More...
 
class  component_generator_base
 Component generator base class. More...
 
class  component_installer
 This class is used to check, download and install items from download.moodle.org to the moodledata directory. More...
 
class  confirm_action
 Confirm action. More...
 
class  context_header
 Renderable for the main page header. More...
 
class  convert_exception
 General convert-related exception. More...
 
class  convert_factory
 Factory class to create new instances of backup converters. More...
 
class  convert_helper
 Provides various functionality via its static methods. More...
 
class  convert_helper_exception
 General convert_helper related exception. More...
 
class  core\access\get_user_capability_course_helper
 Helper functions to implement the complex get_user_capability_course function. More...
 
class  core\activity_dates
 Class for fetching the important dates of an activity module for a given module instance and a user. More...
 
class  core\analytics\analyser\courses
 Courses analyser working at course level (insights for the course teachers). More...
 
class  core\analytics\analyser\site_courses
 Site courses analyser working at system level (insights for the site admin). More...
 
class  core\analytics\analyser\student_enrolments
 Student enrolments analyser. More...
 
class  core\analytics\analyser\users
 Users analyser (insights for users). More...
 
class  core\analytics\indicator\any_access_after_end
 Any access after the official end of the course. More...
 
class  core\analytics\indicator\any_access_before_start
 Any access before the official start of the course. More...
 
class  core\analytics\indicator\any_course_access
 Any access indicator. More...
 
class  core\analytics\indicator\any_write_action
 Write actions indicator. More...
 
class  core\analytics\indicator\any_write_action_in_course
 Write actions in a course indicator. More...
 
class  core\analytics\indicator\read_actions
 Read actions indicator. More...
 
class  core\analytics\time_splitting\deciles
 10 parts time splitting method. More...
 
class  core\analytics\time_splitting\deciles_accum
 Range processor splitting the course in ten parts and accumulating data. More...
 
class  core\analytics\time_splitting\no_splitting
 No time splitting method. More...
 
class  core\analytics\time_splitting\quarters
 Quarters time splitting method. More...
 
class  core\analytics\time_splitting\quarters_accum
 Range processor splitting the course in quarters and accumulating data. More...
 
class  core\analytics\time_splitting\single_range
 Single time splitting method. More...
 
class  core\antivirus\scanner
 Base abstract antivirus scanner class. More...
 
class  core\antivirus\scanner_exception
 An antivirus scanner exception class. More...
 
class  core\chart_axis
 Chart axis class. More...
 
class  core\chart_bar
 Chart bar class. More...
 
class  core\chart_base
 Chart base class. More...
 
class  core\chart_line
 Chart line class. More...
 
class  core\chart_pie
 Chart pie class. More...
 
class  core\chart_series
 Chart series class. More...
 
class  core\check\access\defaultuserrole
 
class  core\check\access\frontpagerole
 Verifies sanity of frontpage role. More...
 
class  core\check\access\guestrole
 Verifies sanity of guest role. More...
 
class  core\check\access\riskadmin
 Lists all admins. More...
 
class  core\check\access\riskbackup
 Lists all roles that have the ability to backup user data, as well as users. More...
 
class  core\check\access\riskbackup_result
 Lists all roles that have the ability to backup user data, as well as users. More...
 
class  core\check\access\riskxss
 Lists all users with XSS risk. More...
 
class  core\check\access\riskxss_result
 Lists all users with XSS risk. More...
 
class  core\check\check
 Base class for checks. More...
 
class  core\check\environment\antivirus
 
class  core\check\environment\configrw
 Verifies config.php is not writable anymore after installation. More...
 
class  core\check\environment\displayerrors
 Verifies displaying of errors. More...
 
class  core\check\environment\environment
 Environment check. More...
 
class  core\check\environment\preventexecpath
 Verifies the status of preventexecpath. More...
 
class  core\check\environment\publicpaths
 Check the public access of various paths. More...
 
class  core\check\environment\unsecuredataroot
 Verifies fatal misconfiguration of dataroot. More...
 
class  core\check\environment\upgradecheck
 Upgrade check. More...
 
class  core\check\http\cookiesecure
 Verifies if https enabled only secure cookies allowed. More...
 
class  core\check\manager
 Check API manager. More...
 
class  core\check\performance\backups
 Backups check. More...
 
class  core\check\performance\cachejs
 CacheJS check. More...
 
class  core\check\performance\dbschema
 DB schema performance check. More...
 
class  core\check\performance\debugging
 Debugging check. More...
 
class  core\check\performance\designermode
 Designer mode. More...
 
class  core\check\performance\stats
 
class  core\check\result
 A check object returns a result object. More...
 
class  core\check\security\crawlers
 Verifies web crawler (search engine) access. More...
 
class  core\check\security\emailchangeconfirmation
 Verifies email confirmation - spammers were changing mails very often. More...
 
class  core\check\security\embed
 Verifies sloppy embedding - this should have been removed long ago!! More...
 
class  core\check\security\openprofiles
 Verifies open profiles - originally open by default, not anymore because spammer abused it a lot. More...
 
class  core\check\security\passwordpolicy
 Verifies if password policy set. More...
 
class  core\check\security\webcron
 Verifies the status of web cron. More...
 
class  core\check\table
 A table of check results. More...
 
class  core\content\export\exportable_item
 An object used to represent content which can be served. More...
 
class  core\content\export\exportable_items\exportable_filearea
 The definition of a set of files in a filearea to be exported. More...
 
class  core\content\export\exportable_items\exportable_stored_file
 An object used to represent content which can be served. More...
 
class  core\content\export\exportable_items\exportable_textarea
 The definition of a text area which can be exported. More...
 
class  core\content\export\exported_item
 This class describes the files which were exported, and any text content that those files were contained in. More...
 
class  core\content\export\exporters\abstract_mod_exporter
 Activity module exporter for the content API. More...
 
class  core\content\export\exporters\component_exporter
 A class to help define, describe, and export content in a specific context. More...
 
class  core\content\export\exporters\course_exporter
 The course exporter. More...
 
class  core\content\export\zipwriter
 Zip writer wrapper. More...
 
class  core\cron
 
class  core\dataformat
 Dataformat utility class. More...
 
class  core\dataformat\base
 Base class for dataformat. More...
 
class  core\dataformat\spout_base
 Common Spout class for dataformat. More...
 
class  core\dml\recordset_walk
 Iterator that walks through a moodle_recordset applying the provided function. More...
 
class  core\dml\sql_join
 An object that contains sql join fragments. More...
 
class  core\dml\table
 Helpers and methods relating to DML tables. More...
 
class  core\encryption
 
class  core\event\antivirus_scan_data_error
 
class  core\event\antivirus_scan_file_error
 
class  core\event\assessable_submitted
 Abstract assessable submitted event class. More...
 
class  core\event\assessable_uploaded
 
class  core\event\badge_awarded
 Event triggered after a badge is awarded to a user. More...
 
class  core\event\badge_criteria_created
 
class  core\event\badge_criteria_deleted
 
class  core\event\badge_criteria_updated
 
class  core\event\badge_deleted
 Event triggered after a badge is deleted. More...
 
class  core\event\badge_listing_viewed
 
class  core\event\badge_revoked
 Event triggered after a badge is revoked from a user. More...
 
class  core\event\base
 
class  core\event\blog_association_deleted
 
class  core\event\blog_comment_created
 The blog comment created event class. More...
 
class  core\event\blog_comment_deleted
 The blog comment deleted event class. More...
 
class  core\event\blog_entries_viewed
 
class  core\event\blog_external_removed
 Class for event to be triggered when an external blog is removed from moodle. More...
 
class  core\event\blog_external_viewed
 
class  core\event\calendar_subscription_created
 
class  core\event\calendar_subscription_deleted
 
class  core\event\calendar_subscription_updated
 
class  core\event\capability_assigned
 Capability assigned event class. More...
 
class  core\event\capability_unassigned
 Capability unassigned event class. More...
 
class  core\event\cohort_created
 Cohort created event class. More...
 
class  core\event\cohort_deleted
 Cohort deleted event class. More...
 
class  core\event\cohort_updated
 Cohort updated event class. More...
 
class  core\event\comments_viewed
 Abstract comments viewed event class. More...
 
class  core\event\config_log_created
 
class  core\event\contentbank_content_created
 
class  core\event\contentbank_content_deleted
 
class  core\event\contentbank_content_updated
 
class  core\event\contentbank_content_uploaded
 
class  core\event\contentbank_content_viewed
 
class  core\event\course_backup_created
 
class  core\event\course_category_created
 Course category created event class. More...
 
class  core\event\course_category_updated
 Course category updated event class. More...
 
class  core\event\course_category_viewed
 Course category viewed event class. More...
 
class  core\event\course_completed
 
class  core\event\course_completion_updated
 Course module completion updated event class. More...
 
class  core\event\course_information_viewed
 Course information viewed event class. More...
 
class  core\event\course_module_deleted
 
class  core\event\course_module_instance_list_viewed
 Course module instance list viewed event class. More...
 
class  core\event\course_module_instances_list_viewed
 This class has been deprecated, please use core\event\course_module_instance_list_viewed. More...
 
class  core\event\course_module_viewed
 Abstract Course module viewed event class. More...
 
class  core\event\course_resources_list_viewed
 Event for viewing the list of course resources. More...
 
class  core\event\course_section_deleted
 
class  core\event\course_updated
 
class  core\event\course_user_report_viewed
 
class  core\event\course_viewed
 
class  core\event\dashboard_reset
 
class  core\event\dashboard_viewed
 Dashboard viewed event class. More...
 
class  core\event\dashboards_reset
 
class  core\event\database_text_field_content_replaced
 
class  core\event\grade_exported
 
class  core\event\grade_item_deleted
 Grade item deleted event class. More...
 
class  core\event\grade_item_updated
 Grade item updated event class. More...
 
class  core\event\grade_letter_created
 Grade letter created event class. More...
 
class  core\event\grade_letter_deleted
 Grade letter deleted event class. More...
 
class  core\event\grade_letter_updated
 Grade letter updated event class. More...
 
class  core\event\grade_report_viewed
 Grade report viewed event class. More...
 
class  core\event\group_created
 Group created event class. More...
 
class  core\event\group_deleted
 Group deleted event class. More...
 
class  core\event\group_message_sent
 
class  core\event\group_updated
 Group updated event class. More...
 
class  core\event\grouping_created
 Grouping created event class. More...
 
class  core\event\grouping_deleted
 Grouping deleted event class. More...
 
class  core\event\grouping_group_assigned
 Group assigned to grouping event class. More...
 
class  core\event\grouping_group_unassigned
 Group unassigned from grouping event class. More...
 
class  core\event\grouping_updated
 Grouping updated event class. More...
 
class  core\event\manager
 Class used for event dispatching. More...
 
class  core\event\message_deleted
 
class  core\event\message_sent
 
class  core\event\message_viewed
 
class  core\event\moodlenet_resource_exported
 
class  core\event\mycourses_viewed
 
class  core\event\notes_viewed
 Class note_viewed. More...
 
class  core\event\notification_sent
 
class  core\event\qbank_plugin_base
 
class  core\event\qbank_plugin_disabled
 
class  core\event\qbank_plugin_enabled
 
class  core\event\question_base
 Base class for question events. More...
 
class  core\event\question_category_base
 Base class for question category events. More...
 
class  core\event\question_category_created
 Question category created event class. More...
 
class  core\event\question_category_deleted
 Question category deleted event class. More...
 
class  core\event\question_category_moved
 Question category moved event class. More...
 
class  core\event\question_category_updated
 Question category updated event class. More...
 
class  core\event\question_category_viewed
 Question category viewed event class. More...
 
class  core\event\question_created
 
class  core\event\question_deleted
 
class  core\event\question_moved
 
class  core\event\question_updated
 
class  core\event\question_viewed
 
class  core\event\questions_exported
 
class  core\event\questions_imported
 
class  core\event\recent_activity_viewed
 Event for recent activity page. More...
 
class  core\event\role_allow_assign_updated
 Role assignments updated event class. More...
 
class  core\event\role_allow_override_updated
 Role allow override updated event class. More...
 
class  core\event\role_allow_switch_updated
 Role allow switch updated event class. More...
 
class  core\event\role_allow_view_updated
 Role allow view updated event class. More...
 
class  core\event\role_capabilities_updated
 Role updated event class. More...
 
class  core\event\scale_created
 Scale created event class. More...
 
class  core\event\scale_deleted
 Scale deleted event class. More...
 
class  core\event\scale_updated
 Scale updated event class. More...
 
class  core\event\search_indexed
 Event when new data has been indexed. More...
 
class  core\event\search_results_viewed
 
class  core\event\tag_collection_created
 Tag collection created event class. More...
 
class  core\event\tag_collection_deleted
 Tag collection deleted event class. More...
 
class  core\event\tag_collection_updated
 Tag collection updated event class. More...
 
class  core\event\tag_created
 
class  core\event\tag_deleted
 
class  core\event\tag_flagged
 
class  core\event\tag_unflagged
 
class  core\event\tag_updated
 
class  core\event\unknown_logged
 Unknown event class. More...
 
class  core\event\url_blocked
 
class  core\event\user_deleted
 
class  core\event\user_enrolment_created
 
class  core\event\user_enrolment_updated
 
class  core\event\user_graded
 
class  core\event\user_list_viewed
 
class  core\event\user_loggedout
 
class  core\event\user_login_failed
 
class  core\event\user_password_policy_failed
 Event when user's current password fails the password policy. More...
 
class  core\event\user_password_updated
 
class  core\event\userfeedback_give
 Class userfeedback_give. More...
 
class  core\event\userfeedback_remind
 Class userfeedback_remind. More...
 
class  core\event\virus_infected_data_detected
 Data infected event. More...
 
class  core\event\virus_infected_file_detected
 Fle infected event. More...
 
class  core\event\webservice_service_created
 
class  core\event\webservice_service_deleted
 Web service service deleted event class. More...
 
class  core\event\webservice_service_updated
 Web service service updated event class. More...
 
class  core\event\webservice_token_created
 
class  core\event\webservice_token_sent
 Webservice token sent event class. More...
 
class  core\external\coursecat_summary_exporter
 Class for exporting a course summary from an stdClass. More...
 
class  core\external\dynamic_tabs_get_content
 
class  core\external\editmode
 
class  core\external\moodlenet_auth_check
 
class  core\external\moodlenet_get_share_info_activity
 
class  core\external\moodlenet_get_shared_course_info
 
class  core\external\moodlenet_send_activity
 
class  core\external\moodlenet_send_course
 
class  core\external\output\icon_system\load_fontawesome_map
 
class  core\external\paged_content_exporter
 Paged Content exporter. More...
 
class  core\external\persistent_exporter
 Abstract exporter based on the persistent model. More...
 
class  core\external\record_userfeedback_action
 
class  core\files\curl_security_helper
 Host and port checking for curl. More...
 
class  core\files\curl_security_helper_base
 Security helper for the curl class. More...
 
class  core\form\error_feedback
 Moodle 404 Error page feedback form. More...
 
interface  core\hook\deprecated_callback_replacement
 
interface  core\hook\described_hook
 
interface  core\hook\discovery_agent
 
class  core\hook\manager
 
class  core\hook\navigation\primary_extend
 
class  core\hooks
 
class  core\http_client
 
class  core\hub\api
 Provides methods to communicate with the hub (sites directory) web services. More...
 
class  core\hub\registration
 Methods to use when registering the site at the moodle sites directory. More...
 
class  core\hub\site_registration_form
 The site registration form. More...
 
class  core\invalid_persistent_exception
 Invalid persistent exception class. More...
 
class  core\ip_utils
 Static helper class providing some useful internet-protocol-related functions. More...
 
class  core\local\cli\shutdown
 CLI script shutdown helper class. More...
 
class  core\local\guzzle\cache_handler
 
class  core\local\guzzle\cache_item
 
class  core\local\guzzle\cache_storage
 
class  core\local\guzzle\check_request
 
class  core\local\guzzle\redirect_middleware
 
class  core\lock\db_record_lock_factory
 
class  core\lock\file_lock_factory
 
class  core\lock\installation_lock_factory
 
class  core\lock\lock
 
class  core\lock\lock_config
 Lock configuration class, used to get an instance of the currently configured lock factory. More...
 
interface  core\lock\lock_factory
 Defines abstract factory class for generating locks. More...
 
class  core\lock\lock_utils
 
class  core\lock\mysql_lock_factory
 
class  core\lock\postgres_lock_factory
 
class  core\lock\timing_wrapper_lock_factory
 
class  core\log\dummy_manager
 
interface  core\log\manager
 Interface describing log readers. More...
 
interface  core\log\reader
 
interface  core\log\sql_internal_table_reader
 Sql internal table reader. More...
 
interface  core\log\sql_reader
 Log iterator reader interface. More...
 
class  core\message\inbound\private_files_handler
 A Handler to store attachments sent in e-mails as private files. More...
 
class  core\moodlenet\activity_packager
 
class  core\moodlenet\activity_sender
 
class  core\moodlenet\course_packager
 
class  core\moodlenet\course_partial_packager
 
class  core\moodlenet\course_partial_sender
 
class  core\moodlenet\course_sender
 
class  core\moodlenet\helpers
 
class  core\moodlenet\moodlenet_client
 
class  core\moodlenet\resource_packager
 
class  core\moodlenet\resource_sender
 
class  core\moodlenet\share_progress_table
 MoodleNet share progress table. More...
 
class  core\moodlenet\share_recorder
 
class  core\moodlenet\utilities
 
class  core\navigation\output\more_menu
 
class  core\navigation\output\primary
 
class  core\navigation\views\primary
 
class  core\navigation\views\secondary
 
class  core\navigation\views\view
 
class  core\notification
 
class  core\oauth2\access_token
 Loads/stores oauth2 access tokens in DB for system accounts in order to use a single token across multiple sessions. More...
 
class  core\oauth2\api
 Static list of api methods for system oauth2 configuration. More...
 
class  core\oauth2\client
 Configurable oauth2 client class. More...
 
class  core\oauth2\client\clever
 
class  core\oauth2\client\linkedin
 
class  core\oauth2\discovery\auth_server_config_reader
 
class  core\oauth2\discovery\base_definition
 
class  core\oauth2\discovery\imsbadgeconnect
 
class  core\oauth2\discovery\openidconnect
 
class  core\oauth2\endpoint
 Class for loading/storing oauth2 endpoints from the DB. More...
 
class  core\oauth2\issuer
 Class for loading/storing issuer from the DB. More...
 
class  core\oauth2\refresh_system_tokens_task
 Task to refresh system tokens regularly. More...
 
class  core\oauth2\rest
 Rest API base class mapping rest api methods to endpoints with http methods, args and post body. More...
 
class  core\oauth2\rest_exception
 Rest Exception class containing error code and message. More...
 
class  core\oauth2\service\clever
 
class  core\oauth2\service\custom
 
class  core\oauth2\service\facebook
 
class  core\oauth2\service\google
 
class  core\oauth2\service\imsobv2p1
 
interface  core\oauth2\service\issuer_interface
 
class  core\oauth2\service\linkedin
 
class  core\oauth2\service\microsoft
 
class  core\oauth2\service\moodlenet
 
class  core\oauth2\service\nextcloud
 
class  core\oauth2\system_account
 Class for loading/storing oauth2 refresh tokens from the DB. More...
 
class  core\oauth2\user_field_mapping
 Class for loading/storing oauth2 user field mappings from the DB. More...
 
class  core\output\activity_header
 
class  core\output\checkbox_toggleall
 The checkbox-toggleall renderable class. More...
 
class  core\output\choicelist
 
class  core\output\chooser
 The chooser renderable class. More...
 
class  core\output\chooser_item
 The chooser_item renderable class. More...
 
class  core\output\chooser_section
 The chooser_section renderable class. More...
 
class  core\output\datafilter
 
class  core\output\dynamic_tabs
 
class  core\output\dynamic_tabs\base
 
class  core\output\external
 
class  core\output\icon_system
 Class allowing different systems for mapping and rendering icons. More...
 
class  core\output\icon_system_font
 Class allowing different systems for mapping and rendering icons. More...
 
class  core\output\icon_system_fontawesome
 Class allowing different systems for mapping and rendering icons. More...
 
class  core\output\icon_system_standard
 Standard icon rendering. More...
 
class  core\output\inplace_editable
 Class allowing to quick edit a title inline. More...
 
class  core\output\language_menu
 Class for creating the language menu. More...
 
class  core\output\local\dropdown\dialog
 
class  core\output\local\dropdown\status
 
class  core\output\mustache_clean_string_helper
 This class will load language strings in a template. More...
 
class  core\output\mustache_filesystem_loader
 Perform some custom name mapping for template file names. More...
 
class  core\output\mustache_pix_helper
 This class will call pix_icon with the section content. More...
 
class  core\output\mustache_quote_helper
 Wrap content in quotes, and escape all special JSON characters used. More...
 
class  core\output\mustache_shorten_text_helper
 This class will call shorten_text with the section content. More...
 
class  core\output\mustache_string_helper
 This class will load language strings in a template. More...
 
class  core\output\mustache_template_finder
 Get information about valid locations for mustache templates. More...
 
class  core\output\mustache_template_source_loader
 Load template source strings. More...
 
class  core\output\mustache_uniqid_helper
 Lazy create a uniqid per instance of the class. More...
 
class  core\output\mustache_user_date_helper
 Mustache helper that will convert a timestamp to a date string. More...
 
interface  core\output\named_templatable
 
class  core\output\notification
 Data structure representing a notification. More...
 
class  core\output\participants_action_bar
 
class  core\output\select_menu
 
class  core\output\sticky_footer
 
interface  core\output\url_rewriter
 URL rewriter interface. More...
 
class  core\persistent
 
class  core\plugininfo\auth
 Class for authentication plugins. More...
 
class  core\plugininfo\availability
 Class for availability plugins. More...
 
class  core\plugininfo\base
 
class  core\plugininfo\block
 Class for page side blocks. More...
 
class  core\plugininfo\cachelock
 Class for admin tool plugins. More...
 
class  core\plugininfo\cachestore
 Class for cache store plugins. More...
 
class  core\plugininfo\calendartype
 Class for calendar type plugins. More...
 
class  core\plugininfo\communication
 
class  core\plugininfo\coursereport
 Class for admin tool plugins. More...
 
class  core\plugininfo\customfield
 Class for admin tool plugins. More...
 
class  core\plugininfo\dataformat
 Class for dataformats. More...
 
class  core\plugininfo\editor
 Class for HTML editors. More...
 
class  core\plugininfo\enrol
 Class for enrolment plugins. More...
 
class  core\plugininfo\fileconverter
 Class for document converter plugins. More...
 
class  core\plugininfo\filter
 Class for text filters. More...
 
class  core\plugininfo\format
 Class for course formats. More...
 
class  core\plugininfo\general
 General class for all plugin types that do not have their own class. More...
 
class  core\plugininfo\gradeexport
 Class for admin tool plugins. More...
 
class  core\plugininfo\gradeimport
 Class for admin tool plugins. More...
 
class  core\plugininfo\gradereport
 Class for admin tool plugins. More...
 
class  core\plugininfo\gradingform
 Class for admin tool plugins. More...
 
class  core\plugininfo\h5plib
 Class for H5P libraries. More...
 
class  core\plugininfo\local
 Class for local plugins. More...
 
class  core\plugininfo\media
 Class for media plugins. More...
 
class  core\plugininfo\message
 Class for messaging processors. More...
 
class  core\plugininfo\mlbackend
 Class for analytics machine learning backend plugins. More...
 
class  core\plugininfo\mnetservice
 Class representing an MNet service. More...
 
class  core\plugininfo\mod
 Class for activity modules. More...
 
class  core\plugininfo\orphaned
 Orphaned subplugins class. More...
 
class  core\plugininfo\plagiarism
 Class for plagiarism plugins. More...
 
class  core\plugininfo\portfolio
 Class for portfolios. More...
 
class  core\plugininfo\profilefield
 Class for admin tool plugins. More...
 
class  core\plugininfo\qbank
 Base class for qbank plugins. More...
 
class  core\plugininfo\qbehaviour
 Class for question behaviours. More...
 
class  core\plugininfo\qformat
 Class for question types. More...
 
class  core\plugininfo\qtype
 Class for question types. More...
 
class  core\plugininfo\report
 Class for admin tool plugins. More...
 
class  core\plugininfo\repository
 Class for repositories. More...
 
class  core\plugininfo\search
 Class for search plugins. More...
 
class  core\plugininfo\theme
 Class for themes. More...
 
class  core\plugininfo\tool
 Class for admin tool plugins. More...
 
class  core\plugininfo\webservice
 Class for webservice protocols. More...
 
class  core\privacy\provider
 Privacy class for requesting user data. More...
 
class  core\progress\db_updater
 Progress handler that updates a database table with the progress. More...
 
class  core\progress\none
 Progress handler that ignores progress entirely. More...
 
class  core\report_helper
 A helper class with static methods to help report plugins. More...
 
class  core\reportbuilder\local\entities\context
 
class  core\session\database
 Database based session handler. More...
 
class  core\session\exception
 Session related exception class. More...
 
class  core\session\external
 This class contains a list of webservice functions related to session. More...
 
class  core\session\file
 File based session handler. More...
 
class  core\session\handler
 Session handler base. More...
 
class  core\session\manager
 Session manager, this is the public Moodle API for sessions. More...
 
class  core\session\memcached
 Memcached based session handler. More...
 
class  core\session\redis
 Redis based session handler. More...
 
class  core\session\utility\cookie_helper
 
class  core\task\adhoc_task
 Abstract class defining an adhoc task. More...
 
class  core\task\analytics_cleanup_task
 Delete stale records from analytics tables. More...
 
class  core\task\asynchronous_backup_task
 Adhoc task that performs asynchronous backups. More...
 
class  core\task\asynchronous_copy_task
 Adhoc task that performs asynchronous course copies. More...
 
class  core\task\asynchronous_restore_task
 Adhoc task that performs asynchronous restores. More...
 
class  core\task\automated_backup_report_task
 
class  core\task\automated_backup_task
 Simple task to run the backup cron. More...
 
class  core\task\badges_adhoc_task
 
class  core\task\badges_cron_task
 Simple task to run the badges cron. More...
 
class  core\task\badges_message_task
 Simple task to run the badges cron. More...
 
class  core\task\blog_cron_task
 Simple task to run the blog cron. More...
 
class  core\task\build_installed_themes_task
 Class that builds and caches all of the site's installed themes. More...
 
class  core\task\cache_cleanup_task
 Simple task to delete old cache records. More...
 
class  core\task\cache_cron_task
 Simple task to run the cache cron. More...
 
class  core\task\calendar_cron_task
 Simple task to run the calendar cron. More...
 
class  core\task\calendar_fix_orphaned_events
 Class handling fixing of events that have had their userid lost. More...
 
class  core\task\check_for_updates_task
 Simple task to run the registration cron. More...
 
class  core\task\clean_up_deleted_search_area_task
 Class that cleans up data related to deleted search area. More...
 
class  core\task\completion_daily_task
 Simple task to run the daily completion cron. More...
 
class  core\task\completion_regular_task
 Simple task to run the regular completion cron. More...
 
class  core\task\context_cleanup_task
 Simple task to delete old context records. More...
 
class  core\task\course_backup_task
 Adhoc task that performs single automated course backup. More...
 
class  core\task\create_contexts_task
 Simple task to create missing contexts at all levels. More...
 
class  core\task\database_logger
 Database logger for task logging. More...
 
class  core\task\delete_incomplete_users_task
 Simple task to delete user accounts for users who have not completed their profile in time. More...
 
class  core\task\delete_unconfirmed_users_task
 Simple task to delete user accounts for users who have not confirmed in time. More...
 
class  core\task\file_temp_cleanup_task
 Simple task to delete temp files older than 1 week. More...
 
class  core\task\file_trash_cleanup_task
 Simple task to run the file trash cleanup cron. More...
 
class  core\task\fix_file_timestamps_task
 
class  core\task\grade_cron_task
 Simple task to run the grade cron. More...
 
class  core\task\grade_history_cleanup_task
 Simple task to clean grade history tables. More...
 
class  core\task\h5p_get_content_types_task
 
class  core\task\hide_ended_courses_task
 
class  core\task\logmanager
 Task log manager. More...
 
class  core\task\manager
 Collection of task related methods. More...
 
class  core\task\messaging_cleanup_task
 Simple task to delete old messaging records. More...
 
class  core\task\password_reset_cleanup_task
 Simple task to delete old password reset records. More...
 
class  core\task\plagiarism_cron_task
 Simple task to run the plagiarism cron. More...
 
class  core\task\portfolio_cron_task
 Simple task to run the portfolio cron. More...
 
class  core\task\question_preview_cleanup_task
 A task to cleanup old question previews. More...
 
class  core\task\refresh_mod_calendar_events_task
 Class that updates all of the existing calendar events for modules that implement the *_refresh_events() hook. More...
 
class  core\task\registration_cron_task
 Simple task to run the registration cron. More...
 
class  core\task\scheduled_task
 Abstract class defining a scheduled task. More...
 
class  core\task\search_index_task
 Runs global search indexing. More...
 
class  core\task\search_optimize_task
 Runs search index optimization. More...
 
class  core\task\send_failed_login_notifications_task
 Simple task to send notifications about failed login attempts. More...
 
class  core\task\send_login_notifications
 
class  core\task\send_new_user_passwords_task
 Simple task to create accounts and send password emails for new users. More...
 
class  core\task\session_cleanup_task
 Simple task to cleanup user sessions from a scheduled task. More...
 
class  core\task\show_started_courses_task
 
class  core\task\stats_cron_task
 Simple task to run the stats cron. More...
 
class  core\task\tag_cron_task
 Simple task to run the tag cron. More...
 
class  core\task\task_base
 Abstract class for common properties of scheduled_task and adhoc_task. More...
 
class  core\task\task_lock_cleanup_task
 Adhoc task metadata cleanup task. More...
 
class  core\task\task_log_cleanup_task
 A task to cleanup log entries for tasks. More...
 
interface  core\task\task_logger
 Interface for task logging. More...
 
class  core\update\api
 General purpose client for https://download.moodle.org/api/. More...
 
class  core\update\checker
 Singleton class that handles checking for available updates. More...
 
class  core\update\checker_exception
 General exception thrown by the core::update::checker class. More...
 
class  core\update\info
 Defines the structure of objects returned by core::update::checker::get_update_info(). More...
 
class  core\upgrade\util
 Core upgrade utility class. More...
 
class  core\uuid
 V4 UUID generator class. More...
 
class  core_admin\form\purge_caches
 Form for selecting which caches to purge on admin/purgecaches.php. More...
 
class  core_admin\form\testoutgoingmailconf_form
 Test mail form. More...
 
class  core_admin\local\settings\setting_scheduled_task_status
 This admin setting tells whether a given scheduled task is enabled, providing a link to its configuration page. More...
 
class  core_admin_renderer
 
class  core_badges\badge
 Class that represents badge. More...
 
class  core_badges\form\backpack
 Form to edit backpack initial details. More...
 
class  core_badges\form\badge
 Form to edit badge details. More...
 
class  core_badges\form\collections
 Form to select backpack collections. More...
 
class  core_badges\form\message
 Form to edit badge message. More...
 
class  core_badges\helper
 Badge helper library. More...
 
class  core_badges\output\badge_alignments
 Link to external resources this badge is aligned with. More...
 
class  core_badges\output\badge_collection
 Collection of all badges for view.php page. More...
 
class  core_badges\output\badge_management
 Collection of badges used at the index.php page. More...
 
class  core_badges\output\badge_recipients
 Badge recipients rendering class. More...
 
class  core_badges\output\badge_related
 Collection of all related badges. More...
 
class  core_badges\output\badge_user_collection
 Collection of user badges used at the mybadges.php page. More...
 
class  core_badges\output\external_badge
 An external badges for external.php page. More...
 
class  core_badges\output\issued_badge
 An issued badges for badge.php page. More...
 
class  core_badges_assertion
 Open Badges Assertions specification 1.0 More...
 
class  core_badges_renderer
 Standard HTML output renderer for badges. More...
 
class  core_cache\administration_helper
 Administration helper base class. More...
 
class  core_cache\local\administration_display_helper
 A cache helper for administration tasks. More...
 
class  core_collator
 A collator class with static methods that can be used for sorting. More...
 
class  core_component
 Collection of components related methods. More...
 
class  core_course\analytics\indicator\activities_due
 Activities due indicator. More...
 
class  core_course\cache\course_image
 
class  core_course\local\entity\activity_chooser_footer
 A class to represent the Activity Chooser footer data. More...
 
class  core_course\local\entity\content_item
 The content_item class. More...
 
class  core_course\local\entity\lang_string_title
 The lang_string_title class of value object, providing access to the value of a lang string. More...
 
class  core_course\local\entity\string_title
 The string_title class of value object, which provides access to a simple string. More...
 
interface  core_course\local\entity\title
 
class  core_course\local\exporters\course_content_item_exporter
 The course_content_item_exporter class. More...
 
class  core_course\local\exporters\course_content_items_exporter
 The course_content_items_exporter class. More...
 
class  core_course\local\repository\caching_content_item_readonly_repository
 The class caching_content_item_repository, for fetching content_items, with additional caching. More...
 
class  core_course\local\repository\content_item_readonly_repository
 The class content_item_repository, for reading content_items. More...
 
interface  core_course\local\repository\content_item_readonly_repository_interface
 
class  core_course\output\category_action_bar
 
class  core_course\output\manage_categories_action_bar
 
class  core_course_category
 
class  core_course_list_element
 
class  core_cssparser
 Moodle CSS parser. More...
 
class  core_date
 Core date and time related code. More...
 
class  core_event_course_module_instance_list_viewed_testcase
 Class core_event_course_module_instance_list_viewed_testcase. More...
 
class  core_event_course_module_viewed_testcase
 Class core_event_course_module_viewed_testcase. More...
 
class  core_external
 
class  core_files_renderer
 File browser render. More...
 
class  core_filetypes
 Class to manage the custom filetypes list that is stored in a config variable. More...
 
class  core_geopattern
 
class  core_html2text
 Wrapper for Html2Text. More...
 
class  core_minify
 Collection of JS and CSS compression methods. More...
 
class  core_php_time_limit
 Utility class to manage PHP time limit. More...
 
class  core_plugin_manager
 
class  core_qrcode
 Class for generating QR codes. More...
 
class  core_question\statistics\questions\calculated
 This class is used to return the stats as calculated by core_question::statistics::questions::calculator. More...
 
class  core_question\statistics\questions\calculator
 This class has methods to compute the question statistics from the raw data. More...
 
class  core_renderer
 The standard implementation of the core_renderer interface. More...
 
class  core_renderer_ajax
 A renderer that generates output for ajax scripts. More...
 
class  core_renderer_cli
 A renderer that generates output for command-line scripts. More...
 
class  core_renderer_maintenance
 The maintenance renderer. More...
 
class  core_requirejs
 Collection of requirejs related methods. More...
 
class  core_rtlcss
 Moodle RTLCSS class. More...
 
class  core_scss
 Moodle SCSS compiler class. More...
 
class  core_shutdown_manager
 Shutdown management class. More...
 
interface  core_string_manager
 Interface for string manager. More...
 
class  core_string_manager_install
 Fetches minimum strings for installation. More...
 
class  core_string_manager_standard
 Standard string_manager implementation. More...
 
class  core_table\local\filter\filter
 Class representing a generic filter of any type. More...
 
class  core_table\local\filter\filterset
 Class representing a set of filters. More...
 
class  core_table\local\filter\integer_filter
 Class representing an integer filter. More...
 
class  core_table\local\filter\numeric_comparison_filter
 Class representing an integer filter. More...
 
class  core_table\local\filter\string_filter
 Class representing a string filter. More...
 
class  core_text
 defines string api's for manipulating strings More...
 
class  core_upgrade_time
 Static class monitors performance of upgrade steps. More...
 
class  core_user
 User class to access user details. More...
 
class  core_user\analytics\target\upcoming_activities_due
 Upcoming activities due target. More...
 
class  core_user\devicekey
 
class  core_user\external\update_user_device_public_key
 
class  core_user\table\participants_filterset
 Participants table filterset. More...
 
class  core_useragent
 The user agent class. More...
 
class  core_userfeedback
 This Class contains helper functions for user feedback functionality. More...
 
class  core_xml_parser
 Class for parsing xml files. More...
 
class  course_enrolment_table
 Main course enrolment table. More...
 
class  course_modinfo
 
class  course_reset_form
 Defines the course reset settings form. More...
 
class  coursecat_helper
 Class storing display options and functions to help display course category and/or courses lists. More...
 
class  csv_export_writer
 Utitily class for exporting of CSV files. More...
 
class  csv_import_reader
 Utitily class for importing of CSV files. More...
 
class  custom_menu
 Custom menu class. More...
 
class  custom_menu_item
 Custom menu item. More...
 
class  database_driver_testcase
 Special test case for testing of DML drivers and DDL layer. More...
 
class  dbtransfer_exception
 Exception class for db transfer. More...
 
class  ddl_change_structure_exception
 Error during changing db structure. More...
 
class  ddl_dependency_exception
 Error changing db structure, caused by some dependency found like trying to modify one field having related indexes. More...
 
class  ddl_exception
 DDL exception class, use instead of throw new moodle_exception() and "return false;" in ddl code. More...
 
class  ddl_field_missing_exception
 Table does not exist problem exception. More...
 
class  ddl_table_missing_exception
 Table does not exist problem exception. More...
 
class  default_block_generator
 Default block generator class to be used when a specific one is not supported. More...
 
class  dml_connection_exception
 DML db connection exception - triggered if database not accessible. More...
 
class  dml_exception
 DML exception class, use instead of throw new moodle_exception() in dml code. More...
 
class  dml_missing_record_exception
 Caused by missing record that is required for normal operation. More...
 
class  dml_multiple_records_exception
 Caused by multiple records found in get_record() call. More...
 
class  dml_read_exception
 DML read exception - triggered by some SQL syntax errors, etc. More...
 
class  dml_sessionwait_exception
 DML db session wait exception - triggered when session lock request times out. More...
 
class  dml_transaction_exception
 DML transaction exception - triggered by problems related to DB transactions. More...
 
class  dml_write_exception
 DML write exception - triggered by some SQL syntax errors, etc. More...
 
class  dndupload_ajax_processor
 Processes the upload, creating the course module and returning the result. More...
 
class  dndupload_handler
 Stores all the information about the available dndupload handlers. More...
 
class  downgrade_exception
 Exception indicating downgrade error during upgrade. More...
 
class  edit_criteria_form
 Form to edit badge criteria. More...
 
class  edit_relatedbadge_form
 Form to edit badge details. More...
 
class  emoticon_manager
 Provides core support for plugins that have to deal with emoticons (like HTML editor or emoticon filter). More...
 
class  endorsement_form
 Form to edit endorsement. More...
 
class  enrol_plugin
 Enrolment plugins abstract class. More...
 
class  environment_results
 Helper Class to return results to caller. More...
 
class  error_log_progress_trace
 This subclass of progress_trace outputs to error log. More...
 
class  file_picker
 Data structure representing a file picker. More...
 
class  file_serving_exception
 An exception that indicates that file can not be served. More...
 
class  files_tree_viewer
 Data structure representing a general moodle file tree viewer. More...
 
class  filter_local_settings_form
 
class  filter_manager
 Class to manage the filtering of strings. More...
 
class  filterobject
 This is just a little object to define a phrase and some instructions for how to process it. More...
 
class  flat_navigation
 Class used to generate a collection of navigation nodes most closely related to the current page. More...
 
class  flat_navigation_node
 Subclass of navigation_node allowing different rendering for the flat navigation in particular allowing dividers and indents. More...
 
class  flexible_table
 
class  flickr_client
 Simple Flickr API client implementing the features needed by Moodle. More...
 
class  fragment_requirements_manager
 This requirements manager captures the appropriate html for creating a fragment to be inserted elsewhere. More...
 
class  global_navigation
 The global navigation class used for... the global navigation. More...
 
class  global_navigation_for_ajax
 The global navigation class used especially for AJAX requests. More...
 
class  google_docs
 Class for manipulating google documents through the google data api. More...
 
class  google_oauth
 OAuth 2.0 client for Google Services. More...
 
class  graph
 
class  help_icon
 Data structure representing a help icon. More...
 
class  html_list_progress_trace
 HTML List Progress Tree. More...
 
class  html_progress_trace
 This subclass of progress_trace outputs as HTML. More...
 
class  html_table
 Holds all the information required to render a. More...
 
class  html_table_cell
 Component representing a table cell. More...
 
class  html_table_row
 Component representing a table row. More...
 
class  html_writer
 Simple html output class. More...
 
class  HTMLPurifier_URIScheme_gopher
 Validates Gopher defined by RFC 4266. More...
 
class  HTMLPurifier_URIScheme_irc
 Validates IRC defined by IETF Draft. More...
 
class  HTMLPurifier_URIScheme_mms
 Validates MMS defined by Microsoft. More...
 
class  HTMLPurifier_URIScheme_rtmp
 Validates RTMP defined by Adobe. More...
 
class  HTMLPurifier_URIScheme_rtsp
 Validates RTSP defined by RFC 2326. More...
 
class  HTMLPurifier_URIScheme_teamspeak
 Validates TeamSpeak defined by TeamSpeak. More...
 
class  image_icon
 Data structure representing an activity icon. More...
 
class  imscc11_backup_convert
 
class  imscc11_convert_exception
 Exception thrown by this converter. More...
 
class  imscc11_converter
 
class  imscc11_export_converter
 
class  imscc11_store_backup_file
 
class  imscc11_zip_contents
 
class  imscc1_convert_exception
 Exception thrown by this converter. More...
 
class  imscc1_converter
 
class  initials_bar
 Component representing initials bar. More...
 
class  invalid_dataroot_permissions
 An exception that indicates incorrect permissions in $CFG->dataroot. More...
 
class  invalid_parameter_exception
 Exception indicating malformed parameter problem. More...
 
class  invalid_response_exception
 Exception indicating malformed response problem. More...
 
class  invalid_state_exception
 An exception that indicates something really weird happened. More...
 
class  js_writer
 Simple javascript output class. More...
 
class  lang_installer
 End of component_installer class. More...
 
class  lang_installer_exception
 Exception thrown by lang_installer. More...
 
class  lang_string
 The lang_string class. More...
 
class  license_manager
 
class  list_item
 
class  login_change_password_form
 
class  login_forgot_password_form
 Reset forgotten password form definition. More...
 
class  login_set_password_form
 Set forgotten password form definition. More...
 
class  login_signup_form
 
class  mnet_profile_form
 small form to allow the administrator to configure (override) which profile fields are sent/imported over mnet More...
 
class  mnet_review_host_form
 The second step of the form - reviewing the host details This is also the same form that is used for editing an existing host. More...
 
class  mnet_services_form
 
class  mnet_simple_host_form
 The very basic first step add new host form - just wwwroot & application The second form is loaded up with the information from this one. More...
 
class  mod_chat_generator
 mod_chat data generator class. More...
 
class  Moodle\BehatExtension\Context\ContextClass\ClassResolver
 
class  Moodle\BehatExtension\Context\Initializer\MoodleAwareInitializer
 
class  Moodle\BehatExtension\Context\MoodleContext
 
class  Moodle\BehatExtension\Context\Step\ChainedStep
 
class  Moodle\BehatExtension\Context\Step\Given
 
class  Moodle\BehatExtension\Context\Step\Then
 
class  Moodle\BehatExtension\Context\Step\When
 
class  Moodle\BehatExtension\Definition\Cli\AvailableDefinitionsController
 
class  Moodle\BehatExtension\Definition\Printer\ConsoleDefinitionInformationPrinter
 
class  Moodle\BehatExtension\Driver\WebDriver
 
class  Moodle\BehatExtension\Driver\WebDriverFactory
 
class  Moodle\BehatExtension\EventDispatcher\Tester\ChainedStepTester
 
class  Moodle\BehatExtension\EventDispatcher\Tester\MoodleEventDispatchingStepTester
 
class  Moodle\BehatExtension\Exception\SkippedException
 
class  Moodle\BehatExtension\Output\Formatter\MoodleListFormatter
 
class  Moodle\BehatExtension\Output\Formatter\MoodleProgressFormatterFactory
 
class  Moodle\BehatExtension\Output\Formatter\MoodleScreenshotFormatter
 
class  Moodle\BehatExtension\Output\Formatter\MoodleStepcountFormatter
 
class  Moodle\BehatExtension\Output\Printer\MoodleProgressPrinter
 
class  moodle_exception
 Base Moodle Exception class. More...
 
class  moodle_list
 Clues to reading this code: More...
 
class  moodle_page
 
class  moodle_phpmailer
 Moodle Customised version of the PHPMailer class. More...
 
class  moodle_phpmailer_oauth
 
class  moodle_text_filter
 Base class for text filters. More...
 
class  moodle_url
 Class for creating and manipulating urls. More...
 
class  moodle_xhprofrun
 Custom implementation of iXHProfRuns. More...
 
class  MoodleExcelFormat
 Define and operate over one Format. More...
 
class  MoodleExcelWorkbook
 Define and operate over one Moodle Workbook. More...
 
class  MoodleExcelWorksheet
 Define and operate over one Worksheet. More...
 
class  MoodleODSCell
 ODS Cell abstraction. More...
 
class  MoodleODSFormat
 ODS cell format abstraction. More...
 
class  MoodleODSWorkbook
 ODS workbook abstraction. More...
 
class  MoodleODSWorksheet
 ODS Worksheet abstraction. More...
 
class  MoodleODSWriter
 ODS file writer. More...
 
class  mysqli_native_moodle_recordset
 Mysqli specific moodle recordset class. More...
 
class  nasty_strings
 Nasty strings manager. More...
 
class  navbar
 Navbar class. More...
 
class  navigation_cache
 The cache class used by global navigation and settings navigation. More...
 
class  navigation_json
 Simple class used to output a navigation branch in XML. More...
 
class  navigation_node
 This class is used to represent a node in a navigation tree. More...
 
class  navigation_node_collection
 Navigation node collection. More...
 
class  null_filter_manager
 Filter manager subclass that does nothing. More...
 
class  null_progress_trace
 This subclass of progress_trace does not ouput anything. More...
 
class  oauth2_client
 OAuth 2.0 Client for using web access tokens. More...
 
class  page_requirements_manager
 This class tracks all the things that are needed by the current page. More...
 
class  paging_bar
 Component representing a paging bar. More...
 
interface  parentable_part_of_admin_tree
 Interface implemented by any part_of_admin_tree that has children. More...
 
interface  part_of_admin_tree
 CLASS DEFINITIONS /////////////////////////////////////////////////////////. More...
 
class  performance_measuring_filter_manager
 Filter manager subclass that tracks how much work it does. More...
 
class  phpunit_constraint_object_is_equal_with_exceptions
 Constraint that checks a simple object with an isEqual constrain, allowing for exceptions to be made for some fields. More...
 
class  phpunit_coverage_info
 Coverage information for the core subsystem. More...
 
class  phpunit_dataset
 Lightweight dataset class for phpunit, supports XML, CSV and array datasets. More...
 
class  phpunit_event_mock
 Event mock class. More...
 
class  phpunit_event_sink
 Event redirection sink. More...
 
class  phpunit_message_sink
 Message sink. More...
 
class  phpunit_phpmailer_sink
 phpmailer message sink. More...
 
class  phpunit_util
 Collection of utility methods. More...
 
class  pix_emoticon
 Data structure representing an emoticon image. More...
 
class  pix_icon
 Data structure representing an icon. More...
 
class  pix_icon_font
 Data structure representing an icon font. More...
 
class  pix_icon_fontawesome
 Data structure representing an icon subtype. More...
 
class  plugin_defective_exception
 @subpackage upgrade More...
 
class  plugin_incompatible_exception
 Exception thrown when attempting to install a plugin that declares incompatibility with moodle version. More...
 
class  plugin_misplaced_exception
 Misplaced plugin exception. More...
 
class  plugin_renderer_base
 Basis for all plugin renderers. More...
 
class  PNG_MetaDataHandler
 Information on PNG file chunks can be found at http://www.w3.org/TR/PNG/#11Chunks Some other info on PNG that I used http://garethrees.org/2007/11/14/pngcrush/. More...
 
class  popup_action
 Component action for a popup window. More...
 
class  preferences_group
 Represents a group of preferences page link. More...
 
class  preferences_groups
 Represents a set of preferences groups. More...
 
class  progress_bar
 Progress bar class. More...
 
class  progress_trace
 Progress trace class. More...
 
class  progress_trace_buffer
 Special type of trace that can be used for catching of output of other traces. More...
 
class  question_behaviour_type
 This class represents the type of behaviour, rather than the instance of the behaviour which control a particular question attempt. More...
 
class  question_behaviour_type_fallback
 This class exists to allow behaviours that worked in Moodle 2.3 to continue to work. More...
 
interface  renderable
 Interface marking other classes as suitable for renderer_base\render() More...
 
class  renderer_base
 Simple base class for Moodle renderers. More...
 
interface  renderer_factory
 A renderer factory is just responsible for creating an appropriate renderer for any given part of Moodle. More...
 
class  renderer_factory_base
 This is a base class to help you implement the renderer_factory interface. More...
 
class  require_login_exception
 Course/activity access exception. More...
 
class  require_login_session_timeout_exception
 Session timeout exception. More...
 
class  required_capability_exception
 Exceptions indicating user does not have permissions to do something and the execution can not continue. More...
 
class  restore_date_testcase
 Advanced PHPUnit test case customised for testing restore dates in Moodle. More...
 
class  search_lexer
 This class does the heavy lifting of lexing the search string into tokens. More...
 
class  search_parser
 This class takes care of sticking the proper token type/value pairs into the parsed token array. More...
 
class  search_token
 Class to hold token/value pairs after they're parsed. More...
 
class  section_info
 
class  settings_navigation
 Class used to manage the settings option for the current page. More...
 
class  settings_navigation_ajax
 Class used to populate site admin navigation for ajax. More...
 
class  single_button
 Data structure representing a simple form with only one button. More...
 
class  single_select
 Simple form with just one select field that gets submitted automatically. More...
 
class  standard_renderer_factory
 This is the default renderer factory for Moodle. More...
 
class  table_dataformat_export_format
 Dataformat exporter. More...
 
class  table_default_export_format_parent
 
class  table_sql
 
class  tabobject
 Stores one tab. More...
 
class  tabtree
 Stores tabs list. More...
 
interface  templatable
 Interface marking other classes having the ability to export their data for use by templates. More...
 
class  test_lock
 Tests lock to prevent concurrent executions of the same test suite. More...
 
class  testing_block_generator
 Block generator base class. More...
 
class  testing_module_generator
 Module generator base class. More...
 
class  testing_repository_generator
 Repository data generator class. More...
 
class  testing_util
 Utils for test sites creation. More...
 
class  tests_finder
 Finds components and plugins with tests. More...
 
class  text_progress_trace
 This subclass of progress_trace outputs to plain text. More...
 
class  texteditor
 Base abstract text editor class. More...
 
class  theme_config
 This class represents the configuration variables of a Moodle theme. More...
 
class  theme_overridden_renderer_factory
 This is renderer factory allows themes to override the standard renderers using php code. More...
 
class  upgrade_exception
 Exception indicating unknown error during upgrade. More...
 
class  upgrade_requires_exception
 @subpackage upgrade More...
 
class  upload_manager
 This class handles all aspects of fileuploading. More...
 
class  url_select
 Simple URL selection widget description. More...
 
class  user_bulk_action_form
 Bulk user action form. More...
 
class  user_bulk_cohortadd_form
 
class  user_bulk_form
 Bulk user form. More...
 
class  user_picture
 Data structure representing a user picture. More...
 
class  uu_progress_tracker
 Tracking of processed users. More...
 
class  webservice_parameter_exception
 Web service parameter exception class. More...
 
class  WikiToMarkdown
 #- More...
 
class  xhprof_table_sql
 Simple subclass of table_sql that provides some custom formatters for various columns, in order to make the main profiles list nicer. More...
 
class  xhtml_container_stack
 This class keeps track of which HTML tags are currently open. More...
 
class  xml_format_exception
 
class  YUI_config
 This class represents the YUI configuration. More...
 

Functions

 filter_manager::__construct ()
 Constructor.
 
 filterobject::__construct ($phrase, $hreftagbegin='< span class="highlight">', $hreftagend='</span >', $casesensitive=false, $fullmatch=false, $replacementphrase=null, $replacementcallback=null, array $replacementcallbackdata=null)
 Constructor.
 
 moodle_text_filter::__construct ($context, array $localconfig)
 Set any context-specific configuration for this filter.
 
object _fix_course_cats ($children, &$sortorder, $parent, $depth, $path, &$fixcontexts)
 Internal recursive category verification function, do not use directly!
 
 _tidy_question ($question, $category, array $tagobjects=null, array $filtercourses=null)
 Private function to factor common code out of get_question_options().
 
 abort_all_db_transactions ()
 Unconditionally abort all database transactions, this function should be called from exception handlers only.
 
 add_event ()
 CALENDAR MANAGEMENT ////////////////////////////////////////////////////////////////.
 
 add_indented_names ($categories, $nochildrenof=-1)
 Format categories into an indented list reflecting the tree structure.
 
 add_mod_to_section ()
 
moodle_database add_to_config_log ($name, $oldvalue, $value, $plugin)
 Add an entry to the config log table.
 
 add_to_log ()
 
 address_in_subnet ($addr, $subnetstr, $checkallzeros=false)
 Function to check the passed address is within the passed subnet.
 
 addslashes_js ($var)
 Does proper javascript quoting.
 
 admin_apply_default_settings (?part_of_admin_tree $node=null, bool $unconditional=true)
 settings utility functions
 
 admin_critical_warnings_present ()
 Test if and critical warnings are present.
 
moodle_page admin_externalpage_setup ($section, $extrabutton='', array $extraurlparams=null, $actualurl='', array $options=array())
 Initialise admin page - this function does require login and permission checks specified in page definition.
 
 admin_find_write_settings ($node, $data)
 Internal recursive function - finds all settings from submitted form.
 
 admin_get_root ($reload=false, $requirefulltree=true)
 Returns the reference to admin tree root.
 
 admin_mnet_method_get_docblock (ReflectionFunctionAbstract $function)
 Given some sort of reflection function/method object, return an array of docblock lines, where each line is an array of keywords/descriptions.
 
 admin_mnet_method_get_help (ReflectionFunctionAbstract $function)
 Given some sort of reflection function/method object, return just the help text.
 
 admin_mnet_method_profile (ReflectionFunctionAbstract $function)
 Given some sort of reflection function/method object, return a profile array, ready to be serialized and stored.
 
 admin_output_new_settings_by_page ($node)
 Internal function - returns arrays of html pages with uninitialised settings.
 
 admin_search_settings_html ($query)
 Internal function - prints the search results.
 
 admin_write_settings ($formdata)
 Store changed settings, this function updates the errors variable in $ADMIN.
 
 ajax_capture_output ()
 Starts capturing output whilst processing an AJAX request.
 
 ajax_check_captured_output ()
 Check captured output for content.
 
 ajaxenabled ()
 
 allow_assign ()
 
 allow_override ()
 
 allow_switch ()
 
 any_new_admin_settings ($node)
 Based on find_new_settings() in upgradesettings.php Looks to find any admin settings that have not been initialized.
 
 filter_manager::apply_filter_chain ($text, $filterchain, array $options=array(), array $skipfilters=null)
 Apply a list of filters to some content.
 
 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.
 
 badge_assemble_notification (stdClass $badge)
 Creates single message for all notification and sends it out.
 
 badge_award_criteria_competency_has_records_for_competencies ($competencyids)
 Check if any badge has records for competencies.
 
 badge_message_from_template ($message, $params)
 Replaces variables in a message template and returns text ready to be emailed to a user.
 
 badges_add_course_navigation (navigation_node $coursenode, stdClass $course)
 Extends the course administration navigation with the Badges page.
 
 badges_award_handle_manual_criteria_review (stdClass $data)
 Triggered when badge is manually awarded.
 
 badges_bake ($hash, $badgeid, $userid=0, $pathhash=false)
 Bake issued badge.
 
 badges_calculate_message_schedule ($schedule)
 Caclulates date for the next message digest to badge creators.
 
 badges_change_sortorder_backpacks (int $backpackid, int $direction)
 Moves the backpack in the list one position up or down.
 
 badges_check_backpack_accessibility ()
 
 badges_create_site_backpack ($data)
 Create the site backpack with this data.
 
 badges_delete_site_backpack ($id)
 Delete the backpack with this id.
 
 badges_disconnect_user_backpack ($userid)
 Disconnect from the user backpack by deleting the user preferences.
 
 badges_download ($userid)
 Download all user badges in zip archive.
 
 badges_external_create_mapping ($sitebackpackid, $type, $internalid, $externalid)
 Save the info about which objects we connected with a backpack before.
 
 badges_external_delete_mapping ($sitebackpackid, $type, $internalid)
 Delete a specific external mapping information for a backpack.
 
 badges_external_delete_mappings ($sitebackpackid)
 Delete all external mapping information for a backpack.
 
 badges_external_get_mapping ($sitebackpackid, $type, $internalid, $param='externalid')
 Used to remember which objects we connected with a backpack before.
 
 badges_generate_badgr_open_url ($backpack, $type, $externalid)
 Generate a public badgr URL that conforms to OBv2.
 
 badges_get_badge_api_versions ()
 List the supported badges api versions.
 
 badges_get_badge_by_hash (string $hash)
 Get badge by hash.
 
 badges_get_badges ($type, $courseid=0, $sort='', $dir='', $page=0, $perpage=BADGE_PERPAGE, $user=0)
 Get all badges.
 
 badges_get_default_issuer ()
 Get the default issuer for a badge from this site.
 
 badges_get_issued_badge_info ()
 
 badges_get_oauth2_service_options ()
 Get OAuth2 services for the external backpack.
 
 badges_get_site_backpack ($id, int $userid=0)
 Get a site backpacks by id for a particular user or site (if userid is 0)
 
 badges_get_site_backpacks ()
 List the backpacks at site level.
 
 badges_get_site_primary_backpack ()
 Get the primary backpack for the site.
 
 badges_get_user_backpack (?int $userid=0)
 Get the user backpack for the currently logged in user OR the provided user.
 
 badges_get_user_badges ($userid, $courseid=0, $page=0, $perpage=0, $search='', $onlypublic=false)
 Get badges for a specific user.
 
 badges_handle_course_deletion ($courseid)
 Handles what happens to the course badges when a course is deleted.
 
 badges_list_criteria ($enabled=true)
 Return all the enabled criteria types for this site.
 
 badges_local_backpack_js ()
 
 badges_notify_badge_award (badge $badge, $userid, $issued, $filepathhash)
 Sends notifications to users about awarded badges.
 
 badges_open_badges_backpack_api (?int $backpackid=null)
 Is any backpack enabled that supports open badges V1?
 
 badges_prepare_badge_for_external (stdClass $badge, stdClass $user)
 Update badge instance to external functions.
 
 badges_process_badge_image (badge $badge, $iconfile)
 Process badge image from form data.
 
 badges_save_backpack_credentials (stdClass $data)
 Create a backpack with the provided details.
 
 badges_save_external_backpack (stdClass $data)
 Perform the actual create/update of external bakpacks.
 
 badges_send_verification_email ($email, $backpackid, $backpackpassword)
 Create and send a verification email to the email address supplied.
 
 badges_setup_backpack_js ()
 
 badges_update_site_backpack ($id, $data)
 Update the backpack with this id.
 
 badges_user_has_backpack ($userid)
 Checks if user has external backpack connected.
 
 badges_verify_backpack (int $backpackid)
 Attempt to authenticate with a backpack credentials and return an error if the authentication fails.
 
 badges_verify_site_backpack ()
 Attempt to authenticate with the site backpack credentials and return an error if the authentication fails.
 
 behat_check_config_vars ()
 Checks that the behat config vars are properly set.
 
 behat_clean_init_config ()
 Restrict the config.php settings allowed.
 
 behat_error ($errorcode, $text='')
 Exits with an error code.
 
 behat_error_handler ($errno, $errstr, $errfile, $errline)
 PHP errors handler to use when running behat tests.
 
 behat_get_command_flags (string $option, $value)
 Get command flags for an option/value combination.
 
 behat_get_error_string ($errtype)
 Return logical error string.
 
 behat_get_run_process ()
 Get behat run process from either $_SERVER or command config.
 
 behat_get_shutdown_process_errors ()
 Return php errors save which were save during shutdown.
 
 behat_is_requested_url ($url)
 Checks if the URL requested by the user matches the provided argument.
 
 behat_is_test_site ()
 Should we switch to the test site data?
 
 behat_shutdown_function ()
 Before shutdown save last error entries, so we can fail the test.
 
 behat_update_vars_for_process ()
 Fix variables for parallel behat testing.
 
 block_add_block_ui ($page, $output)
 Functions update the blocks if required by the request parameters ==========.
 
 block_instance ($blockname, $instance=NULL, $page=NULL)
 Creates a new instance of the specified block class.
 
 block_instance_by_id ($blockinstanceid)
 Returns a new instance of the specified block instance id.
 
 block_load_class ($blockname)
 Load the block class for a particular type of block.
 
 block_method_result ($blockname, $method, $param=NULL)
 Helper functions for working with block classes ============================.
 
 blocks_add_default_course_blocks ($course)
 Add the default blocks to a course.
 
 blocks_add_default_system_blocks ()
 Add the default system-context blocks.
 
 blocks_delete_all_for_context ($contextid)
 Delete all the blocks that belong to a particular context.
 
 blocks_delete_instance ($instance, $nolongerused=false, $skipblockstables=false)
 Delete a block, and associated data.
 
 blocks_delete_instances ($instanceids)
 Delete multiple blocks at once.
 
 blocks_find_block ($blockid, $blocksarray)
 Find a given block by its blockid within a provide array.
 
 blocks_get_default_site_course_blocks ()
 
 blocks_get_record ($blockid=NULL, $notusedanymore=false)
 Get the block record for a particular blockid - that is, a particular type os block.
 
 blocks_name_allowed_in_format ($name, $pageformat)
 Check that a given name is in a permittable format.
 
 blocks_parse_default_blocks_list ($blocksstr)
 Parse a list of default blocks.
 
 blocks_remove_inappropriate ($course)
 Actually delete from the database any blocks that are currently on this page, but which should not be there according to blocks_name_allowed_in_format.
 
 blocks_set_visibility ($instance, $page, $newvisibility)
 Set a block to be visible or hidden on a particular page.
 
 blog_get_context_url ()
 
 bounded_number ($min, $value, $max)
 Used to make sure that $min <= $value <= $max.
 
 break_up_long_words ($string, $maxsize=20, $cutchar=' ')
 Given some normal text this function will break up any long words to a given size by inserting the given character.
 
 build_context_path ()
 
 build_logs_array ()
 
 build_navigation ()
 
 calculate_entropy (#[\SensitiveParameter] string $pepper)
 Calculate the Shannon entropy of a string.
 
 calculate_user_dst_table ()
 
 calendar_cron ()
 
 calendar_get_all_allowed_types ()
 
 calendar_get_block_upcoming ()
 
 calendar_get_mini ()
 
 calendar_get_upcoming ()
 
 calendar_import_icalendar_events ($ical, $unused=null, $subscriptionid=null)
 Import events from an iCalendar object into a course calendar.
 
 calendar_normalize_tz ()
 
 calendar_preferences_button ()
 
 calendar_print_month_selector ()
 
 calendar_process_subscription_row ($subscriptionid, $pollinterval, $action)
 Update a subscription from the form data in one of the rows in the existing subscriptions table.
 
 calendar_wday_name ()
 
 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.
 
 can_use_html_editor ()
 
 can_use_readonly (int $type, string $sql)
 Check if The query qualifies for readonly connection execution Logging queries are exempt, those are write operations that circumvent standard query_start/query_end paths.
 
 can_use_rotated_text ()
 
 category_delete_full ()
 
 category_delete_move ()
 
 check_admin_dir_usage (environment_results $result)
 Check whether the admin directory has been configured and warn if so.
 
 check_browser_operating_system ()
 
 check_browser_version ()
 
 check_consecutive_identical_characters ($password, $maxchars)
 Check whether the given password has no more than the specified number of consecutive identical characters.
 
 check_database_storage_engine (environment_results $result)
 This function verifies that the database is not using an unsupported storage engine.
 
 check_database_tables_row_format (environment_results $result)
 This function verifies if the database has tables using innoDB Antelope row format.
 
 check_db_prefix_length (environment_results $result)
 This function checks that the database prefix ($CFG->prefix) is <= xmldb_table\PREFIX_MAX_LENGTH.
 
 check_dir_exists ($dir, $create=true, $recursive=true)
 Function to check if a directory exists and by default create it if not exists.
 
 check_gd_version ()
 
 check_igbinary322_version (environment_results $result)
 Check if the igbinary extension installed is buggy one.
 
 check_is_https (environment_results $result)
 Check if the site is being served using an ssl url.
 
 check_libcurl_version (environment_results $result)
 Check if recommended version of libcurl is installed or not.
 
 check_max_input_vars (environment_results $result)
 Environment check for the php setting max_input_vars.
 
 check_mod_assignment (environment_results $result)
 Check whether the mod_assignment is currently being used.
 
 check_moodle_environment ($version, $env_select=ENV_SELECT_NEWER)
 This function checks all the requirements defined in environment.xml.
 
 check_mysql_file_format (environment_results $result)
 This function verfies that the database has tables using InnoDB Antelope row format.
 
 check_mysql_file_per_table (environment_results $result)
 This function verfies that the database has a setting of one file per table.
 
 check_mysql_incomplete_unicode_support (environment_results $result)
 This function checks the database to see if it is using incomplete unicode support.
 
 check_mysql_large_prefix (environment_results $result)
 This function verfies that the database has the setting of large prefix enabled.
 
 check_oracle_usage (environment_results $result)
 Check whether the Oracle database is currently being used and warn if so.
 
 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_sixtyfour_bits (environment_results $result)
 Check if the site is using 64 bits PHP.
 
 check_slasharguments (environment_results $result)
 Method used to check the usage of slasharguments config and display a warning message.
 
 check_tls_libraries (environment_results $result)
 Checks for up-to-date TLS libraries.
 
 check_unoconv_version (environment_results $result)
 Method used to check the installed unoconv version.
 
 check_upgrade_key ($upgradekeyhash)
 Assert the upgrade key is provided, if it is defined.
 
 check_user_preferences_loaded (stdClass $user, $cachelifetime=120)
 Refresh user preference cache.
 
 check_xmlrpc_usage (environment_results $result)
 Check whether the XML-RPC protocol is enabled and warn if so.
 
 choose_from_menu ()
 
 clam_change_log ()
 
 clam_handle_infected_file ()
 
 clam_log_infected ()
 
 clam_log_upload ()
 
 clam_message_admins ()
 
 clam_replace_infected_file ()
 
 clam_scan_moodle_file ()
 
 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!
 
 clean_text ($text, $format=FORMAT_HTML, $options=array())
 Cleans raw text removing nasties.
 
 cleanremoteaddr ($addr, $compress=false)
 Cleans an ip address.
 
 cleanup_contexts ()
 
 cleardoubleslashes ($path)
 Replace 1 or more slashes or backslashes to 1 slash.
 
 cli_error ($text, $errorcode=1)
 Write to standard error output and exit with the given code.
 
 cli_execute_parallel ($cmds, $cwd=null, $delay=0)
 Execute commands in parallel.
 
 cli_get_params (array $longoptions, array $shortmapping=null)
 Returns cli script parameters.
 
 cli_heading ($string, $return=false)
 Print or return section heading string.
 
 cli_input ($prompt, $default='', array $options=null, $casesensitiveoptions=false)
 Get input from user.
 
 cli_logo ($padding=2, $return=false)
 Print an ASCII version of the Moodle logo.
 
 cli_problem ($text)
 Write error notification.
 
 cli_separator ($return=false)
 Print or return section separator string.
 
 cli_set_process_title_suffix (string $suffix)
 This sets the cli process title suffix.
 
 cli_write ($text, $stream=STDOUT)
 Write a text to the given stream.
 
 cli_writeln ($text, $stream=STDOUT)
 Write a text followed by an end of line symbol to the given stream.
 
 close_window ($delay=0, $reloadopener=false)
 Try and close the current window using JavaScript, either immediately, or after a delay.
 
 cohort_get_visible_list ()
 
 commit_delegated_transaction (moodle_transaction $transaction)
 Indicates delegated transaction finished successfully.
 
 complete_user_login ($user, array $extrauserinfo=[])
 Call to complete the user login process after authenticate_user_login() has succeeded.
 
 completion_cron ()
 
 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.
 
 confirm_sesskey ($sesskey=NULL)
 Check the sesskey and return true of false for whether it is valid.
 
 connect ($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dboptions=null)
 Connect to db The connection parameters processor that sets up stage for master write and slave readonly handles.
 
 content_to_text ($content, $contentformat)
 Converts texts or strings to plain text.
 
 context_instance_preload ()
 
 context_instance_preload_sql ()
 
 context_moved ()
 
 convert_tabrows_to_tree ()
 
 convert_to_array ($var)
 Converts an object into an associative array.
 
 convert_tree_to_html ()
 
 core_login_extend_change_password_form ($mform, $user)
 Plugins can extend forms.
 
 core_login_extend_forgot_password_form ($mform)
 Inject form elements into forgot_password_form.
 
 core_login_extend_set_password_form ($mform, $user)
 Inject form elements into set_password_form.
 
 core_login_extend_signup_form ($mform)
 Inject form elements into signup_form.
 
 core_login_generate_password_reset ($user)
 Create a new record in the database to track a new password set request for user.
 
 core_login_get_return_url ()
 Determine where a user should be redirected after they have been logged in.
 
 core_login_post_change_password_requests ($data)
 Plugins can perform post submission actions.
 
 core_login_post_forgot_password_requests ($data)
 Post forgot_password_form submission actions.
 
 core_login_post_set_password_requests ($data, $user)
 Post set_password_form submission actions.
 
 core_login_post_signup_requests ($data)
 Post signup_form submission actions.
 
 core_login_pre_signup_requests ()
 Plugins can create pre sign up requests.
 
 core_login_process_password_reset ($username, $email)
 Process the password reset for the given user (via username or email).
 
 core_login_process_password_reset_request ()
 Processes a user's request to set a new password in the event they forgot the old one.
 
 core_login_process_password_set ($token)
 This function processes a user's submitted token to validate the request to set a new password.
 
 core_login_validate_extend_change_password_form ($data, $user)
 Plugins can add additional validation to forms.
 
 core_login_validate_extend_forgot_password_form ($data)
 Inject validation into forgot_password_form.
 
 core_login_validate_extend_set_password_form ($data, $user)
 Inject validation into set_password_form.
 
 core_login_validate_extend_signup_form ($data)
 Inject validation into signup_form.
 
 core_login_validate_forgot_password_data ($data)
 Validates the forgot password form data.
 
 core_myprofile_navigation (core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course)
 Defines core nodes for my profile navigation tree.
 
 core_question_find_next_unused_idnumber (?string $oldidnumber, int $categoryid)
 If $oldidnumber ends in some digits then return the next available idnumber of the same form.
 
 core_question_question_preview_pluginfile ($previewcontext, $questionid, $filecontext, $filecomponent, $filearea, $args, $forcedownload, $options=[])
 Serve questiontext files in the question text when they are displayed in this report.
 
 core_tables_exist ()
 Checks if the main tables have been installed yet or not.
 
 count_enrolled_users (context $context, $withcapability='', $groupids=0, $onlyactive=false)
 Counts list of users enrolled into course (as per above function)
 
 count_letters ($string, $format=null)
 Count letters in a string.
 
 count_login_failures ()
 
 count_words ($string, $format=null)
 Count words in a string.
 
 course_category_hide ()
 
 course_category_show ()
 
 course_get_cm_rename_action ()
 
 course_scale_used ()
 
 coursemodule_visible_for_user ()
 
 coursetag_delete_course_tags ()
 
 coursetag_delete_keyword ()
 
 coursetag_get_all_tags ()
 
 coursetag_get_jscript ()
 
 coursetag_get_jscript_links ()
 
 coursetag_get_records ()
 
 coursetag_get_tagged_courses ()
 
 coursetag_get_tags ()
 
 coursetag_store_keywords ()
 
 create_contexts ()
 
 create_course_category ()
 
 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.
 
 cron_bc_hack_plugin_functions ()
 
 cron_execute_plugin_type ()
 
 cron_prepare_core_renderer ($restore=false)
 Prepare the output renderer for the cron run.
 
 cron_run (?int $keepalive=null)
 Execute cron tasks.
 
 cron_run_adhoc_tasks (int $timenow, $keepalive=0, $checklimits=true)
 Execute all queued adhoc tasks, applying necessary concurrency limits and time limits.
 
 cron_run_inner_adhoc_task (\core\task\adhoc_task $task)
 Shared code that handles running of a single adhoc task within the cron.
 
 cron_run_inner_scheduled_task (\core\task\task_base $task)
 Shared code that handles running of a single scheduled task within the cron.
 
 cron_run_scheduled_tasks (int $timenow)
 Execute all queued scheduled tasks, applying necessary concurrency limits and time limits.
 
 cron_run_single_task ()
 
 cron_set_process_title (string $title)
 Sets the process title.
 
 cron_setup_user ($user=null, $course=null, $leavepagealone=false)
 Sets up current user and course environment (lang, etc.) in cron.
 
 cron_trace_time_and_memory ()
 Output some standard information during cron runs.
 
 css_is_colour ()
 
 css_is_width ()
 
 css_minify_css ()
 
 css_send_cached_css ($csspath, $etag)
 Sends a cached CSS file.
 
 css_send_cached_css_content ($csscontent, $etag)
 Sends a cached CSS content.
 
 css_send_css_not_found ()
 Sends a 404 message about CSS not being found.
 
 css_send_temporary_css ($css)
 Sends CSS directly and disables all caching.
 
 css_send_uncached_css ($css)
 Sends CSS directly without caching it.
 
 css_send_unmodified ($lastmodified, $etag)
 Send file not modified headers.
 
 css_sort_by_count ()
 
if(!defined( 'THEME_DESIGNER_CACHE_LIFETIME')) css_store_css (theme_config $theme, $csspath, $csscontent)
 Stores CSS in a file at the given path.
 
 css_write_file ($filename, $content)
 Writes a CSS file.
 
 current_language ()
 Returns the code for the current language.
 
 current_theme ()
 
 custom_script_path ()
 Detect a custom script replacement in the data directory that will replace an existing moodle script.
 
 data_submitted ()
 Determine if there is data waiting to be processed from a form.
 
 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.
 
 db_replace ($search, $replace, $additionalskiptables='')
 Moved from admin/replace.php so that we can use this in cron.
 
 db_should_replace ($table, $column='', $additionalskiptables='')
 Given a table and optionally a column name should replaces be done?
 
 debugging ($message='', $level=DEBUG_NORMAL, $backtrace=null)
 Standard Debugging Function.
 
 decompose_update_into_safe_changes (array $newvalues, $unusedvalue)
 Helper used by update_field_with_unique_index().
 
 dedupe_user_access ()
 
 default_error_handler ($errno, $errstr, $errfile, $errline)
 Default error handler, prevents some white screens.
 
 default_exception_handler ($ex)
 Default exception handler.
 
 default_page_type_list ($pagetype, $parentcontext=null, $currentcontext=null)
 Generates a default page type list when a more appropriate callback cannot be decided upon.
 
 delete_context ()
 
 delete_course ($courseorid, $showfeedback=true)
 Delete a course, including all related data from the database, and any associated files.
 
 delete_course_module ()
 
 delete_event ()
 
 delete_question_bank_entry ($entryid)
 Check if there is more versions left for the entry.
 
 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.
 
 detect_munged_arguments ()
 
 display_auth_lock_options ($settings, $auth, $userfields, $helptext, $mapremotefields, $updateremotefields, $customfields=array())
 Helper function used to print locking for auth plugins on admin pages.
 
 display_size ($size, int $decimalplaces=1, string $fixedunits='')
 Converts bytes into display form.
 
 dndupload_add_to_course ($course, $modnames)
 Add the Javascript to enable drag and drop upload to a course page.
 
 download_as_dataformat ($filename, $dataformat, $columns, $iterator, $callback=null)
 Sends a formated data file to the browser.
 
 draw_rand_array ($array, $draws)
 Given an arbitrary array, and a number of draws, this function returns an array with that amount of items.
 
 drop_plugin_tables ($name, $file, $feedback=true)
 Delete all plugin tables.
 
 dst_changes_for_year ()
 
 dst_offset_on ($time, $strtimezone=null)
 Calculates the Daylight Saving Offset for a given date/time (timestamp)
 
 during_initial_install ()
 Indicates whether we are in the middle of the initial Moodle install.
 
 editors_get_available ()
 Get the list of available editors.
 
 editors_get_enabled ()
 Returns list of enabled text editors.
 
 editors_get_preferred_editor ($format=NULL)
 Returns users preferred editor for given format.
 
 editors_get_preferred_format ()
 Returns users preferred text format.
 
 editors_head_setup ()
 Setup all JS and CSS needed for editors.
 
 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.
 
 enable_cli_maintenance_mode ()
 Enables CLI maintenance mode by creating new dataroot/climaintenance.html file.
 
 endecrypt ($pwd, $data, $case)
 Based on a class by Mukul Sabharwal [mukulsabharwal @ yahoo.com].
 
 enrol_accessing_via_instance (stdClass $instance)
 Is current user accessing course via this enrolment method?
 
 enrol_add_course_navigation (navigation_node $coursenode, $course)
 Add navigation nodes.
 
 enrol_calculate_duration ($timestart, $timeend)
 Calculate duration base on start time and end time.
 
 enrol_check_plugins ($user, bool $ignoreintervalcheck=true)
 Check all the login enrolment information for the given user object by querying the enrolment plugins This function may be very slow, use only once after log-in or login-as.
 
 enrol_cohort_can_view_cohort ()
 
 enrol_cohort_enrol_all_users ()
 
 enrol_cohort_get_cohorts ()
 
 enrol_cohort_search_cohorts ()
 
 enrol_course_delete ($course, $userid=null)
 Called when course is about to be deleted.
 
 enrol_course_edit_form (MoodleQuickForm $mform, $data, $context)
 This function adds necessary enrol plugins UI into the course edit form.
 
 enrol_course_edit_validation (array $data, $context)
 Validate course edit form data.
 
 enrol_course_updated ($inserted, $course, $data)
 Update enrol instances after course edit form submission.
 
 enrol_get_all_users_courses ($userid, $onlyactive=false, $fields=null, $sort=null)
 Returns list of courses user is enrolled into without performing any capability checks.
 
 enrol_get_course_by_user_enrolment_id ($ueid)
 Returns the course where a user enrolment belong to.
 
 enrol_get_course_description_texts ($course)
 Returns course enrolment detailed information.
 
 enrol_get_course_info_icons ($course, array $instances=NULL)
 Returns course enrolment information icons.
 
 enrol_get_course_users ($courseid=false, $onlyactive=false, $usersfilter=[], $uefilter=[], $usergroups=[])
 Return all users enrolled in a course.
 
 enrol_get_course_users_roles (int $courseid)
 Returns list of roles per users into course.
 
 enrol_get_courses_sortingsql ($sort=null)
 Returns SQL ORDER arguments which reflect the admin settings to sort my courses.
 
 enrol_get_enrolment_end ($courseid, $userid)
 This function returns the end of current active user enrolment.
 
 enrol_get_instances ($courseid, $enabled)
 Returns enrolment instances in given course.
 
 enrol_get_my_courses ($fields=null, $sort=null, $limit=0, $courseids=[], $allaccessible=false, $offset=0, $excludecourses=[])
 Returns list of courses current $USER is enrolled in and can access.
 
 enrol_get_period_list ()
 Get the list of options for the enrolment period dropdown.
 
 enrol_get_plugin ($name)
 Returns instance of enrol plugin.
 
 enrol_get_plugins ($enabled)
 Returns instances of enrol plugins.
 
moodle_database enrol_get_shared_courses ($user1, $user2, $preloadcontexts=false, $checkexistsonly=false)
 Returns any courses shared by the two users.
 
 enrol_get_users_courses ($userid, $onlyactive=false, $fields=null, $sort=null)
 Returns list of courses user is enrolled into.
 
 enrol_is_enabled ($enrol)
 Checks if a given plugin is in the list of enabled enrolment plugins.
 
 enrol_output_fragment_user_enrolment_form ($args)
 Serve the user enrolment form as a fragment.
 
 enrol_selfenrol_available ($courseid)
 Is there a chance users might self enrol.
 
 enrol_send_welcome_email_options ()
 Send welcome email "from" options.
 
 enrol_sharing_course ($user1, $user2)
 Do these two students share any course?
 
 enrol_try_internal_enrol ($courseid, $userid, $roleid=null, $timestart=0, $timeend=0)
 Try to enrol user via default internal auth plugin.
 
 enrol_user_delete ($user)
 Called when user is about to be deleted.
 
 enrol_user_sees_own_courses ($user=null)
 Can user access at least one enrolled course?
 
object environment_check ($version, $env_select)
 This function will check for everything (DB, PHP and PHP extensions for now) returning an array of environment_result objects.
 
 environment_check_database ($version, $env_select)
 This function will check if database requirements are satisfied.
 
 environment_check_moodle ($version, $env_select)
 This function will check if Moodle requirements are satisfied.
 
 environment_check_pcre_unicode ($version, $env_select)
 Looks for buggy PCRE implementation, we need unicode support in Moodle...
 
 environment_check_php ($version, $env_select)
 This function will check if php requirements are satisfied.
 
 environment_check_php_extensions ($version, $env_select)
 This function will check if php extensions requirements are satisfied.
 
 environment_check_php_settings ($version, $env_select)
 This function will check if php extensions requirements are satisfied.
 
 environment_check_unicode ($version, $env_select)
 This function will check if unicode database requirements are satisfied.
 
 environment_custom_checks ($version, $env_select)
 This function will do the custom checks.
 
 environment_get_errors ($environment_results)
 Returns array of critical errors in plain text format.
 
 environment_verify_plugin ($plugin, $pluginxml)
 Checks if a plugin tag has a name attribute and it matches the plugin being tested.
 
 error ()
 
 events_cleanup ()
 
 events_cron ()
 
 events_dequeue ()
 
 events_dispatch ()
 
 events_get_cached ()
 
 events_get_handlers ()
 
 events_is_registered ()
 
 events_load_def ()
 
 events_pending_count ()
 
 events_process_queued_handler ()
 
 events_queue_handler ()
 
 events_trigger ()
 
 events_trigger_legacy ()
 
 events_uninstall ()
 
 events_update_definition ()
 
 exceeds_password_length (string $password, int $pepperlength=0)
 Validates user's password length.
 
 exists_auth_plugin ($auth)
 Returns whether a given authentication plugin exists.
 
 external_function_info ()
 
 external_update_descriptions ($component)
 Web service discovery function used during install and upgrade.
 
 external_update_services ()
 Allow plugins and subsystems to add external functions to other plugins or built-in services.
 
 extract_draft_file_urls_from_text ($text, $forcehttps=false, $contextid=null, $component=null, $filearea=null, $itemid=null, $filename=null)
 Factory method for extracting draft file links from arbitrary text using regular expressions.
 
 fetch_context_capabilities ()
 
static fill_classmap_renames_cache ()
 Records all class renames that have been made to facilitate autoloading.
 
 moodle_text_filter::filter ($text, array $options=array())
 Override this function to actually implement the filtering.
 
 moodle_text_filter::filter_stage_post_clean (string $text, array $options)
 Filter HTML text at the very end after text is sanitised.
 
 moodle_text_filter::filter_stage_pre_clean (string $text, array $options)
 Filter HTML text before sanitising text.
 
 moodle_text_filter::filter_stage_pre_format (string $text, array $options)
 Filter text before changing format to HTML.
 
 moodle_text_filter::filter_stage_string (string $text, array $options)
 Filter simple text coming from format_string().
 
 filter_manager::filter_string ($string, $context)
 Filter a piece of string.
 
 null_filter_manager::filter_string ($string, $context)
 As for the equivalent filter_manager method.
 
 performance_measuring_filter_manager::filter_string ($string, $context)
 Filter a piece of string.
 
 filter_manager::filter_text ($text, $context, array $options=array(), array $skipfilters=null)
 Filter some text.
 
 filter_text ()
 
 null_filter_manager::filter_text ($text, $context, array $options=array(), array $skipfilters=null)
 As for the equivalent filter_manager method.
 
 performance_measuring_filter_manager::filter_text ($text, $context, array $options=array(), array $skipfilters=null)
 Filter some text.
 
 find_day_in_month ($startday, $weekday, $month, $year)
 Calculates when the day appears in specific month.
 
 fix_align_rtl ($align)
 Returns swapped left<=> right if in RTL environment.
 
object fix_course_sortorder ()
 Fixes course category and course sortorder, also verifies category and course parents and paths.
 
 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.
 
 flatten_category_tree (&$categories, $id, $depth=0, $nochildrenof=-1)
 Private method, only for the use of add_indented_names().
 
 force_current_language ($language)
 Force the current language to get strings and dates localised in the given language.
 
 format_admin_setting ($setting, $title='', $form='', $description='', $label=true, $warning='', $defaultinfo=NULL, $query='')
 Format admin settings.
 
 format_backtrace ($callers, $plaintext=false)
 Formats a backtrace ready for output.
 
 format_float ($float, $decimalpoints=1, $localized=true, $stripzeros=false)
 Given a float, prints it nicely.
 
 format_module_intro ($module, $activity, $cmid, $filter=true)
 Formats activity intro text.
 
 format_string ($string, $striplinks=true, $options=null)
 Given a simple string, this function returns the string processed by enabled string filters if $CFG->filterall is enabled.
 
 format_text ($text, $format=FORMAT_MOODLE, $options=null, $courseiddonotuse=null)
 Given text in a variety of format codings, this function returns the text as safe HTML.
 
 format_text_email ($text, $format)
 Given text in a variety of format codings, this function returns the text as plain text suitable for plain email.
 
 format_text_menu ()
 Just returns an array of text formats suitable for a popup menu.
 
 format_time ($totalsecs, $str=null)
 Format a date/time (seconds) as weeks, days, hours etc as needed.
 
 format_weeks_get_section_dates ()
 
 formerr ()
 
 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_email_supportuser ()
 
 generate_image_thumbnail ($filepath, $width, $height)
 Generates a thumbnail for the given image.
 
 generate_image_thumbnail_from_image ($original, $imageinfo, $width, $height)
 Generates a thumbnail for the given image string.
 
 generate_image_thumbnail_from_string ($filedata, $width, $height)
 Generates a thumbnail for the given image string.
 
 generate_page_type_patterns ($pagetype, $parentcontext=null, $currentcontext=null)
 Given a specific page type, parent context and currect context, return all the page type patterns that might be used by this block.
 
 generate_password ($maxlen=10)
 Returns a randomly generated password of length $maxlen.
 
 generate_uuid ()
 
 get_accesshide ($text, $elem='span', $class='', $attrs='')
 Return a HTML element with the class "accesshide", for accessibility.
 
 get_admin ()
 Returns $user object of the main admin user.
 
 get_admins ()
 Returns list of all admins, using 1 DB query.
 
static get_all_component_hash (?array $components=null)
 Returns hash of all core + plugin /db/ directories.
 
static get_all_directory_hashes (?array $directories=null)
 Get the hashes of all core + plugin /db/ directories.
 
 get_all_instances_in_course ($modulename, $course, $userid=NULL, $includeinvisible=false)
 Returns an array of all the active instances of a particular module in a given course, sorted in the order they are defined.
 
object get_all_instances_in_courses ($modulename, $courses, $userid=NULL, $includeinvisible=false)
 Returns an array of all the active instances of a particular module in given courses, sorted in the order they are defined.
 
 get_all_mods ()
 
 get_all_sections ()
 
 get_all_subcategories ()
 
 get_all_user_name_fields ()
 
static get_all_versions ()
 Returns hash of all versions including core and all plugins.
 
static get_all_versions_hash ()
 Returns hash of all versions including core and all plugins.
 
 get_array_of_activities (int $courseid, bool $usecache=false)
 For a given course, returns an array of course activity objects Each item in the array contains he following properties:
 
 get_auth_plugin ($auth)
 Returns an authentication plugin instance.
 
 get_backpack_settings ($userid, $refresh=false)
 Returns external backpack settings and badges from this backpack.
 
 get_backup_temp_directory ($directory)
 Get the full path of a directory under $CFG->backuptempdir.
 
 get_browser_version_classes ()
 
 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_categories ()
 
 get_categories_for_contexts ($contexts, $sortorder='parent, sortorder, name ASC', $top=false)
 Get all the category objects, including a count of the number of questions in that category, for all the categories in the lists $contexts.
 
 get_category_courses_array ()
 
 get_category_courses_array_recursively ()
 
 get_child_categories ()
 
 get_child_contexts ()
 
 get_clam_error_code ()
 
 get_complete_user_data ($field, $value, $mnethostid=null, $throwexception=false)
 Get a complete user record, which includes all the info in the user record.
 
static get_component_classes_in_namespace ($component=null, $namespace='')
 Returns all classes in a component matching the provided namespace.
 
static get_component_directory ($component)
 Return exact absolute path to a plugin directory.
 
static get_component_list ()
 Returns a list of frankenstyle component names and their paths, for all components (plugins and subsystems).
 
static get_component_names ()
 Returns a list of frankenstyle component names.
 
 get_component_version ($component, $source='installed')
 Returns the version of installed component.
 
 get_config ($plugin, $name=null)
 Get configuration values from the global config table or the config_plugins table.
 
 get_context_instance ($contextlevel, $instance=0, $strictness=IGNORE_MISSING)
 Get the context instance as an object.
 
 get_context_instance_by_id ()
 
 get_context_url ()
 
 get_contextlevel_name ()
 
static get_core_api_names ()
 Returns the list of available API names.
 
static get_core_apis ()
 List all core APIs and their attributes.
 
 get_core_subsystems ($fullpaths=false)
 List all core subsystems and their location.
 
static get_core_subsystems ()
 List all core subsystems and their location.
 
 get_course ($courseid, $clone=true)
 Gets a course object from database.
 
 get_course_and_cm_from_cmid ($cmorid, $modulename='', $courseorid=0, $userid=0)
 Efficiently retrieves the $course (stdclass) and $cm (cm_info) objects, given a cmid.
 
 get_course_and_cm_from_instance ($instanceorid, $modulename, $courseorid=0, $userid=0)
 Efficiently retrieves the $course (stdclass) and $cm (cm_info) objects, given an instance id or record and module name.
 
 get_course_category ()
 
 get_course_category_tree ()
 
 get_course_context ()
 
 get_course_display_name_for_list ($course)
 Gets the name of a course to be displayed when showing a list of courses.
 
object get_course_mods ($courseid)
 MODULE FUNCTIONS /////////////////////////////////////////////////.
 
 get_course_participants ()
 
 get_course_section ()
 
 get_courseid_from_context ()
 
object get_coursemodule_from_id ($modulename, $cmid, $courseid=0, $sectionnum=false, $strictness=IGNORE_MISSING)
 Given an id of a course module, finds the coursemodule description.
 
object get_coursemodule_from_instance ($modulename, $instance, $courseid=0, $sectionnum=false, $strictness=IGNORE_MISSING)
 Given an instance number of a module, finds the coursemodule description.
 
 get_coursemodules_in_course ($modulename, $courseid, $extrafields='')
 Returns all course modules of given activity in course.
 
 core_course_category::get_courses ($options=array())
 Retrieves the list of courses accessible by user.
 
object get_courses ($categoryid="all", $sort="c.sortorder ASC", $fields="c.*")
 Returns list of courses, for whole site, or category.
 
 get_courses_page ()
 
object get_courses_search ($searchterms, $sort, $page, $recordsperpage, &$totalcount, $requiredcapabilities=array(), $searchcond=[], $params=[])
 A list of courses that match a search.
 
 get_courses_wmanagers ()
 
 get_current_group ()
 
 get_db_directories ()
 Returns list of all directories where we expect install.xml files.
 
 get_db_handle ()
 Gets db handle currently used with queries.
 
 get_default_home_page ()
 Returns the default home page to display if current one is not defined or can't be applied.
 
 get_device_cfg_var_name ()
 
 get_device_type ()
 
 get_device_type_list ()
 
 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_docs_url ($path=null)
 Returns the Moodle Docs URL in the users language for a given 'More help' link.
 
 get_emoticon_manager ()
 Factory function for emoticon_manager.
 
 get_enabled_auth_plugins ($fix=false)
 Returns array of active auth plugins.
 
 get_enrolled_join (context $context, $useridcolumn, $onlyactive=false, $onlysuspended=false, $enrolid=0)
 Returns array with sql joins and parameters returning all ids of users enrolled into course.
 
 get_enrolled_sql (context $context, $withcapability='', $groupids=0, $onlyactive=false, $onlysuspended=false, $enrolid=0)
 Returns array with sql code and parameters returning all ids of users enrolled into course.
 
 get_enrolled_users (context $context, $withcapability='', $groupids=0, $userfields='u.*', $orderby=null, $limitfrom=0, $limitnum=0, $onlyactive=false)
 Returns list of users enrolled into course.
 
 get_enrolled_with_capabilities_join (context $context, $prefix='', $capability='', $groupids=0, $onlyactive=false, $onlysuspended=false, $enrolid=0)
 Returns an array of joins, wheres and params that will limit the group of users to only those enrolled and with given capability (if specified).
 
 get_environment_for_version ($version, $env_select)
 This function will return the xmlized data belonging to one Moodle version.
 
 get_exception_info ($ex)
 Returns detailed information about specified exception.
 
 get_extra_user_fields ()
 
 get_extra_user_fields_sql ()
 
 get_fast_modinfo ($courseorid, $userid=0, $resetonly=false)
 Returns reference to full info about modules in course (including visibility).
 
 get_file_argument ()
 Extracts file argument either from file parameter or PATH_INFO.
 
 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_file_url ()
 
 get_formatted_help_string ($identifier, $component, $ajax=false, $a=null)
 Get the value of a help string fully prepared for display in the current language.
 
 get_generic_section_name ()
 
 get_google_client ()
 Wrapper to get a Google Client object.
 
 get_group_picture_url ($group, $courseid, $large=false, $includetoken=false)
 Return the url to the group picture.
 
 get_home_page ()
 Gets the homepage to use for the current user.
 
 get_host_from_url ($url)
 Returns host part from url.
 
 get_html_lang ($dir=false)
 Return a string containing 'lang', xml:lang and optionally 'dir' HTML attributes.
 
 get_html_lang_attribute_value (string $langcode)
 Converts a language code to hyphen-separated format in accordance to the BCP47 syntax.
 
 get_import_export_formats ($type)
 Get list of available import or export formats.
 
 get_last_soap_messages ($connection)
 
 get_latest_version_available ($version, $env_select)
 This function will return the most recent version in the environment.xml file previous or equal to the version requested.
 
 get_level ($element)
 Here all the restrict functions are coded to be used by the environment checker.
 
 get_list_of_charsets ()
 Returns a list of charset codes.
 
 get_list_of_environment_versions ($contents)
 This function will return the list of Moodle versions available.
 
 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_list_of_timezones ()
 
 get_local_referer ($stripquery=true)
 Returns the cleaned local URL of the HTTP_REFERER less the URL query string parameters if required.
 
 get_log_manager ($forcereload=false)
 LOG FUNCTIONS /////////////////////////////////////////////////////.
 
 get_login_url ()
 Returns full login url.
 
 get_logs ()
 
 get_logs_usercourse ()
 
 get_logs_userday ()
 
 get_mailer ($action='get')
 Get mailer instance, enable buffering, flush buffer or disable buffering.
 
 get_max_courses_in_category ()
 Return maximum number of courses in a category.
 
 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_module_metadata ()
 
 get_moodle_cookie ()
 Gets a moodle cookie with a weakly encrypted username.
 
object get_my_remotecourses ($userid=0)
 List of remote courses that a user has access to via MNET.
 
object get_my_remotehosts ()
 List of remote hosts that a user has access to via MNET.
 
 get_newuser_language ()
 Returns the string of the language for the new user.
 
 get_next_version (int $questionbankentryid)
 Get the next version number to create base on a Question bank entry id.
 
static core\event::get_other_mapping ()
 Used for maping events on restore.
 
 get_parent_contextid ()
 
 get_parent_contexts ()
 
 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.
 
 performance_measuring_filter_manager::get_performance_summary ()
 Return performance information, in the form required by get_performance_info().
 
static get_plugin_directory ($plugintype, $pluginname)
 Returns the exact absolute path to plugin directory.
 
static get_plugin_list ($plugintype)
 Get list of plugins of given type.
 
static get_plugin_list_with_class ($plugintype, $class, $file=null)
 Get a list of all the plugins of a given type that define a certain class in a certain file.
 
static get_plugin_list_with_file ($plugintype, $file, $include=false)
 Get a list of all the plugins of a given type that contain a particular file.
 
 get_plugin_list_with_file ()
 
 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_plugin_types ($fullpaths=true)
 Lists all plugin types.
 
static get_plugin_types ()
 Get list of available plugin types together with their location.
 
static get_plugin_types_with_subplugins ()
 Returns list of plugin types that allow subplugins.
 
 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_print_section_cm_text ()
 
 get_question_bank_entry (int $questionid)
 Get the question_bank_entry object given a question id.
 
 get_question_options (&$questions, $loadtags=false, $filtercourses=null)
 Updates the question objects with question type specific information by calling {.
 
 get_question_version ($questionid)
 Get the question versions given a question id in a descending sort .
 
 get_real_size ($size=0)
 Converts numbers like 10M into bytes.
 
 get_recent_enrolments ()
 
 get_records_csv ()
 
 get_referer ()
 
 get_related_contexts_string ()
 
 get_request_storage_directory ($exceptiononerror=true, bool $forcecreate=false)
 Get a per-request storage directory in the tempdir.
 
 get_role_context_caps ()
 
 get_roles_on_exact_context ()
 
 get_roles_with_assignment_on_context ()
 
 get_safe_orderby (array $orderbymap, string $orderbykey, string $direction='', bool $useprefix=true)
 Prepare a safe ORDER BY statement from user interactable requests.
 
 get_safe_orderby_multiple (array $orderbymap, array $orderbykeys, array $directions=[])
 Prepare a safe ORDER BY statement from user interactable requests using multiple values.
 
object get_scales_menu ($courseid=0)
 Returns a menu of all available scales from the site as well as the given course.
 
 get_selected_theme_for_device_type ()
 
 get_separator ()
 Return the breadcrumb trail navigation separator.
 
 get_site ()
 OTHER SITE AND COURSE FUNCTIONS /////////////////////////////////////////////.
 
 get_site_identifier ()
 Returns the site identifier.
 
 get_string ($identifier, $component='', $a=null, $lazyload=false)
 Returns a localized string.
 
 filter_manager::get_string_filters ($context)
 Get all the filters that apply to a given context for calls to format_string.
 
 get_string_manager ($forcereload=false)
 Returns current string_manager instance.
 
 get_strings ($array, $component='')
 Converts an array of strings to their localized value.
 
static get_subplugins ($component)
 Return all subplugins of this component.
 
static get_subsystem_directory ($subsystem)
 Returns the exact absolute path to plugin directory.
 
static get_subtype_parent ($type)
 Returns parent of this subplugin type.
 
 get_system_context ($cache=true)
 Returns system context or null if can not be created yet.
 
 filter_manager::get_text_filters ($context)
 Get all the filters that apply to a given context for calls to format_text.
 
 get_texteditor ($editorname)
 Returns instance of text editor.
 
 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_timezone_offset ()
 
 get_timezone_record ()
 
 core\task::get_trace ()
 Get the progress_trace.
 
 get_used_table_names ()
 Returns names of all known tables == tables that moodle knows about.
 
 get_user_access_sitewide ()
 
 get_user_courses_bycap ()
 
 get_user_device_type ()
 
 get_user_field_name ()
 
 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_user_timezone_offset ()
 
object get_users ($get=true, $search='', $confirmed=false, array $exceptions=null, $sort='firstname ASC', $firstinitial='', $lastinitial='', $page='', $recordsperpage='', $fields=' *', $extraselect='', array $extraparams=null)
 Returns a subset of users.
 
object get_users_confirmed ()
 Full list of users that have confirmed their accounts.
 
 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.
 
 get_users_listing ($sort='lastaccess', $dir='ASC', $page=0, $recordsperpage=0, $search='', $firstinitial='', $lastinitial='', $extraselect='', array $extraparams=null, $extracontext=null)
 Return filtered (if provided) list of users in site, except guest and deleted users.
 
 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 ...
 
 grade_print_tabs ($active_type, $active_plugin, $plugin_info, $return=false)
 Print grading plugin selection tab-based navigation.
 
 groupmode ()
 This means that cm_info\$groupmode should be ignored and cm_info\$coursegroupmode be used instead.
 
 groups_course_module_visible ()
 
 groups_filter_users_by_course_module_visible ()
 
 groups_get_all_groups_for_courses ()
 
 guest_user ()
 Retrieve the guest user object.
 
 handle_soap_wsdl_request ($wsdlfile, $address=false)
 
static has_monologo_icon (string $plugintype, string $pluginname)
 Checks for the presence of monologo icons within a plugin.
 
 moodle_text_filter::hash ()
 
 hash_internal_user_password (#[\SensitiveParameter] string $password, $fasthash=false, $pepperlength=0)
 Calculate hash for a plain text password.
 
 hash_local_config_cache ()
 Calculate a proper hash to be able to invalidate stale cached configs.
 
 hide_event ()
 
 highlight ($needle, $haystack, $matchcase=false, $prefix='< span class="highlight">', $suffix='</span >')
 This function will highlight search words in a given string.
 
 highlightfast ($needle, $haystack)
 This function will highlight instances of $needle in $haystack.
 
 html_is_blank ($string)
 Tests whether anything was returned by text editor.
 
 html_to_text ($html, $width=75, $dolinks=true)
 Given HTML text, make it into plain text using external function.
 
 httpsrequired ()
 
 idnumber_exist_in_question_category ($questionidnumber, $categoryid, $limitfrom=0, $limitnum=1)
 Check if an idnumber exist in the category.
 
 imagecopybicubic ($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h)
 Copies a rectangular portion of the source image to another rectangle in the destination image.
 
 in_object_vars ($var, $object)
 Checks whether the given variable name is defined as a variable within the given object.
 
 increment_revision_number ($table, $field, $select, array $params=null)
 Increment standard revision field.
 
 ini_get_bool ($ini_get_arg)
 This function makes the return value of ini_get consistent if you are setting server directives through the .htaccess file in apache.
 
 init_performance_info ()
 Initializes our performance info early.
 
 initialise_fullme ()
 Initialises $FULLME and friends.
 
 initialise_fullme_cli ()
 Initialises $FULLME and friends for command line scripts.
 
 initialise_local_config_cache ()
 Cache any immutable config locally to avoid constant DB lookups.
 
 install_cli_database (array $options, $interactive)
 Install Moodle DB, config.php must exist, there must not be any tables in db yet.
 
 install_core ($version, $verbose)
 Install core moodle tables and initialize.
 
 install_db_validate ($database, $dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions)
 This is in function because we want the /install.php to parse in PHP4.
 
 install_generate_configphp ($database, $cfg)
 Returns content of config.php file.
 
 install_guess_wwwroot ()
 Tries to detect the right www root setting.
 
 install_helpbutton ($url, $title='')
 Print help button.
 
 install_ini_get_bool ($ini_get_arg)
 Copy of.
 
 install_init_dataroot ($dataroot, $dirpermissions)
 Creates dataroot if not exists yet, makes sure it is writable, add lang directory and add .htaccess just in case it works.
 
object install_print_footer ($config, $reload=false)
 Prints installation page header, we can not use weblib yet in installer.
 
object install_print_header ($config, $stagename, $heading, $stagetext, $stageclass="alert-info")
 Prints installation page header, we can not use weblib yet in installer.
 
object install_print_help_page ($help)
 Prints complete help page used during installation.
 
static filter_manager::instance ()
 Factory method.
 
object instance_is_visible ($moduletype, $module)
 Determine whether a module instance is visible within a course.
 
static invalidate_opcode_php_cache ($file)
 Invalidate opcode cache for given file, this is intended for php files that are stored in dataroot.
 
 ip_is_public ($ip)
 Is IP address a public address?
 
 iplookup_find_location ($ip)
 Returns location information.
 
static is_core_api ($apiname)
 Return true if apiname is a core API.
 
static is_core_subsystem ($subsystemname)
 Return true if subsystemname is core subsystem.
 
 is_course_participant ()
 
 is_dataroot_insecure ($fetchtest=false)
 Try to verify that dataroot is not accessible from web.
 
 is_early_init ($backtrace)
 This function encapsulates the tests for whether an exception was thrown in early init – either during setup.php or during init of $OUTPUT.
 
 is_enabled_auth ($auth)
 Checks if a given plugin is in the list of enabled authentication plugins.
 
 is_enrolled (context $context, $user=null, $withcapability='', $onlyactive=false)
 Returns true if user is enrolled (is participating) in course this is intended for students and teachers.
 
 is_float_problem ()
 Detects if float supports at least 10 decimal digits.
 
 is_https ()
 Determines whether or not the Moodle site is being served over HTTPS.
 
 is_in_popup ()
 Returns true if the page is displayed in a popup window.
 
 is_internal_auth ($auth)
 Returns true if an internal authentication method is being used.
 
 is_latest (string $version, string $questionbankentryid)
 Checks if question is the latest version.
 
 is_major_upgrade_required ()
 Check whether a major upgrade is needed.
 
 is_mnet_remote_user ($user)
 Returns whether or not the user object is a remote MNET user.
 
 is_moodle_cookie_secure ()
 Determine wether the secure flag should be set on cookies.
 
 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.
 
static is_valid_plugin_name ($plugintype, $pluginname)
 This method validates a plug name.
 
 is_web_crawler ()
 
 ismoving ($courseid)
 Determines if the logged in user is currently moving an activity.
 
 core\hook::isPropagationStopped ()
 Is propagation stopped?
 
 js_minify ()
 
 js_reset_all_caches ()
 Invalidate all server and client side JS caches.
 
 ldap_addslashes ($text)
 Quote control characters in AttributeValue parts of a RelativeDistinguishedName used in LDAP distinguished names - See RFC 4514/2253.
 
 ldap_connect_moodle ($host_url, $ldap_version, $user_type, $bind_dn, $bind_pw, $opt_deref, &$debuginfo, $start_tls=false)
 Tries connect to specified ldap servers.
 
 ldap_filter_addslashes ($text)
 Quote control characters in texts used in LDAP filters - see RFC 4515/2254.
 
 ldap_find_userdn ($ldapconnection, $username, $contexts, $objectclass, $search_attrib, $search_sub)
 Search specified contexts for username and return the user dn like: cn=username,ou=suborg,o=org.
 
if(!defined('LDAP_DN_SPECIAL_CHARS')) if(!defined( 'LDAP_DN_SPECIAL_CHARS_QUOTED_NUM')) if(!defined('LDAP_DN_SPECIAL_CHARS_QUOTED_ALPHA')) if(!defined( 'LDAP_DN_SPECIAL_CHARS_QUOTED_ALPHA_REGEX')) ldap_get_dn_special_chars ()
 The order of the special characters in these arrays IS IMPORTANT.
 
 ldap_get_entries_moodle ($ldapconnection, $searchresult)
 Returns values like ldap_get_entries but is binary compatible and returns all attributes as array.
 
 ldap_getdefaults ()
 Initializes needed variables for ldap-module.
 
 ldap_isgroupmember ($ldapconnection, $userid, $group_dns, $member_attrib)
 Checks if user belongs to specific group(s) or is in a subtree.
 
 ldap_normalise_objectclass ($objectclass, $default=' *')
 Normalise the supplied objectclass filter.
 
 ldap_paged_results_supported ($ldapversion, $ldapconnection=null)
 Check if we can use paged results (see RFC 2696).
 
 ldap_stripslashes ($text)
 Unquote control characters in AttributeValue parts of a RelativeDistinguishedName used in LDAP distinguished names - See RFC 4514/2253.
 
if(!defined( 'ROOTDSE')) if(!defined('LDAP_PAGED_RESULTS_CONTROL')) if(!defined( 'LDAP_DEFAULT_PAGESIZE')) ldap_supported_usertypes ()
 Returns predefined user types.
 
 link_arrow_left ($text, $url='', $accesshide=false, $addclass='', $addparams=[])
 Return the left arrow with text ('previous'), and optionally embedded in a link.
 
 link_arrow_right ($text, $url='', $accesshide=false, $addclass='', $addparams=[])
 Return the right arrow with text ('next'), and optionally embedded in a link.
 
 load_course_context ()
 
 load_environment_xml ($env_select=ENV_SELECT_NEWER)
 This function will load the environment.xml file and xmlize it.
 
 filter_manager::load_filters ($context)
 Load all the filters required by this context.
 
static load_renamed_classes (?string $fulldir)
 Loads the db/renamedclasses.php file from the given directory.
 
 load_role_access_by_context ()
 
 core\task::log ($message, $depth=1)
 Log a message to the progress tracer.
 
 core\task::log_finish ($message, $depth=0)
 Log an end message to the progress tracer.
 
 core\task::log_start ($message, $depth=0)
 Log a start message to the progress tracer.
 
 log_update_descriptions ($component)
 Log_display description function used during install and upgrade.
 
 login_attempt_failed ($user)
 To be called after failed user login.
 
 login_attempt_valid ($user)
 To be called after valid user login.
 
 login_captcha_enabled ()
 Returns whether the captcha element is enabled for the login form, and the admin settings fulfil its requirements.
 
 login_is_lockedout ($user)
 Verify if user is locked out.
 
 login_lock_account ($user)
 Lockout user and send notification email.
 
 login_unlock_account ($user, bool $notify=false)
 Unlock user account and reset timers.
 
 make_backup_temp_directory ($directory, $exceptiononerror=true)
 Create a directory under $CFG->backuptempdir and make sure it is writable.
 
 make_cache_directory ($directory, $exceptiononerror=true)
 Create a directory under cachedir and make sure it is writable.
 
 make_categories_list ()
 
 make_categories_options ()
 
 make_editing_buttons ()
 
 filter_manager::make_filter_object ($filtername, $context, $localconfig)
 Factory method for creating a filter.
 
 performance_measuring_filter_manager::make_filter_object ($filtername, $context, $localconfig)
 Factory method for creating a filter.
 
 make_grades_menu ($gradingtype)
 Creates an array that represents all the current grades that can be chosen using the given grading type.
 
 make_localcache_directory ($directory, $exceptiononerror=true)
 Create a directory under localcachedir and make sure it is writable.
 
 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_request_directory (bool $exceptiononerror=true, bool $forcecreate=false)
 Create a per-request directory and make sure it is writable.
 
 make_soap_fault ($faultcode, $faultstring, $faultactor='', $detail='', $faultname='', $headerfault='')
 
 make_temp_directory ($directory, $exceptiononerror=true)
 Create a directory under tempdir and make sure it is writable.
 
 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
 
 make_unique_writable_directory ($basedir, $exceptiononerror=true)
 Create a new unique directory within the specified directory.
 
 make_upload_directory ($directory, $exceptiononerror=true)
 Create a directory under dataroot and make sure it is writable.
 
 mark_context_dirty ()
 
 markdown_to_html ($text)
 Given Markdown formatted text, make it into XHTML using external function.
 
 match_grade_options ($gradeoptionsfull, $grade, $matchgrades='error')
 Check whether a given grade is one of a list of allowed options.
 
 matching_page_type_patterns ($pagetype)
 Given a specific page type, return all the page type patterns that might match it.
 
 matching_page_type_patterns_from_pattern ($pattern)
 Give an specific pattern, return all the page type patterns that would also match it.
 
 Html2Text::mb_internal_encoding ($encoding=null)
 Set the encoding to be used by our monkey patched mb_ functions.
 
 Html2Text::mb_strlen ($str, $encoding=null)
 Gets the length of a string.
 
 Html2Text::mb_strtolower ($str, $encoding=null)
 Returns $str with all alphabetic chatacters converted to lowercase.
 
 Html2Text::mb_strtoupper ($str, $encoding=null)
 
 Html2Text::mb_substr ($str, $start, $length=null, $encoding=null)
 Performs a multi-byte safe substr() operation based on number of characters.
 
 mdie ($msg='', $errorcode=1)
 Print an error to STDOUT and exit with a non-zero code.
 
 me ()
 Returns the name of the current script, WITH the querystring portion.
 
 merge_query_params (array &$target, array $values)
 Merge parsed POST chunks.
 
 message_add_contact ()
 
 message_block_contact ()
 
 message_can_delete_message ()
 
 message_can_post_message ()
 
 message_contact_link ()
 
 message_count_blocked_users ()
 
 message_count_messages ()
 
 message_count_unread_messages ()
 
 message_current_user_is_involved ()
 
 message_delete_message ()
 
 message_get_blocked_users ()
 
 message_get_contact ()
 
 message_get_contact_add_remove_link ()
 
 message_get_contact_block_link ()
 
 message_get_contacts ()
 
 message_get_course_contexts ()
 
 message_get_fragment ()
 
 message_get_history ()
 
 message_get_recent_conversations ($userorid, $limitfrom=0, $limitto=100)
 
 message_get_recent_notifications ()
 
 message_history_link ()
 
 message_is_user_blocked ()
 
 message_is_user_non_contact_blocked ()
 
 message_mark_message_read ()
 
 message_mark_messages_read ()
 
 message_move_userfrom_unread2read ()
 
 message_remove_contact ()
 
 message_remove_url_params ()
 
 message_search ()
 
 message_shorten_message ()
 
 message_unblock_contact ()
 
 microtime_diff ($a, $b)
 Calculate the difference between two microtimes.
 
 min_clean_param ($value, $type)
 Minimalistic parameter cleaning function.
 
 min_enable_zlib_compression ()
 This method tries to enable output compression if possible.
 
 min_fix_utf8 ($value)
 Minimalistic UTF-8 sanitisation.
 
 min_get_maximum_revision ()
 Get the highest possible currently valid revision number.
 
 min_get_minimum_revision ()
 Get the lowest possible currently valid revision number.
 
 min_get_slash_argument ($clean=true)
 Returns the slashargument part of the URL.
 
 min_is_revision_valid_and_current (int $revision)
 Helper function to determine if the given revision number is valid.
 
 min_optional_param ($name, $default, $type)
 Minimalistic parameter validation function.
 
 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
 
 mod_page_type_list ($pagetype, $parentcontext=null, $currentcontext=null)
 Generates the page type list for a module by either locating and using the modules callback or by generating a default list.
 
 moodle_getlocale ()
 Gets the system locale.
 
 moodle_major_version ($fromdisk=false)
 Returns the major version of this site.
 
 moodle_minimum_php_version_is_met ($haltexecution=false)
 Tests the current PHP version against Moodle's minimum requirement.
 
 moodle_needs_upgrading ($checkupgradeflag=true)
 Determine if moodle installation requires update.
 
 moodle_process_email ($modargs, $body)
 ?
 
 moodle_require_minimum_php_version ()
 Require our minimum php version or halt execution if requirement not met.
 
 moodle_setlocale ($locale='')
 Sets the system locale.
 
 move_category ()
 
 move_question_set_references (int $oldcategoryid, int $newcatgoryid, int $oldcontextid, int $newcontextid, bool $delete=false)
 Update the questioncontextid field for all question_set_references records given a new context id.
 
 mtrace ($string, $eol="\n", $sleep=0)
 For outputting debugging info.
 
 mtrace_exception (Throwable $e)
 Helper to {.
 
 my_page_type_list ($pagetype, $parentcontext=null, $currentcontext=null)
 Generates the page type list for the my moodle page.
 
 mygroupid ()
 
 navmenu ()
 
 navmenulist ($course, $sections, $modinfo, $strsection, $strjumpto, $width=50, $cmid=0)
 Returns a popup menu with course activity modules.
 
static normalize_component ($component)
 Normalize the component name using the "frankenstyle" rules.
 
static normalize_componentname ($componentname)
 Normalize the component name.
 
 normalize_version ($version)
 This function will normalize any version to just a serie of numbers separated by dots.
 
 notice ($message, $link='', $course=null)
 Print a message and exit.
 
 notify ()
 
 obfuscate_email ($email)
 Given an email address, this function will return an obfuscated version of it.
 
 obfuscate_mailto ($email, $label='', $dimmed=false, $subject='', $body='')
 This function uses the obfuscate_email() and obfuscate_text() to generate a fully obfuscated email link, ready to use.
 
 obfuscate_text ($plaintext)
 This function takes some text and replaces about half of the characters with HTML entity equivalents.
 
 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.
 
 p ($var)
 Add quotes to HTML characters.
 
 page_doc_link ($text='')
 Returns a string containing a link to the user documentation for the current page.
 
 page_get_doc_link_path (moodle_page $page)
 Returns the path to use when constructing a link to the docs.
 
 partial ()
 Helper function to do partial function binding.
 
 password_compat_not_supported ()
 
 password_is_legacy_hash (#[\SensitiveParameter] string $password)
 Check a password hash to see if it was hashed using the legacy hash algorithm (bcrypt).
 
 perf_get_reads_slave ()
 Returns the number of reads done by the read only database.
 
 phpunit_bootstrap_error ($errorcode, $text='')
 Print error and stop execution.
 
 plagiarism_get_file_results ($cmid, $userid, $file)
 returns array of plagiarism details about specified file
 
 plagiarism_get_form_elements_module ()
 
if(!defined( 'MOODLE_INTERNAL')) plagiarism_get_links ($linkarray)
 displays the similarity score and provides a link to the full report if allowed.
 
 plagiarism_load_available_plugins ()
 Helper function - also loads lib file of plagiarism plugin.
 
 plagiarism_print_disclosure ($cmid)
 Function that prints the student disclosure notifying that the files will be checked for plagiarism.
 
 plagiarism_save_form_elements ()
 
 plagiarism_update_status ($course, $cm)
 Allows a plagiarism plugin to print a button/link at the top of activity overview report pages.
 
 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.
 
 preload_course_contexts ()
 
 prevent_form_autofill_password ()
 
object print_arrow ($direction='up', $strsort=null, $return=false)
 Returns an image of an up or down arrow, used for column sorting.
 
 print_badge_image (badge $badge, stdClass $context, $size='small')
 Print badge image.
 
 print_category_info ()
 
 print_checkbox ()
 
 print_collapsible_region ($contents, $classes, $id, $caption, $userpref='', $default=false, $return=false)
 Print (or return) a collapsible region, that has a caption that can be clicked to expand or collapse the region.
 
 print_collapsible_region_end ($return=false)
 Close a region started with print_collapsible_region_start.
 
 print_collapsible_region_start ($classes, $id, $caption, $userpref='', $default=false, $return=false, $extracontent=null)
 Print (or return) the start of a collapsible region.
 
 print_container ()
 
 print_container_end ()
 
 print_container_start ()
 
 print_context_name ()
 
 print_continue ()
 
 print_course ()
 
 print_course_search ()
 
 print_courses ()
 
 print_error ($errorcode, $module='error', $link='', $a=null, $debuginfo=null)
 Abort execution by throwing of a general exception, default exception handler displays the error message in most cases.
 
 print_grade_menu ($courseid, $name, $current, $includenograde=true, $return=false)
 Prints a grade menu (as part of an existing form) with help showing all possible numerical grades and scales.
 
 print_grade_plugin_selector ($plugin_info, $active_type, $active_plugin, $return=false)
 Print grading plugin selection popup form.
 
 print_group_picture ($group, $courseid, $large=false, $return=false, $link=true, $includetoken=false)
 Print a specified group's avatar.
 
 print_header ()
 
 print_header_simple ()
 
 print_location_comment ($file, $line, $return=false)
 Outputs a HTML comment to the browser.
 
 print_log ()
 
 print_log_csv ()
 
 print_log_ods ()
 
 print_log_xls ()
 
 print_maintenance_message ()
 Prints a maintenance message from $CFG->maintenance_message or default if empty.
 
 print_mnet_log ()
 
 print_my_moodle ()
 
 print_navigation ()
 
 print_object ($item, array $expandclasses=['/./'], bool $textonly=false, bool $return=false, int $depth=0, array $done=[])
 GENERAL HELPFUL THINGS ///////////////////////////////////.
 
 print_overview ()
 
 print_password_policy ()
 Returns a localized sentence in the current language summarizing the current password policy.
 
 print_question_icon ($question)
 Print the icon for the question type.
 
 print_recent_activity ()
 
 print_recent_activity_note ($time, $user, $text, $link, $return=false, $viewfullnames=null)
 Display a recent activity note.
 
 print_remote_course ()
 
 print_remote_host ()
 
 print_scale_menu_helpbutton ()
 
 print_section ()
 
 print_section_add_menus ()
 
 print_side_block ()
 
 print_string ($identifier, $component='', $a=null)
 Prints out a translated string.
 
 print_tabs ($tabrows, $selected=null, $inactive=null, $activated=null, $return=false)
 Returns a string containing a nested list, suitable for formatting into tabs with CSS.
 
 print_textarea ()
 
 print_upgrade_part_end ($plugin, $installation, $verbose)
 Default end upgrade callback.
 
 print_upgrade_part_start ($plugin, $installation, $verbose)
 Default start upgrade callback.
 
 print_upgrade_separator ()
 
 print_whole_category_list ()
 
 process_environment_bypass ($xml, &$result)
 This function will post-process the result record by executing the specified function, modifying it as necessary, also a custom message will be added to the result object to be printed by the display layer.
 
 process_environment_messages ($xml, &$result)
 This function will detect if there is some message available to be added to the result in order to clarify enviromental details.
 
 process_environment_restrict ($xml, &$result)
 This function will post-process the result record by executing the specified function, modifying it as necessary, also a custom message will be added to the result object to be printed by the display layer.
 
 process_environment_result ($element, &$result)
 Once the result has been determined, look in the XML for any messages, or other things that should be done depending on the outcome.
 
 process_manual_award ($recipientid, $issuerid, $issuerrole, $badgeid)
 
 process_manual_revoke ($recipientid, $issuerid, $issuerrole, $badgeid)
 Manually revoke awarded badges.
 
 process_new_icon ($context, $component, $filearea, $itemid, $originalfile, $preferpng=false)
 Stores optimised icon images in icon file area.
 
 profile_display_badges ()
 
 profile_display_fields ()
 
 profile_edit_category ()
 
 profile_edit_field ()
 
 profiling_available ()
 Whether PHP profiling is available.
 
 profiling_export_generate (array $runids, $tmpdir)
 Generate the mpr contents (xml files) in the temporal directory.
 
 profiling_export_package ($file, $tmpdir)
 Package (zip) the mpr contents (xml files) in the final location.
 
 profiling_export_runs (array $runids, $file)
 Export profiling runs to a .mpr (moodle profile runs) file.
 
 profiling_get_difference ($number1, $number2, $units='', $factor=1, $numdec=2)
 Helper function that, given to floats, returns their numerical and percentual differences, propertly formated and cssstyled.
 
 profiling_get_flag ($flag)
 Check for profiling flags in all possible places.
 
 profiling_get_import_main_schema ()
 Return the xml schema for the main import file.
 
 profiling_get_import_run_schema ()
 Return the xml schema for each individual run import file.
 
 profiling_get_script ()
 Returns the path to the php script being requested.
 
 profiling_import_runs ($file, $commentprefix='')
 Import a .mpr (moodle profile runs) file into moodle.
 
 profiling_is_running ($value=null)
 Returns if profiling is running, optionally setting it.
 
 profiling_is_saved ($value=null)
 Returns if profiling has been saved, optionally setting it.
 
 profiling_list_controls ($listurl)
 Helper function that returns the HTML fragment to be displayed on listing mode, it includes actions like deletion/export/import...
 
 profiling_print_run ($run, $prevreferences=null)
 Generate the output to print a profiling run including further actions you can then take.
 
 profiling_print_rundiff ($run1, $run2)
 
 profiling_prune_old_runs ($exception=0)
 
 profiling_start ()
 Start profiling observing all the configuration.
 
 profiling_stop ()
 Stop profiling, gathering results and storing them.
 
 profiling_string_matches ($string, $patterns)
 Helper function that looks for matchings of one string against an array of * wildchar patterns.
 
 profiling_urls ($report, $runid, $runid2=null)
 
 proxy_log_callback ($code)
 Add http stream instrumentation.
 
 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.
 
 purify_html ($text, $options=array())
 KSES replacement cleaning function - uses HTML Purifier.
 
 put_records_csv ()
 
 qualified_me ()
 Guesses the full URL of the current script.
 
 query_end ($result)
 This should be called immediately after each db query.
 
 query_start ($sql, ?array $params, $type, $extrainfo=null)
 Called before each db query.
 
 question_add_context_in_key ($categories)
 Add context in categories key.
 
 question_add_tops ()
 
 question_category_delete_safe ($category)
 Category is about to be deleted, 1/ All questions are deleted for this question category.
 
 question_category_in_use ($categoryid, $recursive=false)
 Tests whether any question in a category is used by any part of Moodle.
 
 question_category_options ($contexts, $top=false, $currentcat=0, $popupform=false, $nochildrenof=-1, $escapecontextnames=true)
 Output an array of question categories.
 
 question_category_select_menu ($contexts, $top=false, $currentcat=0, $selected="", $nochildrenof=-1)
 Output a select menu of question categories.
 
 question_categorylist ($categoryid)
 Get the list of categories.
 
 question_categorylist_parents (int $categoryid)
 Get all parent categories of a given question category in descending order.
 
 question_context_has_any_questions ($context)
 Determine whether there are any questions belonging to this context, that is whether any of its question categories contain any questions.
 
 question_default_export_filename ($course, $category)
 Create a reasonable default file name for exporting questions from a particular category.
 
 question_delete_activity ($cm, $notused=false)
 All question categories and their questions are deleted for this activity.
 
 question_delete_context ($contextid)
 All question categories and their questions are deleted for this context id.
 
 question_delete_course ($course, $notused=false)
 All question categories and their questions are deleted for this course.
 
 question_delete_course_category ($category, $newcategory, $notused=false)
 Category is about to be deleted, 1/ All question categories and their questions are deleted for this course category.
 
 question_delete_question ($questionid)
 Deletes question and all associated data from the database.
 
 question_edit_url ($context)
 Gets the question edit url.
 
 question_extend_settings_navigation (navigation_node $navigationnode, $context, $baseurl='/question/edit.php')
 Adds question bank setting links to the given navigation node if caps are met and loads the navigation from the plugins.
 
 question_fix_top_names ($categories, $escape=true)
 Finds top categories in the given categories hierarchy and replace their name with a proper localised string.
 
 question_get_all_capabilities ()
 Get the question bank caps.
 
 question_get_default_category ($contextid)
 Get the default category for the context.
 
 question_get_export_single_question_url ($question)
 Get the URL to export a single question (exportone.php).
 
 question_get_question_capabilities ()
 Get the array of capabilities for question.
 
 question_get_top_categories_for_contexts ($contextids)
 Gets the list of top categories in the given contexts in the array("categoryid,categorycontextid") format.
 
 question_get_top_category ($contextid, $create=false)
 Gets the top category in the given context.
 
 question_has_capability_on ($questionorid, $cap, $notused=-1)
 Check capability on category.
 
 question_hash ($question)
 Creates a stamp that uniquely identifies this version of the question.
 
 question_is_only_toplevel_category_in_context ()
 
 question_load_questions ($questionids, $extrafields='', $join='')
 Load a set of questions, given a list of ids.
 
 question_make_default_categories ($contexts)
 Gets the default category in the most specific context.
 
 question_make_export_url ($contextid, $categoryid, $format, $withcategories, $withcontexts, $filename)
 Create url for question export.
 
 question_module_uses_questions ($modname)
 Does an activity module use the question bank?
 
 question_move_category_to_context ($categoryid, $oldcontextid, $newcontextid)
 This function helps move a question cateogry to a new context by moving all the files belonging to all the questions to the new context.
 
 question_move_question_tags_to_new_context (array $questions, context $newcontext)
 This function will handle moving all tag instances to a new context for a given list of questions.
 
 question_move_questions_to_category ($questionids, $newcategoryid)
 This function should be considered private to the question bank, it is called from question/editlib.php question/contextmoveq.php and a few similar places to to the work of actually moving questions and associated data.
 
 question_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types.
 
 question_pluginfile ($course, $context, $component, $filearea, $args, $forcedownload, $options=[])
 Called by pluginfile.php to serve files related to the 'question' core component and for files belonging to qtypes.
 
 question_preload_questions ($questionids=null, $extrafields='', $join='', $extraparams=[], $orderby='')
 Given a list of ids, load the basic information about a set of questions from the questions table.
 
 question_preview_popup_params ()
 Popup params for the question preview.
 
 question_preview_url ($questionid, $preferredbehaviour=null, $maxmark=null, $displayoptions=null, $variant=null, $context=null)
 Generate the URL for starting a new preview of a given question with the given options.
 
 question_remove_stale_questions_from_category ($categoryid)
 Remove stale questions from a category.
 
 question_reorder_qtypes ($sortedqtypes, $tomove, $direction)
 Move one question type in a list of question types.
 
 question_require_capability_on ($question, $cap)
 Require capability on question.
 
 question_rewrite_question_preview_urls ($text, $questionid, $filecontextid, $filecomponent, $filearea, $itemid, $previewcontextid, $previewcomponent, $options=null)
 Rewrite the PLUGINFILE urls in part of the content of a question, for use when viewing the question outside an attempt (for example, in the question bank listing or in the quiz statistics report).
 
 question_save_from_deletion ($questionids, $newcontextid, $oldplace, $newcategory=null)
 Creates a new category to save the questions in use.
 
 question_save_qtype_order ($neworder, $config=null)
 Save a new question type order to the config_plugins table.
 
 question_sort_tags ($tagobjects, $categorycontext, $filtercourses=null)
 Sort question tags by course or normal tags.
 
 questions_in_use ($questionids)
 Check if the question is used.
 
 raise_memory_limit ($newlimit)
 Function to raise the memory limit to a new value.
 
 random_bytes_emulate ($length)
 Try to generate cryptographically secure pseudo-random bytes.
 
 random_string ($length=15)
 Generate and return a random string of the specified length.
 
 raw_connect (string $dbhost, string $dbuser, string $dbpass, string $dbname, $prefix, array $dboptions=null)
 Connect to db The real connection establisment, called from connect() and set_dbhwrite()
 
 rc4decrypt ($data)
 rc4decrypt
 
 rc4encrypt ($data)
 rc4encrypt
 
 rebuild_contexts ()
 
moodle_database rebuild_course_cache (int $courseid=0, bool $clearonly=false, bool $partialrebuild=false)
 Rebuilds or resets the cached list of course activities stored in MUC.
 
 rebuildnolinktag ($text)
 This function is used to rebuild the <nolink> tag because some formats (PLAIN and WIKI) will transform it to html entities.
 
 recaptcha_check_response ($verifyurl, $privkey, $remoteip, $response)
 Calls an HTTP POST function to verify if the user's response was correct.
 
 recaptcha_get_challenge_html ($apiurl, $pubkey, $lang=null, bool $compactmode=false)
 Gets the challenge HTML This is called from the browser, and the resulting reCAPTCHA HTML widget is embedded within the HTML form it was called from.
 
 recaptcha_lang ($lang=null)
 Returns the language code the reCAPTCHA element should use.
 
 redirect ($url, $message='', $delay=null, $messagetype=core\output\notification::NOTIFY_INFO)
 Redirects the user to another page, after printing a notice.
 
 redirect_if_major_upgrade_required ()
 Redirect to the Notifications page if a major upgrade is required, and terminate the current user session.
 
 reduce_memory_limit ($newlimit)
 Function to reduce the memory limit to a new value.
 
 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.
 
 replace_ampersands_not_followed_by_entity ($string)
 Given a string, performs a negative lookahead looking for any ampersand character that is not followed by a proper HTML entity.
 
 report_insights_context_insights (\context $context)
 
 require_admin ()
 A convenience function for where we must be logged in as admin.
 
 require_phpunit_isolation ()
 A helper function for deprecated files to use to ensure that, when they are included for unit tests, they are run in an isolated process.
 
 require_sesskey ()
 Check the session key using confirm_sesskey(), and cause a fatal error if it does not match.
 
 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.
 
static filter_manager::reset_caches ()
 Resets the caches, usually to be called between unit tests.
 
 reset_course_userdata ($data)
 This function will empty a course of user data.
 
 reset_login_count ()
 
 reset_password_and_mail ($user)
 Resets specified user's password and send the new password to the user via email.
 
 reset_text_filters_cache ($phpunitreset=false)
 Resets some data related to filters, called during upgrade or when general filter settings change.
 
 resize_image ($filepath, $width, $height, $forcecanvas=false)
 Resize an image from an image path.
 
 resize_image_from_image ($original, $imageinfo, $width, $height, $forcecanvas=false)
 Resize an image from an image object.
 
 resourcelib_embed_general ($fullurl, $title, $clicktoopen, $mimetype)
 Returns general link or file embedding html.
 
 resourcelib_embed_image ($fullurl, $title)
 Returns image embedding html.
 
 resourcelib_embed_pdf ($fullurl, $title, $clicktoopen)
 Returns general link or pdf embedding html.
 
 resourcelib_get_displayoptions (array $enabled, $current=null)
 Returns list of available display options.
 
 resourcelib_get_extension ($fullurl)
 Looks for the extension.
 
 resourcelib_guess_url_mimetype ($fullurl)
 Tries to guess correct mimetype for arbitrary URL.
 
 resourcelib_try_file_migration ($filepath, $cmid, $courseid, $component, $filearea, $itemid)
 Try on demand migration of file from old course files.
 
 restrict_php_version (&$result, $version)
 Check if the current PHP version is greater than or equal to an unsupported version.
 
 restrict_php_version_7 (&$result)
 Check if the current PHP version is greater than or equal to PHP version 7.
 
 restrict_php_version_71 (&$result)
 Check if the current PHP version is greater than or equal to PHP version 7.1.
 
 restrict_php_version_72 (&$result)
 Check if the current PHP version is greater than or equal to PHP version 7.2.
 
 restrict_php_version_73 (&$result)
 Check if the current PHP version is greater than or equal to PHP version 7.3.
 
 restrict_php_version_74 (&$result)
 Check if the current PHP version is greater than or equal to PHP version 7.4.
 
 restrict_php_version_80 ($result)
 Check if the current PHP version is greater than or equal to PHP version 8.0.
 
 restrict_php_version_81 ($result)
 Check if the current PHP version is greater than or equal to PHP version 8.1.
 
 restrict_php_version_82 ($result)
 Check if the current PHP version is greater than or equal to PHP version 8.2.
 
 restrict_php_version_83 ($result)
 Check if the current PHP version is greater than or equal to PHP version 8.3.
 
 right_to_left ()
 Returns true if the user is using a right-to-left language.
 
 s ($var)
 Add quotes to HTML characters.
 
object search_generate_SQL ($parsetree, $datafield, $metafield, $mainidfield, $useridfield, $userfirstnamefield, $userlastnamefield, $timefield, $instancefield, $tagfields=[])
 Primitive function to generate a SQL string from a parse tree.
 
 search_generate_text_SQL ($parsetree, $datafield, $metafield, $mainidfield, $useridfield, $userfirstnamefield, $userlastnamefield, $timefield, $instancefield)
 Primitive function to generate a SQL string from a parse tree using TEXT indexes.
 
object search_users ($courseid, $groupid, $searchtext, $sort='', array $exceptions=null)
 Search through course users.
 
 select_db_handle (int $type, string $sql)
 Select appropriate db handle - readwrite or readonly.
 
 send_confirmation_email ($user, $confirmationurl=null)
 Send email to specified user with confirmation text and activation link.
 
 send_headers ($contenttype, $cacheable=true)
 Send the HTTP headers that Moodle requires.
 
 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.
 
 serialise_tool_proxy ()
 
 session_get_instance ()
 
 session_get_realuser ()
 
 session_is_legacy ()
 
 session_is_loggedinas ()
 
 session_kill ()
 
 session_kill_all ()
 
 session_kill_user ()
 
 session_loginas ()
 
 session_set_user ()
 
 session_touch ()
 
 sesskey ()
 Makes sure that $USER->sesskey exists, if $USER itself exists.
 
 set_access_log_user ()
 Webserver access user logging.
 
 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_cron_lock ($name, $until, $ignorecurrent=false)
 Try to obtain or release the cron lock.
 
 set_current_group ()
 
 set_db_handle ($dbh)
 Sets db handle to be used with subsequent queries.
 
 set_debugging ($level, $debugdisplay=null)
 Alter debugging level for the current request, the change is not saved in database.
 
 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_moodle_cookie ($username)
 Sets a moodle cookie with a weakly encrypted username.
 
 set_send_count ($user, $reset=false)
 Used to increment or reset email sent count.
 
 set_user_device_type ()
 
 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.
 
 moodle_text_filter::setup ($page, $context)
 Setup page with filter requirements and other prepare stuff.
 
stdClass setup_DB ()
 Sets up global $DB moodle_database instance.
 
 setup_get_remote_url ()
 Get the URL that PHP/the web server thinks it is serving.
 
 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.
 
 filter_manager::setup_page_for_filters ($page, $context)
 Setup page with filters requirements and other prepare stuff.
 
 filter_manager::setup_page_for_globally_available_filters ($page)
 Setup the page for globally available filters.
 
 setup_validate_php_configuration ()
 This function verifies the sanity of PHP configuration and stops execution if anything critical found.
 
 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.
 
 show_event ()
 
 signup_captcha_enabled ()
 Returns whether or not the captcha element is enabled, and the admin settings fulfil its requirements.
 
 signup_get_user_confirmation_authplugin ()
 Check if user confirmation is enabled on this site and return the auth plugin handling registration if enabled.
 
 signup_is_enabled ()
 Check if sign-up is enabled in the site.
 
 signup_setup_new_user ($user)
 Add the missing fields to a user that is going to be created.
 
 signup_validate_data ($data, $files)
 Validates the standard sign-up data (except recaptcha that is validated by the form element).
 
 site_is_public ()
 Tries to guess if $CFG->wwwroot is publicly accessible or not.
 
 site_scale_used ()
 
 skip_main_destination ()
 
 soap_call ($connection, $call, $params)
 Make a call to a SoapClient.
 
 soap_connect ($wsdl, $trace=false)
 Create a new SoapClient object.
 
 soap_encode ($value, $name, $type, $namespace, $encode=XSD_STRING)
 
 soap_encode_array ($value, $name, $type, $namespace)
 
 soap_encode_object ($value, $name, $type, $namespace)
 
 soap_serve ($wsdl, $functions)
 
 sort_categories_by_tree (&$categories, $id=0, $level=1)
 Returns the categories with their names ordered following parent-child relationships.
 
 start_delegated_transaction ()
 On DBs that support it, switch to transaction mode and begin a transaction.
 
 stats_check_uptodate ($courseid=0)
 
 stats_clean_old ()
 Remove old stats data.
 
 stats_compare_times ($a, $b)
 
 stats_cron_daily ($maxdays=1)
 Execute daily statistics gathering.
 
 stats_cron_monthly ()
 Execute monthly statistics gathering.
 
 stats_cron_weekly ()
 Execute weekly statistics gathering.
 
 stats_fix_zeros ($stats, $timeafter, $timestr, $line2=true, $line3=false)
 Fix missing entries in the statistics.
 
 stats_get_action_names ($str)
 
 stats_get_base_daily ($time=0)
 Start of day.
 
 stats_get_base_monthly ($time=0)
 Start of month.
 
 stats_get_base_weekly ($time=0)
 Start of week.
 
 stats_get_next_day_start ($time)
 Start of next day.
 
 stats_get_next_month_start ($time)
 Start of next month.
 
 stats_get_next_week_start ($time)
 Start of next week.
 
 stats_get_parameters ($time, $report, $courseid, $mode, $roleid=0)
 
 stats_get_post_actions ()
 
 stats_get_report_options ($courseid, $mode)
 
 stats_get_start_from ($str)
 Return starting date of stats processing.
 
 stats_get_time_options ($now, $lastweekend, $lastmonthend, $earliestday, $earliestweek, $earliestmonth)
 
 stats_get_view_actions ()
 
 stats_progress ($ident)
 Print daily cron progress.
 
 stats_run_query ($sql, $parameters=array())
 Execute individual daily statistics queries.
 
 stats_temp_table_clean ()
 Deletes summary logs table for stats calculation.
 
 stats_temp_table_create ()
 Create temporary tables to speed up log generation.
 
 stats_temp_table_drop ()
 Deletes summary logs table for stats calculation.
 
 stats_temp_table_fill ($timestart, $timeend)
 Fills the temporary stats tables with new data.
 
 stats_temp_table_setup ()
 Fills the temporary stats tables with new data.
 
 core\hook::stop_propagation ()
 Allows plugins to notify the hook dispatcher that hook propagation should be stopped.
 
 strip_links ($string)
 Given a string, replaces all .
 
 strip_pluginfile_content ($source)
 Removes the usage of Moodle files from a text.
 
 strip_querystring ($url)
 Remove query string from url.
 
 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.
 
 table_names (string $sql)
 Parse table names from query.
 
 tag_add ()
 
 tag_assign ()
 
 tag_autocomplete ()
 
 tag_bulk_delete_instances ()
 
 tag_cleanup ()
 
 tag_cloud_sort ()
 
 tag_compute_correlations ()
 
 tag_cron ()
 
 tag_delete ()
 
 tag_delete_instance ()
 
 tag_delete_instances ()
 
 tag_description_set ()
 
 tag_display_name ()
 
 tag_find_records ()
 
 tag_find_tags ()
 
 tag_get ()
 
 tag_get_correlated ()
 
 tag_get_id ()
 
 tag_get_name ()
 
 tag_get_related_tags ()
 
 tag_get_related_tags_csv ()
 
 tag_get_tags ()
 
 tag_get_tags_array ()
 
 tag_get_tags_csv ()
 
 tag_get_tags_ids ()
 
 tag_normalize ()
 
 tag_print_cloud ()
 
 tag_print_description_box ()
 
 tag_print_management_box ()
 
 tag_print_search_box ()
 
 tag_print_search_results ()
 
 tag_print_tagged_users_table ()
 
 tag_print_user_box ()
 
 tag_print_user_list ()
 
 tag_process_computed_correlation ()
 
 tag_record_count ()
 
 tag_record_tagged_with ()
 
 tag_rename ()
 
 tag_set ()
 
 tag_set_add ()
 
 tag_set_delete ()
 
 tag_set_flag ()
 
 tag_type_set ()
 
 tag_unset_flag ()
 
 template_reset_all_caches ()
 Invalidate all server and client side template caches.
 
 testing_cli_argument_path ($moodlepath)
 Returns relative path against current working directory, to be used for shell execution hints.
 
 testing_cli_fix_directory_separator ($path)
 Fix DIRECTORY_SEPARATOR for windows.
 
 testing_error ($errorcode, $text='')
 Prints an error and stops execution.
 
 testing_fix_file_permissions ($file)
 Try to change permissions to $CFG->dirroot or $CFG->dataroot if possible.
 
 testing_initdataroot ($dataroot, $framework)
 Mark empty dataroot to be used for testing.
 
 testing_is_cygwin ()
 Find out if running under Cygwin on Windows.
 
 testing_is_mingw ()
 Returns whether a mingw CLI is running.
 
 testing_update_composer_dependencies (bool $selfupdate=true, bool $updatedependencies=true)
 Perform necessary steps to install and/or upgrade composer and its dependencies.
 
 filter_manager::text_filtering_hash ()
 
 null_filter_manager::text_filtering_hash ()
 As for the equivalent filter_manager method.
 
 text_to_html ($text, $smileyignored=null, $para=true, $newlines=true)
 Given plain text, makes it into HTML as nicely as possible.
 
 textlib_get_instance ()
 
 theme_build_css_for_themes ($themeconfigs=[], $directions=['rtl', 'ltr'], $cache=true, $mtraceprogress=false)
 Generates and saves the CSS files for the given theme configs.
 
 theme_get_config_file_path ($themename)
 Get the path to a theme config.php file.
 
 theme_get_css_filename ($themename, $globalrevision, $themerevision, $direction)
 Get the path to the local cached CSS file.
 
 theme_get_locked_theme_for_device ($device)
 Returns the theme named defined in config.php for the given device.
 
 theme_get_next_revision ()
 Calculates and returns the next theme revision number.
 
 theme_get_next_sub_revision_for_theme ($themename)
 Calculates and returns the next theme revision number.
 
 theme_get_revision ()
 Returns current theme revision number.
 
 theme_get_sub_revision_for_theme ($themename)
 Returns current theme sub revision number.
 
 theme_is_device_locked ($device)
 Checks if the given device has a theme defined in config.php.
 
 theme_reset_all_caches ()
 Invalidate all server and client side caches.
 
 theme_reset_static_caches ()
 Reset static caches.
 
 theme_set_designer_mod ($state)
 Enable or disable theme designer mode.
 
 theme_set_revision ($revision)
 Sets the current theme revision number.
 
 theme_set_sub_revision_for_theme ($themename, $revision)
 Sets the current theme revision number for a specific theme.
 
 truncate_userinfo (array $info)
 Will truncate userinfo as it comes from auth_get_userinfo (from external auth) which may have large fields.
 
 trusttext_active ()
 Is trusttext feature active?
 
 trusttext_pre_edit ($object, $field, $context)
 Must be called before editing of all texts with trust flag.
 
 trusttext_trusted ($context)
 Is current user trusted to enter no dangerous XSS in this context?
 
 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!
 
 uninstall_plugin ($type, $name)
 Automatically clean-up all plugin data and remove the plugin DB tables.
 
 filter_manager::unload_all_filters ()
 Unloads all filters and other cached information.
 
 performance_measuring_filter_manager::unload_all_filters ()
 Unloads all filters and other cached information.
 
 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.
 
 unzip_file ()
 
 update_category_button ()
 
 update_event ()
 
 update_field_with_unique_index ($table, $field, array $newvalues, array $otherconditions, $unusedvalue=-1)
 This method can update the values in mulitple database rows for a colum with a unique index, without violating that constraint.
 
 update_internal_user_password (stdClass $user, #[\SensitiveParameter] string $password, bool $fasthash=false)
 Update password hash in user object (if necessary).
 
 update_log_display_entry ()
 
 update_login_count ()
 
 update_module_button ()
 
 update_timezone_records ()
 
 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!).
 
 upgrade_block_savepoint ($result, $version, $blockname, $allowabort=true)
 Blocks upgrade savepoint, marks end of blocks upgrade blocks It stores block version, resets upgrade timeout and abort upgrade if user cancels page loading.
 
 upgrade_component_updated (string $component, string $messageplug='', bool $coreinstall=false)
 After upgrading a module, block, or generic plugin, various parts of the system need to be informed.
 
 upgrade_core ($version, $verbose)
 Upgrade moodle core.
 
 upgrade_ensure_not_running ($warningonly=false)
 Makes sure that upgrade process is not running.
 
object upgrade_finished ($continueurl=null)
 Indicates upgrade is finished.
 
 upgrade_finished_handler ()
 Internal function - executed if upgrade interrupted.
 
 upgrade_handle_exception ($ex, $plugin=null)
 upgrade logging functions
 
object upgrade_init_javascript ()
 Sets up JS code required for all upgrade scripts.
 
 upgrade_install_plugins (array $installable, $confirmed, $heading='', $continue=null, $return=null)
 Helper procedure/macro for installing remote plugins at admin/index.php.
 
 upgrade_language_pack ($lang=null)
 Try to upgrade the given language pack (or current language)
 
 upgrade_log ($type, $plugin, $info, $details=null, $backtrace=null)
 Adds log entry into upgrade_log table.
 
 upgrade_main_savepoint ($result, $version, $allowabort=true)
 Upgrade savepoint, marks end of each upgrade block.
 
 upgrade_mod_savepoint ($result, $version, $modname, $allowabort=true)
 Module upgrade savepoint, marks end of module upgrade blocks It stores module version, resets upgrade timeout and abort upgrade if user cancels page loading.
 
 upgrade_noncore ($verbose)
 Upgrade/install other parts of moodle.
 
 upgrade_plugin_mnet_functions ($component)
 upgrades the mnet rpc definitions for the given component.
 
 upgrade_plugin_savepoint ($result, $version, $type, $plugin, $allowabort=true)
 Plugins upgrade savepoint, marks end of plugin upgrade blocks It stores plugin version, resets upgrade timeout and abort upgrade if user cancels page loading.
 
 upgrade_plugins ($type, $startcallback, $endcallback, $verbose)
 Upgrade plugins.
 
object upgrade_plugins_blocks ($startcallback, $endcallback, $verbose)
 This function finds all available blocks and install them into blocks table or do all the upgrade process if newer.
 
object upgrade_plugins_modules ($startcallback, $endcallback, $verbose)
 Find and check all modules and load them up or upgrade them if necessary.
 
 upgrade_set_timeout ($max_execution_time=300)
 Sets maximum expected time needed for upgrade task.
 
object upgrade_setup_debug ($starting)
 @global object
 
 upgrade_stale_php_files_present ()
 Detect if there are leftovers in PHP source files.
 
object upgrade_started ($preinstall=false)
 Marks start of upgrade, blocks any other access to site.
 
 upgrade_themes ()
 Build the current theme so that the user doesn't have to wait for it to build on the first page load after the install / upgrade.
 
stdClass user_accesstime_log ($courseid=0)
 Store user last access times - called when use enters a course or site.
 
object user_can_create_courses ()
 @uses CONTEXT_COURSECAT
 
 user_get_participants ()
 
 user_get_participants_sql ()
 
 user_get_total_participants ()
 
 user_not_fully_set_up ($user, $strict=true)
 Determines if a user has completed setting up their account.
 
 user_preference_allow_ajax_update ($name, $paramtype)
 You need to call this function if you wish to use the set_user_preference method in javascript_static.php, to white-list the preference you want to update from JavaScript, and to specify the type of cleaning you expect to be done on values.
 
 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.
 
 useredit_shared_definition_preferences ()
 
 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.
 
 users_order_by_sql (string $usertablealias='', string $search=null, context $context=null, array $customfieldmappings=[])
 This function generates the standard ORDER BY clause for use when generating lists of users.
 
 users_search_sql (string $search, string $u='u', int $searchtype=USER_SEARCH_STARTS_WITH, array $extrafields=[], array $exclude=null, array $includeonly=null)
 Returns SQL used to search through user table to find users (in a query which may also join and apply other conditions).
 
 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_email ($address)
 Validates an email to make sure it makes sense.
 
 validate_internal_user_password (stdClass $user, #[\SensitiveParameter] string $password)
 Compare password against hash stored in user object to determine if it is valid.
 
 validate_login_captcha (string|bool $captcha)
 Check the submitted captcha is valid or not.
 
 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.
 
 want_read_slave ()
 Returns whether we want to connect to slave database for read queries.
 
 wikify_links ($string)
 This expression turns links into something nice in a text format.
 
 workaround_max_input_vars ()
 Try to work around the 'max_input_vars' restriction if necessary.
 
 xmldb_debug ($message, $object)
 This function is the official hook inside XMLDB stuff to delegate its debug to one external function.
 
 xmlize ($data, $whitespace=1, $encoding='UTF-8', $reporterrors=false)
 XML parsing function calles into class.
 
 zip_files ()
 

Variables

 $branch = '403'
 
 $capabilities
 
bool filterobject::$casesensitive
 whether the match needs to be case sensitive.
 
global $CFG
 
 $CFG = new stdClass()
 
global object $CFG
 $CFG
 
global core\hub::$CFG
 
global core\task::$CFG
 
global core_admin\local\settings::$CFG
 
if(file_exists('install/distrolib.php')) $config = new stdClass()
 
 $configfile = './config.php'
 
 $content = ''
 
context moodle_text_filter::$context
 The context we are in.
 
global $COURSE
 
 $COURSE = new stdClass()
 
global $DB
 
resource $dbhreadonly
 slave read only database handle
 
 $definitions
 
 $distro = null
 
if(file_exists(__DIR__.'/../config.php')) $files = array('boost/style/moodle.css')
 
int performance_measuring_filter_manager::$filterscreated = 0
 number of filter objects created.
 
bool filterobject::$fullmatch
 whether to match complete words.
 
 $handlers
 
 $hint_admindir = ''
 
 $hint_database = ''
 
 $hint_dataroot = ''
 
string filterobject::$hreftagbegin
 HTML to insert before any match.
 
string filterobject::$hreftagend
 HTML to insert after any match.
 
 $languages = get_string_manager()->get_list_of_translations()
 
array moodle_text_filter::$localconfig
 Any local configuration for this filter in this context.
 
 $logs
 
 $maturity = MATURITY_STABLE
 
 $memlimit = @ini_get('memory_limit')
 
 $messageproviders
 
 $models
 
 $name ='Courier'
 
 $observers
 
if($hassiteconfig) $pages = array()
 
string filterobject::$phrase
 this is the phrase that should be matched.
 
foreach($pages as $page) if( $hassiteconfig) if($hassiteconfig) $plugins = core_plugin_manager::instance()->get_plugins_of_type('tool')
 Add all admin tools.
 
 $plugins
 
 $release = '4.3.5 (Build: 20240610)'
 
 $renamedclasses
 
null callable filterobject::$replacementcallback
 hold a replacement function to be called.
 
null array filterobject::$replacementcallbackdata
 data to be passed to $replacementcallback.
 
null string filterobject::$replacementphrase
 replacement text to go inside begin and end.
 
global $SESSION
 
static filter_manager filter_manager::$singletoninstance
 Holds the singleton instance.
 
global $SITE
 
global $SITE
 
 $SITE = $COURSE
 
array filter_manager::$stringfilternames = array()
 Exploded version of $CFG->stringfilters.
 
moodle_text_filter[][] filter_manager::$stringfilters = array()
 This list of active filters, by context, for filtering strings.
 
int performance_measuring_filter_manager::$stringsfiltered = 0
 number of calls to filter_string.
 
 $strmnetedithost = get_string('reviewhostdetails', 'mnet')
 
if(!defined('MOODLE_INTERNAL')) $strmnetservices = get_string('mnetservices', 'mnet')
 
 $tabs = array()
 
 $tagareas
 
 $tasks
 
 $tasks
 
moodle_text_filter[][] filter_manager::$textfilters = array()
 This list of active filters, by context, for filtering content.
 
int performance_measuring_filter_manager::$textsfiltered = 0
 number of calls to filter_text.
 
stdClass core\task::$tracestats = null
 
global $USER
 
 $version = 2023100905.00
 
null string filterobject::$workregexp = null
 once initialised, holds the regexp for matching this phrase.
 
null string filterobject::$workreplacementphrase = null
 once initialised, holds the mangled HTML to replace the regexp with.
 
color __pad0__
 
background __pad1__
 
margin __pad2__
 
padding __pad3__
 
margin __pad4__
 
border __pad5__
 
margin __pad6__
 
padding __pad7__
 
$config admin = 'admin'
 
$CFG admin = $config->admin
 
const AJAX_SCRIPT false
 
text align
 
const ALLOW_GET_PARAMETERS true
 
const ANY_VERSION 'any'
 Any version - special value that can be used in $plugin->dependencies in version.php files.
 
font Arial
 
if write to the Free Software Temple MA USA **Copy of GNU Lesser General Public License at
 
const AUTH_CONFIRM_ALREADY 2
 
const AUTH_CONFIRM_ERROR 3
 
const AUTH_CONFIRM_FAIL 0
 Authentication - error codes for user confirm.
 
const AUTH_CONFIRM_OK 1
 
const AUTH_DENIED 2
 Returned when the login was denied (a reason for AUTH_FAIL).
 
const AUTH_ERROR 4
 Returned when some error occurred (a reason for AUTH_FAIL).
 
const AUTH_FAIL 1
 Returned when the login was unsuccessful.
 
const AUTH_LOGIN_FAILED 3
 Can not login, most probably password did not match.
 
const AUTH_LOGIN_FAILED_RECAPTCHA 6
 Can not login, failed reCaptcha challenge.
 
const AUTH_LOGIN_LOCKOUT 4
 Can not login because user is locked out.
 
const AUTH_LOGIN_NOUSER 1
 Can not login because user does not exist.
 
const AUTH_LOGIN_OK 0
 Login attempt successful.
 
const AUTH_LOGIN_SUSPENDED 2
 Can not login because user is suspended.
 
const AUTH_LOGIN_UNAUTHORISED 5
 Can not login becauser user is not authorised.
 
const AUTH_OK 0
 Returned when the login was successful.
 
const AUTH_PASSWORD_NOT_CACHED 'not cached'
 Authentication constant: String used in password field when password is not stored.
 
const AUTH_REMOVEUSER_FULLDELETE 2
 
const AUTH_REMOVEUSER_KEEP 0
 
const AUTH_REMOVEUSER_SUSPEND 1
 
const BACKPACK_MOVE_DOWN 1
 
const BACKPACK_MOVE_UP -1
 
$CFG backuptempdir = $CFG->tempdir.'/backup'
 
const BADGE_BACKPACKAPIURL 'https://backpack.openbadges.org'
 
const BADGE_BACKPACKWEBURL 'https://backpack.openbadges.org'
 
const BADGE_CRITERIA_AGGREGATION_ALL 1
 
const BADGE_CRITERIA_AGGREGATION_ANY 2
 
const BADGE_CRITERIA_TYPE_ACTIVITY 1
 
const BADGE_CRITERIA_TYPE_BADGE 7
 
const BADGE_CRITERIA_TYPE_COHORT 8
 
const BADGE_CRITERIA_TYPE_COMPETENCY 9
 
const BADGE_CRITERIA_TYPE_COURSE 4
 
const BADGE_CRITERIA_TYPE_COURSESET 5
 
const BADGE_CRITERIA_TYPE_MANUAL 2
 
const BADGE_CRITERIA_TYPE_OVERALL 0
 
const BADGE_CRITERIA_TYPE_PROFILE 6
 
const BADGE_CRITERIA_TYPE_SOCIAL 3
 
const BADGE_MESSAGE_ALWAYS 1
 
const BADGE_MESSAGE_DAILY 2
 
const BADGE_MESSAGE_MONTHLY 4
 
const BADGE_MESSAGE_NEVER 0
 
const BADGE_MESSAGE_WEEKLY 3
 
const BADGE_PERPAGE 50
 
const BADGE_STATUS_ACTIVE 1
 
const BADGE_STATUS_ACTIVE_LOCKED 3
 
const BADGE_STATUS_ARCHIVED 4
 
const BADGE_STATUS_INACTIVE 0
 
const BADGE_STATUS_INACTIVE_LOCKED 2
 
const BADGE_TYPE_COURSE 2
 
const BADGE_TYPE_SITE 1
 
const BADGRIO_BACKPACKAPIURL 'https://api.badgr.io/v2'
 
const BADGRIO_BACKPACKWEBURL 'https://badgr.io'
 
const BEHAT_EXITCODE_CONFIG 250
 
const BEHAT_EXITCODE_INSTALL 254
 
const BEHAT_EXITCODE_INSTALLED 256
 
const BEHAT_EXITCODE_PERMISSIONS 252
 
const BEHAT_EXITCODE_REINSTALL 253
 
const BEHAT_EXITCODE_REQUIREMENT 251
 
const BEHAT_PARALLEL_SITE_NAME "behatrun"
 The behat test site fullname and shortname.
 
font BlinkMacSystemFont
 
const BLOCK_ADDBLOCK_POSITION_CUSTOM -1
 
const BLOCK_ADDBLOCK_POSITION_DEFAULT 0
 
const BLOCK_ADDBLOCK_POSITION_FLATNAV 1
 
const BLOCK_POS_LEFT 'side-pre'
 #+ Default names for the block regions in the standard theme.
 
const BLOCK_POS_RIGHT 'side-post'
 
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
 
if write to the Free Software Temple Boston
 
const BUI_CONTEXTS_CURRENT 0
 
const BUI_CONTEXTS_CURRENT_SUBS 1
 
const BUI_CONTEXTS_ENTIRE_SITE 2
 
const BUI_CONTEXTS_FRONTPAGE_ONLY 0
 #-
 
const BUI_CONTEXTS_FRONTPAGE_SUBS 1
 
const CACHE_DISABLE_ALL true
 
$CFG cachedir = $CFG->dataroot.'/cache'
 
const CLI_SCRIPT (file_exists($configfile)) false
 
background color
 
const COMPONENT_ERROR 0
 
const COMPONENT_INSTALLED 3
 
const COMPONENT_NEEDUPDATE 2
 
const COMPONENT_UPTODATE 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 core\task::CORE_TASK_TASKS_FILENAME 'db/tasks.php'
 
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 CUSTOM_CHECK_FILE_MISSING 13
 XML Processing Error.
 
const CUSTOM_CHECK_FUNCTION_MISSING 14
 XML Processing Error.
 
alert danger
 
$config dataroot = empty($distro->dataroot) ? null : $distro->dataroot
 
$CFG dataroot = $config->dataroot
 
const DAYMINS 1440
 Time constant - the number of minutes in a day.
 
const DAYSECS 86400
 Time constant - the number of seconds in a day.
 
$config dbhost = empty($distro->dbhost) ? 'localhost' : $distro->dbhost
 
$config dbname = 'moodle'
 
$config dbpass = ''
 
$config dbport = empty($distro->dbport) ? '' : $distro->dbport
 
$config dbsocket = empty($distro->dbsocket) ? '' : $distro->dbsocket
 
$config dbtype = empty($distro->dbtype) ? '' : $distro->dbtype
 
$config dbuser = empty($distro->dbuser) ? '' : $distro->dbuser
 
$CFG debug = (E_ALL | E_STRICT)
 
const DEBUG_ALL E_ALL & ~E_STRICT
 All problems except strict PHP warnings.
 
const DEBUG_DEVELOPER E_ALL | E_STRICT
 DEBUG_ALL with all debug messages and strict warnings.
 
const DEBUG_MINIMAL E_ERROR | E_PARSE
 Fatal errors only.
 
const DEBUG_NONE 0
 No warnings and errors at all.
 
const DEBUG_NORMAL E_ERROR | E_PARSE | E_WARNING | E_NOTICE
 Errors, warnings and notices.
 
$CFG debugdeveloper = true
 
$CFG debugdisplay = true
 
 defined ( 'HUB_MOODLEORGHUBURL')||define( 'HUB_MOODLEORGHUBURL'
 URL of the Moodle sites registration portal.
 
 die
 
$CFG directorypermissions = isset($distro->directorypermissions) ? $distro->directorypermissions : 00777
 
$CFG dirroot = __DIR__
 
$CFG docroot = 'https://docs.moodle.org'
 
$CFG early_install_lang = true
 
if(isset($mnet_peer->id) && $mnet_peer->id > 0) else
 
if(isset($_REQUEST['lang'])) else
 
if(isset($_REQUEST['admin'])) else
 
if(!function_exists( 'iconv')) if(PHP_INT_SIZE > 4) else
 
if(!empty($_POST)) else
 
if(defined('COMPONENT_CLASSLOADER')) else
 
if($distro) else
 
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 ENROL_ACTION_EDIT 'editenrolment'
 Edit enrolment action.
 
const ENROL_ACTION_UNENROL 'unenrol'
 Unenrol action.
 
const ENROL_DO_NOT_SEND_EMAIL 0
 Do not send email.
 
const ENROL_EXT_REMOVED_KEEP 1
 When user disappears from external source, the enrolment is kept as is - one way sync.
 
const ENROL_EXT_REMOVED_SUSPEND 2
 When user disappears from external source, user enrolment is suspended, roles are kept as is.
 
const ENROL_EXT_REMOVED_SUSPENDNOROLES 3
 When user disappears from external source, the enrolment is suspended and roles assigned by enrol instance are removed.
 
const ENROL_EXT_REMOVED_UNENROL 0
 When user disappears from external source, the enrolment is completely removed.
 
const ENROL_INSTANCE_DISABLED 1
 Course enrol instance disabled, user may enter course if other enrol instance enabled.
 
const ENROL_INSTANCE_ENABLED 0
 Course enrol instance enabled.
 
const ENROL_MAX_TIMESTAMP 2147483647
 The timestamp indicating forever.
 
const ENROL_REQUIRE_LOGIN_CACHE_PERIOD 1800
 
const ENROL_RESTORE_TYPE 'enrolrestore'
 
const ENROL_SEND_EMAIL_FROM_COURSE_CONTACT 1
 Send email from course contact.
 
const ENROL_SEND_EMAIL_FROM_KEY_HOLDER 2
 Send email from enrolment key holder.
 
const ENROL_SEND_EMAIL_FROM_NOREPLY 3
 Send email from no reply address.
 
const ENROL_USER_ACTIVE 0
 User is active participant (used in user_enrolments->status)
 
const ENROL_USER_SUSPENDED 1
 User participation in course is suspended (used in user_enrolments->status)
 
const ENV_SELECT_DATAROOT 1
 To enforce the use of the file under dataroot.
 
const ENV_SELECT_NEWER 0
 Define algorithm used to select the xml file.
 
const ENV_SELECT_RELEASE 2
 To enforce the use of the file under admin (release)
 
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.
 
font family
 
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.
 
$CFG filepermissions = ($CFG->directorypermissions & 0666)
 
 foreach ( $languages as $name=> $value) = core_plugin_manager::instance()->get_plugins_of_type('local')
 Add all local plugins - must be always last!
 
const FORMAT_HTML '1'
 Plain HTML (with some tags stripped).
 
const FORMAT_MARKDOWN '4'
 Markdown-formatted text http://daringfireball.net/projects/markdown/.
 
const FORMAT_MOODLE '0'
 Does all sorts of transformations and filtering.
 
const FORMAT_PLAIN '2'
 Plain text (even tags are printed in full).
 
const FORMAT_WIKI '3'
 Wiki-formatted text.
 
you can redistribute it and or *modify it under the terms of the GNU Lesser General Public *License as published by the Free Software Foundation
 
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.
 
 h1
 
line height
 
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.
 
**ingroup core *subpackage backup convert *copyright Darko Miletic< dmiletic @moodlerooms.com > *license http
 
**ingroup core *subpackage backup convert *copyright Darko Miletic< dmiletic @moodlerooms.com > *license http
 
$CFG httpswwwroot = $CFG->wwwroot
 
$COURSE id = 1
 
 if (!defined( 'MOODLE_INTERNAL'))
 
 if (!defined( 'MOODLE_INTERNAL'))
 
 if (!defined( 'MOODLE_INTERNAL'))
 
 if (!empty( $memlimit) and $memlimit !=-1)
 
const IGNORE_COMPONENT_CACHE true
 
const IGNORE_MISSING 0
 Return false if record not found, show debug warning if multiple records found.
 
const IGNORE_MULTIPLE 1
 Similar to IGNORE_MISSING but does not show debug warning if multiple records found, not recommended to be used.
 
if write to the Free Software Inc
 
const INCORRECT_FEEDBACK_FOR_OPTIONAL 17
 XML Processing Error.
 
const INCORRECT_FEEDBACK_FOR_REQUIRED 16
 XML Processing Error.
 
const INSECURE_DATAROOT_ERROR 2
 
const INSECURE_DATAROOT_WARNING 1
 Add libraries.
 
const INSTALL_DATABASE 5
 INSTALL_DATABASE = 5.
 
const INSTALL_DATABASETYPE 4
 INSTALL_DATABASETYPE = 4.
 
const INSTALL_DOWNLOADLANG 3
 INSTALL_DOWNLOADLANG = 3.
 
const INSTALL_ENVIRONMENT 1
 INSTALL_ENVIRONMENT = 1.
 
const INSTALL_PATHS 2
 INSTALL_PATHS = 2.
 
const INSTALL_SAVE 6
 INSTALL_SAVE = 6.
 
const INSTALL_WELCOME 0
 INSTALL_WELCOME = 0.
 
$config lang = $lang
 
$CFG lang = $config->lang
 
$CFG langlocalroot = $CFG->dataroot.'/lang'
 
$CFG langotherroot = $CFG->dataroot.'/lang'
 
$CFG libdir = "$CFG->dirroot/lib"
 
without even the implied warranty of *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the GNU *Lesser General Public License for more details **You should have received a copy of the GNU Lesser General Public *License along with this library
 
either *version of the License
 
const LIST_DEFINITION 4
 
const LIST_NONE 1
 #-
 
const LIST_ORDERED 3
 
const LIST_UNORDERED 2
 
$CFG localcachedir = $CFG->dataroot.'/localcache'
 
trait core\task::logging_trait
 This trait includes functions to assist with logging in tasks.
 
const MATURITY_ALPHA 50
 Software maturity level - internals can be tested using white box techniques.
 
const MATURITY_BETA 100
 Software maturity level - feature complete, ready for preview and testing.
 
const MATURITY_RC 150
 Software maturity level - tested, will be released unless there are fatal bugs.
 
const MATURITY_STABLE 200
 Software maturity level - ready for production deployment.
 
const MAX_COURSE_CATEGORIES 10000
 The maximum number of course categories MAX_COURSES_IN_CATEGORY * MAX_COURSE_CATEGORIES must not be more than max integer!
 
const MAX_COURSES_IN_CATEGORY 10000
 The maximum courses in a category MAX_COURSES_IN_CATEGORY * MAX_COURSE_CATEGORIES must not be more than max integer!
 
const MAX_FILENAME_SIZE 100
 Maximum filename char size.
 
const MAX_PASSWORD_CHARACTERS 128
 Maximum number of characters for password.
 
const MDL_PERF false
 
const MDL_PERF_TEST false
 
const MDL_PERFINC false
 
const MDL_PERFTOFOOT false
 
const MDL_PERFTOLOG false
 
const MEMORY_EXTRA -3
 Large memory limit for given platform - used in cron, upgrade, and other places that need a lot of memory.
 
const MEMORY_HUGE -4
 Extremely large memory limit - not recommended for standard scripts.
 
const MEMORY_STANDARD -2
 Standard memory limit for given platform.
 
const MEMORY_UNLIMITED -1
 Remove any memory limits.
 
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_INTERNAL true
 Used by library scripts to check they are being called by Moodle.
 
const MOODLE_OFFICIAL_MOBILE_SERVICE 'moodle_mobile_app'
 Moodle mobile app service name.
 
trait moodle_read_slave_trait
 Trait to wrap connect() method of database driver classes that gives ability to use read only slave instances for SELECT queries.
 
const MUST_EXIST 2
 Indicates exactly one record must exist.
 
const NAVIGATION_CACHE_NAME 'navigation'
 The name that will be used to separate the navigation cache within SESSION.
 
const NAVIGATION_SITE_ADMIN_CACHE_NAME 'navigationsiteadmin'
 
const NO_CUSTOM_CHECK_FOUND 12
 XML Processing Error.
 
const NO_DATABASE_SECTION_FOUND 2
 XML Processing Error.
 
const NO_DATABASE_VENDOR_MYSQL_FOUND 4
 XML Processing Error.
 
const NO_DATABASE_VENDOR_POSTGRES_FOUND 5
 XML Processing Error.
 
const NO_DATABASE_VENDOR_VERSION_FOUND 10
 XML Processing Error.
 
const NO_DATABASE_VENDORS_FOUND 3
 XML Processing Error.
 
const NO_ERROR 0
 Add required files.
 
const NO_MOODLE_COOKIES true
 
const NO_PHP_EXTENSIONS_NAME_FOUND 9
 XML Processing Error.
 
const NO_PHP_EXTENSIONS_SECTION_FOUND 8
 XML Processing Error.
 
const NO_PHP_SECTION_FOUND 6
 XML Processing Error.
 
const NO_PHP_SETTINGS_NAME_FOUND 15
 XML Processing Error.
 
const NO_PHP_VERSION_FOUND 7
 XML Processing Error.
 
const NO_UNICODE_SECTION_FOUND 11
 XML Processing Error.
 
const NO_VERSION_DATA_FOUND 1
 XML Processing Error.
 
if not
 
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 OPEN_BADGES_V1 1
 
const OPEN_BADGES_V2 2
 
const OPEN_BADGES_V2_CONTEXT 'https://w3id.org/openbadges/v2'
 
const OPEN_BADGES_V2_TYPE_ASSERTION 'Assertion'
 
const OPEN_BADGES_V2_TYPE_AUTHOR 'Author'
 
const OPEN_BADGES_V2_TYPE_BADGE 'BadgeClass'
 
const OPEN_BADGES_V2_TYPE_ENDORSEMENT 'Endorsement'
 
const OPEN_BADGES_V2_TYPE_ISSUER 'Issuer'
 
const OPEN_BADGES_V2P1 2.1
 
$CFG ostype = (stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin')) ? 'WINDOWS' : 'UNIX'
 
border padding
 
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 PHPUNIT_EXITCODE_CONFIGERROR 135
 
const PHPUNIT_EXITCODE_CONFIGWARNING 136
 
const PHPUNIT_EXITCODE_INSTALL 140
 
const PHPUNIT_EXITCODE_PHPUNITEXTMISSING 131
 
const PHPUNIT_EXITCODE_PHPUNITMISSING 129
 
const PHPUNIT_EXITCODE_PHPUNITWRONG 130
 
const PHPUNIT_EXITCODE_REINSTALL 141
 
const PHPUNIT_TEST false
 
if write to the Free Software Temple Place
 
$config prefix = 'mdl_'
 
const PWRESET_STATUS_ALREADYSENT 4
 
const PWRESET_STATUS_NOEMAILSENT 1
 
const PWRESET_STATUS_OTHEREMAILSENT 3
 
const PWRESET_STATUS_TOKENSENT 2
 
const QUESTION_NUMANS 10
 Constant determines the number of answer boxes supplied in the editing form for multiple choice and similar question types.
 
const QUESTION_NUMANS_ADD 3
 Constant determines the number of answer boxes to add in the editing form for multiple choice and similar question types when the user presses 'add form fields button'.
 
const QUESTION_NUMANS_START 3
 Constant determines the number of answer boxes supplied in the editing form for multiple choice and similar question types to start with, with the option of adding QUESTION_NUMANS_ADD more answers.
 
const RECAPTCHA_API_URL 'https://www.recaptcha.net/recaptcha/api.js'
 The reCAPTCHA URL's.
 
const RECAPTCHA_VERIFY_URL 'https://www.recaptcha.net/recaptcha/api/siteverify'
 
const RENDERER_TARGET_AJAX 'ajax'
 Plain text rendering for Ajax scripts.
 
const RENDERER_TARGET_CLI 'cli'
 Plain text rendering for CLI scripts and cron.
 
const RENDERER_TARGET_GENERAL 'general'
 General rendering target, usually normal browser page.
 
const RENDERER_TARGET_HTMLEMAIL 'htmlemail'
 Rich text html rendering intended for sending via email.
 
const RENDERER_TARGET_MAINTENANCE 'maintenance'
 General rendering target, usually normal browser page, but with limited capacity to avoid API use.
 
const RENDERER_TARGET_TEXTEMAIL 'textemail'
 Plain text rendering intended for sending via email.
 
const RESOURCELIB_DISPLAY_AUTO 0
 Try the best way.
 
const RESOURCELIB_DISPLAY_DOWNLOAD 4
 Force download of file instead of display.
 
const RESOURCELIB_DISPLAY_EMBED 1
 Display using object tag.
 
const RESOURCELIB_DISPLAY_FRAME 2
 Display inside frame.
 
const RESOURCELIB_DISPLAY_NEW 3
 Display normal link in new window.
 
const RESOURCELIB_DISPLAY_OPEN 5
 Open directly.
 
const RESOURCELIB_DISPLAY_POPUP 6
 Open in "emulated" pop-up without navigation.
 
const RESOURCELIB_LEGACYFILES_ACTIVE 2
 Legacy files conversion in progress.
 
const RESOURCELIB_LEGACYFILES_DONE 1
 Legacy files conversion marked as completed.
 
const RESOURCELIB_LEGACYFILES_NO 0
 Legacy files not needed or new resource.
 
font Roboto
 
$CFG running_installer = true
 
font sans serif
 
const SITEID 1
 
font sans font size
 
if(isset($_GET['help'])) if(is_null( $CFG->dataroot)) if($config->stage< INSTALL_WELCOME) if( $config->stage > INSTALL_SAVE) if($config->stage==INSTALL_SAVE) if( $config->stage==INSTALL_DOWNLOADLANG) if($config->stage==INSTALL_DOWNLOADLANG) if( $config->stage==INSTALL_DATABASETYPE) if($config->stage==INSTALL_DOWNLOADLANG) if( $config->stage==INSTALL_DATABASE) if($config->stage==INSTALL_DATABASETYPE) if( $config->stage==INSTALL_ENVIRONMENT or $config->stage==INSTALL_PATHS) if($config->stage==INSTALL_PATHS) $config stage = INSTALL_WELCOME
 
const STATE_BLOCKQUOTE 3
 
const STATE_NONE 1
 #+ state defines
 
const STATE_NOTIKI 5
 
const STATE_PARAGRAPH 2
 
const STATE_PREFORM 4
 
const STATS_MODE_DETAILED 2
 
const STATS_MODE_GENERAL 1
 
const STATS_MODE_RANKED 3
 
const STATS_PLACEHOLDER_OUTPUT '.'
 
const STATS_REPORT_ACTIVE_COURSES 11
 
const STATS_REPORT_ACTIVE_COURSES_WEIGHTED 12
 
const STATS_REPORT_ACTIVITY 4
 
const STATS_REPORT_ACTIVITYBYROLE 5
 
const STATS_REPORT_LOGINS 1
 THESE CONSTANTS ARE USED FOR THE REPORTING PAGE.
 
const STATS_REPORT_PARTICIPATORY_COURSES 13
 
const STATS_REPORT_PARTICIPATORY_COURSES_RW 14
 
const STATS_REPORT_READS 2
 
const STATS_REPORT_USER_ACTIVITY 7
 
const STATS_REPORT_USER_ALLACTIVITY 8
 
const STATS_REPORT_USER_LOGINS 9
 
const STATS_REPORT_USER_VIEW 10
 
const STATS_REPORT_WRITES 3
 
const STATS_TIME_LAST10MONTHS 30
 
const STATS_TIME_LAST11MONTHS 31
 
const STATS_TIME_LAST2MONTHS 12
 
const STATS_TIME_LAST2WEEKS 2
 
const STATS_TIME_LAST3MONTHS 13
 
const STATS_TIME_LAST3WEEKS 3
 
const STATS_TIME_LAST4MONTHS 14
 
const STATS_TIME_LAST4WEEKS 4
 
const STATS_TIME_LAST5MONTHS 15
 
const STATS_TIME_LAST6MONTHS 16
 
const STATS_TIME_LAST7MONTHS 27
 
const STATS_TIME_LAST8MONTHS 28
 
const STATS_TIME_LAST9MONTHS 29
 
const STATS_TIME_LASTWEEK 1
 
const STATS_TIME_LASTYEAR 32
 
trait core\hook::stoppable_trait
 
**Library file of miscellaneous general purpose LDAP functions and *data structures
 
if write to the Free Software Temple Suite
 
const TABLE_P_BOTTOM 2
 
const TABLE_P_TOP 1
 #-
 
const TABLE_SHOW_ALL_PAGE_SIZE 5000
 #-
 
const TABLE_VAR_DIR 8
 
const TABLE_VAR_HIDE 2
 
const TABLE_VAR_IFIRST 4
 
const TABLE_VAR_ILAST 5
 
const TABLE_VAR_PAGE 6
 
const TABLE_VAR_RESET 7
 
const TABLE_VAR_SHOW 3
 
const TABLE_VAR_SORT 1
 #+ These constants relate to the table's handling of URL parameters.
 
const TAG_MAX_LENGTH 50
 To prevent problems with multibytes strings,Flag updating in nav not working on the review page.
 
$CFG target_release = $release
 
$CFG tempdir = $CFG->dataroot.'/temp'
 
const TESTING_EXITCODE_COMPOSER 255
 Composer error exit status.
 
const TEXTFILTER_DISABLED -9999
 The states a filter can be in, stored in the filter_active table.
 
const TEXTFILTER_EXCL_SEPARATOR chr(0x1F) . '%' . chr(0x1F)
 Define one exclusive separator that we'll use in the temp saved tags keys.
 
const TEXTFILTER_INHERIT 0
 The states a filter can be in, stored in the filter_active table.
 
const TEXTFILTER_OFF -1
 The states a filter can be in, stored in the filter_active table.
 
const TEXTFILTER_ON 1
 The states a filter can be in, stored in the filter_active table.
 
const TOKEN_DATEFROM "6"
 
const TOKEN_DATETO "7"
 
const TOKEN_EXACT "2"
 
const TOKEN_INSTANCE "8"
 
const TOKEN_META "1"
 
const TOKEN_NEGATE "3"
 
const TOKEN_STRING "4"
 
const TOKEN_TAGS "9"
 
const TOKEN_USER "0"
 Constants for the various types of tokens.
 
const TOKEN_USERID "5"
 
margin top
 
$CFG umaskpermissions = (($CFG->directorypermissions & 0777) ^ 0777)
 
const UPGRADE_LOG_ERROR 2
 UPGRADE_LOG_ERROR = 2.
 
const UPGRADE_LOG_NORMAL 0
 UPGRADE_LOG_NORMAL = 0.
 
const UPGRADE_LOG_NOTICE 1
 UPGRADE_LOG_NOTICE = 1.
 
const URL_MATCH_BASE 0
 A moodle_url comparison using this flag will return true if the base URLs match, params are ignored.
 
const URL_MATCH_EXACT 2
 A moodle_url comparison using this flag will return true if the two URLs are identical, except for the order of the params.
 
const URL_MATCH_PARAMS 1
 A moodle_url comparison using this flag will return true if the base URLs match and the params of url1 are part of url2.
 
const USER_CAN_IGNORE_FILE_SIZE_LIMITS -1
 Indicates the user has the capabilities required to ignore activity and course file size restrictions.
 
const USER_SEARCH_CONTAINS 1
 
const USER_SEARCH_EXACT_MATCH 2
 
const USER_SEARCH_STARTS_WITH (!defined('LASTACCESS_UPDATE_SECS')) 0
 Number of seconds to wait before updating lastaccess information in DB.
 
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.
 
either *version of the or *(at your option) any later version. **This library is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY
 
const WEEKSECS 604800
 Time constant - the number of seconds in a week.
 
font weight
 
max width
 
$CFG wwwroot = install_guess_wwwroot()
 
const YEARSECS 31536000
 Time constant - the number of seconds in a year.
 
 filter_get_name ($filter)
 Look up the name of this filter.
 
 filter_get_all_installed ()
 Get the names of all the filters installed in this Moodle.
 
 filter_set_global_state ($filtername, $state, $move=0)
 Set the global activated state for a text filter.
 
 filter_get_active_state (string $filtername, $contextid=null)
 Returns the active state for a filter in the given context.
 
 filter_is_enabled ($filtername)
 
 filter_get_globally_enabled ()
 Return a list of all the filters that may be in use somewhere.
 
 filter_get_globally_enabled_filters_with_config ()
 Get the globally enabled filters.
 
 filter_get_string_filters ()
 Return the names of the filters that should also be applied to strings (when they are enabled).
 
 filter_set_applies_to_strings ($filter, $applytostrings)
 Sets whether a particular active filter should be applied to all strings by format_string, or just used by format_text.
 
 filter_set_local_state ($filter, $contextid, $state)
 Set the local activated state for a text filter.
 
 filter_set_local_config ($filter, $contextid, $name, $value)
 Set a particular local config variable for a filter in a context.
 
 filter_unset_local_config ($filter, $contextid, $name)
 Remove a particular local config variable for a filter in a context.
 
 filter_get_local_config ($filter, $contextid)
 Get local config variables for a filter in a context.
 
 filter_get_all_local_settings ($contextid)
 This function is for use by backup.
 
 filter_get_active_in_context ($context)
 Get the list of active filters, in the order that they should be used for a particular context, along with any local configuration variables.
 
 filter_preload_activities (course_modinfo $modinfo)
 Preloads the list of active filters for all activities (modules) on the course using two database queries.
 
 filter_get_available_in_context ($context)
 List all of the filters that are available in this context, and what the local and inherited states of that filter are.
 
 filter_get_global_states ()
 This function is for use by the filter administration page.
 
 filter_delete_all_for_filter ($filter)
 Delete all the data in the database relating to a filter, prior to deleting it.
 
 filter_delete_all_for_context ($contextid)
 Delete all the data in the database relating to a context, used when contexts are deleted.
 
 filter_has_global_settings ($filter)
 Does this filter have a global settings page in the admin tree? (The settings page for a filter must be called, for example, filtersettingfiltertex.)
 
 filter_has_local_settings ($filter)
 Does this filter have local (per-context) settings?
 
 filter_context_may_have_filter_settings ($context)
 Certain types of context (block and user) may not have local filter settings.
 
 filter_phrases ($text, $linkarray, $ignoretagsopen=null, $ignoretagsclose=null, $overridedefaultignore=false, $linkarrayalreadyprepared=false)
 Process phrases intelligently found within a HTML text (such as adding links).
 
 filter_prepare_phrases_for_filtering (array $linkarray)
 Prepare a list of link for processing with filter_phrases().
 
 filter_prepare_phrase_for_replacement (filterobject $linkobject)
 Fill in the remaining ->work... fields, that would be needed to replace the phrase.
 
 filter_remove_duplicates ($linkarray)
 Remove duplicate from a list of filterobject.
 
 filter_save_ignore_tags (&$text, $filterignoretagsopen, $filterignoretagsclose, &$ignoretags)
 Extract open/lose tags and their contents to avoid being processed by filters.
 
 filter_save_tags (&$text, &$tags)
 Extract tags (any text enclosed by < and > to avoid being processed by filters.
 
 filter_add_javascript ($text)
 Add missing openpopup javascript to HTML files.
 

Detailed Description

Function Documentation

◆ __construct() [1/3]

filter_manager::__construct ( )
protected

Constructor.

Protected. Use instance() instead.

◆ __construct() [2/3]

filterobject::__construct ( $phrase,
$hreftagbegin = '<span class="highlight">',
$hreftagend = '</span>',
$casesensitive = false,
$fullmatch = false,
$replacementphrase = null,
$replacementcallback = null,
array $replacementcallbackdata = null )

Constructor.

Parameters
string$phrasethis is the phrase that should be matched.
string$hreftagbeginHTML to insert before any match. Default ''.
string$hreftagendHTML to insert after any match. Default ''.
bool$casesensitivewhether the match needs to be case sensitive
bool$fullmatchwhether to match complete words. If true, 'T' won't be matched in 'Tim'.
mixed$replacementphrasereplacement text to go inside begin and end. If not set, the body of the replacement will be the original phrase.
callback$replacementcallbackif set, then this will be called just before $hreftagbegin, $hreftagend and $replacementphrase are needed, so they can be computed only if required. The call made is list($linkobject->hreftagbegin, $linkobject->hreftagend, $linkobject->replacementphrase) = call_user_func_array($linkobject->replacementcallback, $linkobject->replacementcallbackdata); so the return should be an array [$hreftagbegin, $hreftagend, $replacementphrase], the last of which may be null.
array$replacementcallbackdatadata to be passed to $replacementcallback (optional).

◆ __construct() [3/3]

moodle_text_filter::__construct ( $context,
array $localconfig )

Set any context-specific configuration for this filter.

Parameters
context$contextThe current context.
array$localconfigAny context-specific configuration for this filter.

◆ _fix_course_cats()

object _fix_course_cats ( $children,
& $sortorder,
$parent,
$depth,
$path,
& $fixcontexts )

Internal recursive category verification function, do not use directly!

Todo
Document the arguments of this function better

@uses CONTEXT_COURSECAT

Parameters
array$children
int$sortorder
string$parent
int$depth
string$path
array$fixcontexts
Return values
boolif changes were made

◆ _tidy_question()

_tidy_question ( $question,
$category,
array $tagobjects = null,
array $filtercourses = null )

Private function to factor common code out of get_question_options().

Parameters
object$questionthe question to tidy.
stdClass$categoryThe question_categories record for the given $question.
core_tag_tag[] | null$tagobjectsThe tags for the given $question.
stdClass[] | null$filtercoursesThe courses to filter the course tags by.

◆ abort_all_db_transactions()

abort_all_db_transactions ( )

Unconditionally abort all database transactions, this function should be called from exception handlers only.

Return values
void

◆ add_event()

add_event ( )

CALENDAR MANAGEMENT ////////////////////////////////////////////////////////////////.

Deprecated
please use calendar_event\create() instead.

◆ add_indented_names()

add_indented_names ( $categories,
$nochildrenof = -1 )

Format categories into an indented list reflecting the tree structure.

Parameters
array$categoriesAn array of category objects, for example from the.
int$nochildrenof
Return values
arrayThe formatted list of categories.
Deprecated
since Moodle 4.0 MDL-71585
See also
qbank_managecategories\helper
Todo
Final deprecation on Moodle 4.4 MDL-72438

◆ add_mod_to_section()

add_mod_to_section ( )
Deprecated
since 2.4

◆ add_to_config_log()

moodle_database add_to_config_log ( $name,
$oldvalue,
$value,
$plugin )

Add an entry to the config log table.

These are "action" focussed rather than web server hits, and provide a way to easily reconstruct changes to Moodle configuration.

$DB @global stdClass $USER

Parameters
string$nameThe name of the configuration change action For example 'filter_active' when activating or deactivating a filter
string$oldvalueThe config setting's previous value
string$valueThe config setting's new value
string$pluginPlugin name, for example a filter name when changing filter configuration
Return values
void

◆ add_to_log()

add_to_log ( )
Deprecated
since 2.7 use new events instead

◆ address_in_subnet()

address_in_subnet ( $addr,
$subnetstr,
$checkallzeros = false )

Function to check the passed address is within the passed subnet.

The parameter is a comma separated string of subnet definitions. Subnet strings can be in one of three formats: 1: xxx.xxx.xxx.xxx/nn or xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/nnn (number of bits in net mask) 2: xxx.xxx.xxx.xxx-yyy or xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx::xxxx-yyyy (a range of IP addresses in the last group) 3: xxx.xxx or xxx.xxx. or xxx:xxx:xxxx or xxx:xxx:xxxx. (incomplete address, a bit non-technical ;-) Code for type 1 modified from user posted comments by mediator at

Parameters
string$addrThe address you are checking
string$subnetstrThe string of subnet addresses
bool$checkallzerosThe state to whether check for 0.0.0.0
Return values
bool

◆ addslashes_js()

addslashes_js ( $var)

Does proper javascript quoting.

Do not use addslashes anymore, because it does not work when magic_quotes_sybase is enabled.

Parameters
mixed$varString, Array, or Object to add slashes to
Return values
mixedquoted result

◆ admin_apply_default_settings()

admin_apply_default_settings ( ?part_of_admin_tree $node = null,
bool $unconditional = true )

settings utility functions

This function applies default settings recursively.

Because setting the defaults of some settings can enable other settings, this function calls itself repeatedly (max 4 times) until no more new settings are saved.

NOTE: previous "internal" parameters $admindefaultsettings, $settingsoutput were removed in Moodle 4.3.

Parameters
part_of_admin_tree | null$nodeNULL means apply all settings with repeated recursion
bool$unconditionalif true overrides all values with defaults (true for installation, false for CLI upgrade)
Return values
arrayThe names and values of the applied setting defaults

◆ admin_critical_warnings_present()

admin_critical_warnings_present ( )

Test if and critical warnings are present.

Return values
bool

◆ admin_externalpage_setup()

moodle_page admin_externalpage_setup ( $section,
$extrabutton = '',
array $extraurlparams = null,
$actualurl = '',
array $options = array() )

Initialise admin page - this function does require login and permission checks specified in page definition.

This function must be called on each admin page before other code.

$PAGE

Parameters
string$sectionname of page
string$extrabuttonextra HTML that is added after the blocks editing on/off button.
array$extraurlparamsan array paramname => paramvalue, or parameters that need to be added to the turn blocks editing on/off form, so this page reloads correctly.
string$actualurlif the actual page being viewed is not the normal one for this page (e.g. admin/roles/allow.php, instead of admin/roles/manage.php, you can pass the alternate URL here.
array$optionsAdditional options that can be specified for page setup. pagelayout - This option can be used to set a specific pagelyaout, admin is default. nosearch - Do not display search bar

◆ admin_find_write_settings()

admin_find_write_settings ( $node,
$data )

Internal recursive function - finds all settings from submitted form.

Parameters
object$nodeInstance of admin_category, or admin_settingpage
array$data
Return values
array

◆ admin_get_root()

admin_get_root ( $reload = false,
$requirefulltree = true )

Returns the reference to admin tree root.

Return values
objectadmin_root object

◆ admin_mnet_method_get_docblock()

admin_mnet_method_get_docblock ( ReflectionFunctionAbstract $function)

Given some sort of reflection function/method object, return an array of docblock lines, where each line is an array of keywords/descriptions.

Parameters
ReflectionFunctionAbstract$functionreflection function/method object from which to extract information
Return values
arraydocblock converted in to an array

◆ admin_mnet_method_get_help()

admin_mnet_method_get_help ( ReflectionFunctionAbstract $function)

Given some sort of reflection function/method object, return just the help text.

Parameters
ReflectionFunctionAbstract$functionreflection function/method object from which to extract information
Return values
stringdocblock help text

◆ admin_mnet_method_profile()

admin_mnet_method_profile ( ReflectionFunctionAbstract $function)

Given some sort of reflection function/method object, return a profile array, ready to be serialized and stored.

Parameters
ReflectionFunctionAbstract$functionreflection function/method object from which to extract information
Return values
arrayassociative array with function/method information

◆ admin_output_new_settings_by_page()

admin_output_new_settings_by_page ( $node)

Internal function - returns arrays of html pages with uninitialised settings.

Parameters
object$nodeInstance of admin_category or admin_settingpage
Return values
array

◆ admin_search_settings_html()

admin_search_settings_html ( $query)

Internal function - prints the search results.

Parameters
string$queryString to search for
Return values
stringempty or XHTML

◆ admin_write_settings()

admin_write_settings ( $formdata)

Store changed settings, this function updates the errors variable in $ADMIN.

Parameters
object$formdatafrom form
Return values
intnumber of changed settings

◆ ajax_capture_output()

ajax_capture_output ( )

Starts capturing output whilst processing an AJAX request.

This should be used in combination with ajax_check_captured_output to report any captured output to the user.

Return values
BooleanReturns true on success or false on failure.

◆ ajax_check_captured_output()

ajax_check_captured_output ( )

Check captured output for content.

If the site has a debug level of debugdeveloper set, and the content is non-empty, then throw a coding exception which can be captured by the Y.IO request and displayed to the user.

Return values
Anyoutput that was captured.

◆ ajaxenabled()

ajaxenabled ( )
Deprecated
since 2.7 MDL-33099/MDL-44088 - please do not use this function any more.

◆ allow_assign()

allow_assign ( )

◆ allow_override()

allow_override ( )

◆ allow_switch()

allow_switch ( )

◆ any_new_admin_settings()

any_new_admin_settings ( $node)

Based on find_new_settings() in upgradesettings.php Looks to find any admin settings that have not been initialized.

Returns 1 if it finds any.

Parameters
object$nodeInstance of admin_category, or admin_settingpage
Return values
booleantrue if any settings haven't been initialised, false if they all have

◆ apply_filter_chain()

filter_manager::apply_filter_chain ( $text,
$filterchain,
array $options = array(),
array $skipfilters = null )
protected

Apply a list of filters to some content.

Parameters
string$text
moodle_text_filter[]$filterchainarray filter name => filter object.
array$optionsoptions passed to the filters.
array$skipfiltersof filter names. Any filters that should not be applied to this text.
Return values
string\$text

◆ array_is_nested()

array_is_nested ( $array)

Check if there is a nested array within the passed array.

Parameters
array$array
Return values
booltrue if there is a nested array false otherwise

◆ authenticate_user_login()

authenticate_user_login ( $username,
$password,
$ignorelockout = false,
& $failurereason = null,
$logintoken = false,
string|bool $loginrecaptcha = false )

Authenticates a user against the chosen authentication mechanism.

Given a username and password, this function looks them up using the currently selected authentication mechanism, and if the authentication is successful, it returns a valid $user object from the 'user' table.

Uses auth_ functions from the currently active auth module

After authenticate_user_login() returns success, you will need to log that the user has logged in, and call complete_user_login() to set the session up.

Note: this function works only with non-mnet accounts!

Parameters
string$usernameUser's username (or also email if $CFG->authloginviaemail enabled)
string$passwordUser's password
bool$ignorelockoutuseful when guessing is prevented by other mechanism such as captcha or SSO
int$failurereasonlogin failure reason, can be used in renderers (it may disclose if account exists)
string | bool$logintokenIf this is set to a string it is validated against the login token for the session.
string | bool$loginrecaptchaIf this is set to a string it is validated against Google reCaptcha.
Return values
stdClass|falseA $USER object or false if error

◆ badge_assemble_notification()

badge_assemble_notification ( stdClass $badge)

Creates single message for all notification and sends it out.

Parameters
object$badgeA badge which is notified about.

◆ badge_award_criteria_competency_has_records_for_competencies()

badge_award_criteria_competency_has_records_for_competencies ( $competencyids)

Check if any badge has records for competencies.

Parameters
array$competencyidsArray of competencies ids.
Return values
booleanReturn true if competencies were found in any badge.

◆ badge_message_from_template()

badge_message_from_template ( $message,
$params )

Replaces variables in a message template and returns text ready to be emailed to a user.

Parameters
string$messageMessage body.
Return values
stringMessage with replaced values

◆ badges_add_course_navigation()

badges_add_course_navigation ( navigation_node $coursenode,
stdClass $course )

Extends the course administration navigation with the Badges page.

Parameters
navigation_node$coursenode
object$course

◆ badges_award_handle_manual_criteria_review()

badges_award_handle_manual_criteria_review ( stdClass $data)

Triggered when badge is manually awarded.

Parameters
object$data
Return values
boolean

◆ badges_bake()

badges_bake ( $hash,
$badgeid,
$userid = 0,
$pathhash = false )

Bake issued badge.

Parameters
string$hashUnique hash of an issued badge.
int$badgeidID of the original badge.
int$useridID of badge recipient (optional).
boolean$pathhashReturn file pathhash instead of image url (optional).
Return values
string|urlReturns either new file path hash or new file URL

◆ badges_calculate_message_schedule()

badges_calculate_message_schedule ( $schedule)

Caclulates date for the next message digest to badge creators.

Parameters
in$scheduleType of message schedule BADGE_MESSAGE_DAILY|BADGE_MESSAGE_WEEKLY|BADGE_MESSAGE_MONTHLY.
Return values
intTimestamp for next cron

◆ badges_change_sortorder_backpacks()

badges_change_sortorder_backpacks ( int $backpackid,
int $direction )

Moves the backpack in the list one position up or down.

Parameters
int$backpackidThe backpack identifier to be moved.
int$directionThe direction (BACKPACK_MOVE_UP/BACKPACK_MOVE_DOWN) where to move the backpack.
Exceptions
moodle_exceptionif attempting to use invalid direction value.

◆ badges_check_backpack_accessibility()

badges_check_backpack_accessibility ( )
Deprecated
Since Moodle 3.11.

◆ badges_create_site_backpack()

badges_create_site_backpack ( $data)

Create the site backpack with this data.

Parameters
stdClass$dataThe new backpack data.
Return values
boolean

◆ badges_delete_site_backpack()

badges_delete_site_backpack ( $id)

Delete the backpack with this id.

Parameters
integer$idThe backpack to delete.
Return values
boolean

◆ badges_disconnect_user_backpack()

badges_disconnect_user_backpack ( $userid)

Disconnect from the user backpack by deleting the user preferences.

Parameters
integer$useridThe user to diconnect.
Return values
boolean

◆ badges_download()

badges_download ( $userid)

Download all user badges in zip archive.

Parameters
int$useridID of badge owner.

◆ badges_external_create_mapping()

badges_external_create_mapping ( $sitebackpackid,
$type,
$internalid,
$externalid )

Save the info about which objects we connected with a backpack before.

Parameters
integer$sitebackpackidThe site backpack to connect to.
string$typeThe type of this remote object.
string$internalidThe id for this object on the Moodle site.
string$externalidThe id of this object on the remote site.
Return values
boolean

◆ badges_external_delete_mapping()

badges_external_delete_mapping ( $sitebackpackid,
$type,
$internalid )

Delete a specific external mapping information for a backpack.

Parameters
integer$sitebackpackidThe site backpack to connect to.
string$typeThe type of this remote object.
string$internalidThe id for this object on the Moodle site.
Return values
boolean

◆ badges_external_delete_mappings()

badges_external_delete_mappings ( $sitebackpackid)

Delete all external mapping information for a backpack.

Parameters
integer$sitebackpackidThe site backpack to connect to.
Return values
boolean

◆ badges_external_get_mapping()

badges_external_get_mapping ( $sitebackpackid,
$type,
$internalid,
$param = 'externalid' )

Used to remember which objects we connected with a backpack before.

Parameters
integer$sitebackpackidThe site backpack to connect to.
string$typeThe type of this remote object.
string$internalidThe id for this object on the Moodle site.
string$paramThe param we need to return. Defaults to the externalid.
Return values
mixedThe id or false if it doesn't exist.

◆ badges_generate_badgr_open_url()

badges_generate_badgr_open_url ( $backpack,
$type,
$externalid )

Generate a public badgr URL that conforms to OBv2.

This is done because badgr responses do not currently conform to the spec.

WARNING: This is an extremely hacky way of implementing this and should be removed once the standards are conformed to.

Parameters
stdClass$backpackThe Badgr backpack we are pushing to
string$typeThe type of object we are dealing with either Issuer, Assertion OR Badge.
string$externalidThe externalid as provided by the backpack
Return values
stringThe public URL to access Badgr objects

◆ badges_get_badge_api_versions()

badges_get_badge_api_versions ( )

List the supported badges api versions.

Return values
array(version)

◆ badges_get_badge_by_hash()

badges_get_badge_by_hash ( string $hash)

Get badge by hash.

Parameters
string$hash
Return values
object|bool

◆ badges_get_badges()

badges_get_badges ( $type,
$courseid = 0,
$sort = '',
$dir = '',
$page = 0,
$perpage = BADGE_PERPAGE,
$user = 0 )

Get all badges.

Parameters
intType of badges to return
intCourse ID for course badges
string$sortAn SQL field to sort by
string$dirThe sort direction ASC|DESC
int$pageThe page or records to return
int$perpageThe number of records to return per page
int$userUser specific search
Return values
array\$badgeArray of records matching criteria

◆ badges_get_default_issuer()

badges_get_default_issuer ( )

Get the default issuer for a badge from this site.

Return values
array

◆ badges_get_issued_badge_info()

badges_get_issued_badge_info ( )
Deprecated
since Moodle 2.6

◆ badges_get_oauth2_service_options()

badges_get_oauth2_service_options ( )

Get OAuth2 services for the external backpack.

Return values
array
Exceptions
coding_exception
Deprecated
since 4.3.

◆ badges_get_site_backpack()

badges_get_site_backpack ( $id,
int $userid = 0 )

Get a site backpacks by id for a particular user or site (if userid is 0)

Parameters
int$idThe backpack id.
int$useridThe owner of the backpack, 0 if it's a sitewide backpack else a user's site backpack
Return values
stdClass

◆ badges_get_site_backpacks()

badges_get_site_backpacks ( )

List the backpacks at site level.

Return values
array(stdClass)

◆ badges_get_site_primary_backpack()

badges_get_site_primary_backpack ( )

Get the primary backpack for the site.

Return values
stdClass

◆ badges_get_user_backpack()

badges_get_user_backpack ( ?int $userid = 0)

Get the user backpack for the currently logged in user OR the provided user.

Parameters
int | null$useridThe user whose backpack you're requesting for. If null, get the logged in user's backpack
Return values
mixedThe user's backpack or none.
Exceptions
dml_exception

◆ badges_get_user_badges()

badges_get_user_badges ( $userid,
$courseid = 0,
$page = 0,
$perpage = 0,
$search = '',
$onlypublic = false )

Get badges for a specific user.

Parameters
int$useridUser ID
int$courseidBadges earned by a user in a specific course
int$pageThe page or records to return
int$perpageThe number of records to return per page
string$searchA simple string to search for
bool$onlypublicReturn only public badges
Return values
arrayof badges ordered by decreasing date of issue

◆ badges_handle_course_deletion()

badges_handle_course_deletion ( $courseid)

Handles what happens to the course badges when a course is deleted.

Parameters
int$courseidcourse ID.
Return values
void.

◆ badges_list_criteria()

badges_list_criteria ( $enabled = true)

Return all the enabled criteria types for this site.

Parameters
boolean$enabled
Return values
array

◆ badges_local_backpack_js()

badges_local_backpack_js ( )
Deprecated
Since Moodle 3.11.

◆ badges_notify_badge_award()

badges_notify_badge_award ( badge $badge,
$userid,
$issued,
$filepathhash )

Sends notifications to users about awarded badges.

Parameters
core_badges\badge$badgeBadge that was issued
int$useridRecipient ID
string$issuedUnique hash of an issued badge
string$filepathhashFile path hash of an issued badge for attachments

◆ badges_open_badges_backpack_api()

badges_open_badges_backpack_api ( ?int $backpackid = null)

Is any backpack enabled that supports open badges V1?

Parameters
int | null$backpackidCheck the version of the given id OR if null the sitewide backpack
Return values
boolean

◆ badges_prepare_badge_for_external()

badges_prepare_badge_for_external ( stdClass $badge,
stdClass $user )

Update badge instance to external functions.

Parameters
stdClass$badge
stdClass$user
Return values
object

◆ badges_process_badge_image()

badges_process_badge_image ( badge $badge,
$iconfile )

Process badge image from form data.

Parameters
badge$badgeBadge object
string$iconfileOriginal file

◆ badges_save_backpack_credentials()

badges_save_backpack_credentials ( stdClass $data)

Create a backpack with the provided details.

Stores the auth details of the backpack

Parameters
stdClass$dataBackpack specific data.
Return values
intThe id of the external backpack that the credentials correspond to

◆ badges_save_external_backpack()

badges_save_external_backpack ( stdClass $data)

Perform the actual create/update of external bakpacks.

Any checks on the validity of the id will need to be performed before it reaches this function.

Parameters
stdClass$dataThe backpack data we are updating/inserting
Return values
intReturns the id of the new/updated record

◆ badges_send_verification_email()

badges_send_verification_email ( $email,
$backpackid,
$backpackpassword )

Create and send a verification email to the email address supplied.

Since we're not sending this email to a user, email_to_user can't be used but this function borrows largely the code from that process.

Parameters
string$emailthe email address to send the verification email to.
int$backpackidthe id of the backpack to connect to
string$backpackpasswordthe user entered password to connect to this backpack
Return values
trueif the email was sent successfully, false otherwise.

◆ badges_setup_backpack_js()

badges_setup_backpack_js ( )
Deprecated
Since Moodle 3.11.

◆ badges_update_site_backpack()

badges_update_site_backpack ( $id,
$data )

Update the backpack with this id.

Parameters
integer$idThe backpack to edit
stdClass$dataThe new backpack data.
Return values
boolean

◆ badges_user_has_backpack()

badges_user_has_backpack ( $userid)

Checks if user has external backpack connected.

Parameters
int$useridID of a user.
Return values
boolTrue|False whether backpack connection exists.

◆ badges_verify_backpack()

badges_verify_backpack ( int $backpackid)

Attempt to authenticate with a backpack credentials and return an error if the authentication fails.

If external backpacks are not enabled or the backpack version is different from OBv2, this will not perform any test.

Parameters
int$backpackidBackpack identifier to verify.
Return values
stringThe result of the verification process.

◆ badges_verify_site_backpack()

badges_verify_site_backpack ( )

Attempt to authenticate with the site backpack credentials and return an error if the authentication fails.

If external backpacks are not enabled, this will not perform any test.

Return values
string

◆ behat_check_config_vars()

behat_check_config_vars ( )

Checks that the behat config vars are properly set.

Return values
voidStops execution with error code if something goes wrong.

◆ behat_clean_init_config()

behat_clean_init_config ( )

Restrict the config.php settings allowed.

When running the behat features the config.php settings should not affect the results.

Return values
void

◆ behat_error()

behat_error ( $errorcode,
$text = '' )

Exits with an error code.

Parameters
mixed$errorcode
string$text
Return values
voidStops execution with error code

◆ behat_error_handler()

behat_error_handler ( $errno,
$errstr,
$errfile,
$errline )

PHP errors handler to use when running behat tests.

Adds specific CSS classes to identify the messages.

Parameters
int$errno
string$errstr
string$errfile
int$errline
Return values
bool

◆ behat_get_command_flags()

behat_get_command_flags ( string $option,
$value )

Get command flags for an option/value combination.

Parameters
string$option
string | bool | null$value
Return values
string

◆ behat_get_error_string()

behat_get_error_string ( $errtype)

Return logical error string.

Parameters
int$errtypephp error type.
Return values
stringstring which will be returned.

◆ behat_get_run_process()

behat_get_run_process ( )

Get behat run process from either $_SERVER or command config.

Return values
bool|intfalse if single run, else run process number.

◆ behat_get_shutdown_process_errors()

behat_get_shutdown_process_errors ( )

Return php errors save which were save during shutdown.

Return values
array

◆ behat_is_requested_url()

behat_is_requested_url ( $url)

Checks if the URL requested by the user matches the provided argument.

Parameters
string$url
Return values
boolReturns true if it matches.

◆ behat_is_test_site()

behat_is_test_site ( )

Should we switch to the test site data?

Return values
bool

◆ behat_update_vars_for_process()

behat_update_vars_for_process ( )

Fix variables for parallel behat testing.

  • behat_wwwroot = behat_wwwroot{behatrunprocess}
  • behat_dataroot = behat_dataroot{behatrunprocess}
  • behat_prefix = behat_prefix.{behatrunprocess}_ (For oracle it will be firstletter of prefix and behatrunprocess)

◆ block_add_block_ui()

block_add_block_ui ( $page,
$output )

Functions update the blocks if required by the request parameters ==========.

Return a block_contents representing the add a new block UI, if this user is allowed to see it.

Return values
block_contentsan appropriate block_contents, or null if the user cannot add any blocks here.

◆ block_instance()

block_instance ( $blockname,
$instance = NULL,
$page = NULL )

Creates a new instance of the specified block class.

Parameters
string$blocknamethe name of the block.
stdClass$instanceblock_instances DB table row (optional).
moodle_page$pagethe page this block is appearing on.
Return values
block_basethe requested block instance.

◆ block_instance_by_id()

block_instance_by_id ( $blockinstanceid)

Returns a new instance of the specified block instance id.

Parameters
int$blockinstanceid
Return values
block_basethe requested block instance.

◆ block_load_class()

block_load_class ( $blockname)

Load the block class for a particular type of block.

Parameters
string$blocknamethe name of the block.
Return values
booleansuccess or failure.

◆ block_method_result()

block_method_result ( $blockname,
$method,
$param = NULL )

Helper functions for working with block classes ============================.

Call a class method (one that does not require a block instance) on a block class.

Parameters
string$blocknamethe name of the block.
string$methodthe method name.
array$paramparameters to pass to the method.
Return values
mixedwhatever the method returns.

◆ blocks_add_default_course_blocks()

blocks_add_default_course_blocks ( $course)

Add the default blocks to a course.

Parameters
object$coursea course object.

◆ blocks_add_default_system_blocks()

blocks_add_default_system_blocks ( )

Add the default system-context blocks.

E.g. the admin tree.

◆ blocks_delete_all_for_context()

blocks_delete_all_for_context ( $contextid)

Delete all the blocks that belong to a particular context.

Parameters
int$contextidthe context id.

◆ blocks_delete_instance()

blocks_delete_instance ( $instance,
$nolongerused = false,
$skipblockstables = false )

Delete a block, and associated data.

Parameters
object$instancea row from the block_instances table
bool$nolongerusedlegacy parameter. Not used, but kept for backwards compatibility.
bool$skipblockstablesfor internal use only. Makes
See also
blocks_delete_all_for_context() more efficient.

◆ blocks_delete_instances()

blocks_delete_instances ( $instanceids)

Delete multiple blocks at once.

Parameters
array$instanceidsA list of block instance ID.

◆ blocks_find_block()

blocks_find_block ( $blockid,
$blocksarray )

Find a given block by its blockid within a provide array.

Parameters
int$blockid
array$blocksarray
Return values
bool|objectInstance if found else false

◆ blocks_get_default_site_course_blocks()

blocks_get_default_site_course_blocks ( )
Return values
arraythe blocks that should be added to the site course by default.

◆ blocks_get_record()

blocks_get_record ( $blockid = NULL,
$notusedanymore = false )

Get the block record for a particular blockid - that is, a particular type os block.

Parameters
$intblockid block type id. If null, an array of all block types is returned.
bool$notusedanymoreNo longer used.
Return values
array|objectrow from block table, or all rows.

◆ blocks_name_allowed_in_format()

blocks_name_allowed_in_format ( $name,
$pageformat )

Check that a given name is in a permittable format.

Parameters
string$name
string$pageformat
Return values
bool

◆ blocks_parse_default_blocks_list()

blocks_parse_default_blocks_list ( $blocksstr)

Parse a list of default blocks.

See config-dist for a description of the format.

Parameters
string$blocksstrDetermines the starting point that the blocks are added in the region.
Return values
arraythe parsed list of default blocks

◆ blocks_remove_inappropriate()

blocks_remove_inappropriate ( $course)

Actually delete from the database any blocks that are currently on this page, but which should not be there according to blocks_name_allowed_in_format.

Todo
Write/Fix this function. Currently returns immediately
Parameters
$course

◆ blocks_set_visibility()

blocks_set_visibility ( $instance,
$page,
$newvisibility )

Set a block to be visible or hidden on a particular page.

Parameters
object$instancea row from the block_instances, preferably LEFT JOINed with the block_positions table as return by block_manager.
moodle_page$pagethe back to set the visibility with respect to.
integer$newvisibility1 for visible, 0 for hidden.

◆ blog_get_context_url()

blog_get_context_url ( )
Deprecated
since Moodle 2.5 MDL-27814 - please do not use this function any more.

◆ bounded_number()

bounded_number ( $min,
$value,
$max )

Used to make sure that $min <= $value <= $max.

Make sure that value is between min, and max

Parameters
int$minThe minimum value
int$valueThe value to check
int$maxThe maximum value
Return values
int

◆ break_up_long_words()

break_up_long_words ( $string,
$maxsize = 20,
$cutchar = ' ' )

Given some normal text this function will break up any long words to a given size by inserting the given character.

It's multibyte savvy and doesn't change anything inside html tags.

Parameters
string$stringthe string to be modified
int$maxsizemaximum length of the string to be returned
string$cutcharthe string used to represent word breaks
Return values
string

◆ build_context_path()

build_context_path ( )
Deprecated
since 2.2

◆ build_logs_array()

build_logs_array ( )
Deprecated
since Moodle 3.2

◆ build_navigation()

build_navigation ( )
Deprecated
Please use $PAGE->navabar methods instead.

◆ calculate_entropy()

calculate_entropy ( # string $pepper[\SensitiveParameter])

Calculate the Shannon entropy of a string.

Parameters
string$pepperThe pepper to calculate the entropy of.
Return values
floatThe Shannon entropy of the string.

◆ calculate_user_dst_table()

calculate_user_dst_table ( )
Deprecated
since Moodle 2.9

◆ calendar_cron()

calendar_cron ( )
Deprecated
since 3.3

◆ calendar_get_all_allowed_types()

calendar_get_all_allowed_types ( )
Deprecated
since 3.6

◆ calendar_get_block_upcoming()

calendar_get_block_upcoming ( )
Deprecated
since 3.3

◆ calendar_get_mini()

calendar_get_mini ( )

◆ calendar_get_upcoming()

calendar_get_upcoming ( )

◆ calendar_import_icalendar_events()

calendar_import_icalendar_events ( $ical,
$unused = null,
$subscriptionid = null )

Import events from an iCalendar object into a course calendar.

Parameters
iCalendar$icalThe iCalendar object.
int$unusedDeprecated
int$subscriptionidThe subscription ID.
Return values
stringA log of the import progress, including errors.

◆ calendar_normalize_tz()

calendar_normalize_tz ( )
Deprecated
since Moodle 2.9

◆ calendar_preferences_button()

calendar_preferences_button ( )
Deprecated
since Moodle 3.2

◆ calendar_print_month_selector()

calendar_print_month_selector ( )
Deprecated
since 3.3

◆ calendar_process_subscription_row()

calendar_process_subscription_row ( $subscriptionid,
$pollinterval,
$action )

Update a subscription from the form data in one of the rows in the existing subscriptions table.

Parameters
int$subscriptionidThe ID of the subscription we are acting upon.
int$pollintervalThe poll interval to use.
int$actionThe action to be performed. One of update or remove.
Exceptions
dml_exceptionif invalid subscriptionid is provided
Return values
stringA log of the import progress, including errors
Deprecated
since Moodle 4.0 MDL-71953

◆ calendar_wday_name()

calendar_wday_name ( )
Deprecated
since 3.3

◆ can_send_from_real_email_address()

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.

Parameters
object$fromThe user object for the user we are sending the email from.
object$userThe user object that we are sending the email to.
array$unusedNo longer used.
Return values
boolReturns true if we can use the from user's email adress in the "From" field.

◆ can_use_html_editor()

can_use_html_editor ( )
Deprecated
since 2.6

◆ can_use_readonly()

can_use_readonly ( int $type,
string $sql )
protected

Check if The query qualifies for readonly connection execution Logging queries are exempt, those are write operations that circumvent standard query_start/query_end paths.

Parameters
int$typetype of query
string$sql
Return values
bool

◆ can_use_rotated_text()

can_use_rotated_text ( )
Deprecated
since 2.5 - do not use, the textrotate.js will work it out automatically

◆ category_delete_full()

category_delete_full ( )
Deprecated
since 2.5

◆ category_delete_move()

category_delete_move ( )
Deprecated
since 2.5

◆ check_admin_dir_usage()

check_admin_dir_usage ( environment_results $result)

Check whether the admin directory has been configured and warn if so.

The admin directory has been deprecated since Moodle 4.0.

Parameters
environment_results$result
Return values
null|environment_results

◆ check_browser_operating_system()

check_browser_operating_system ( )
Deprecated
since 2.6

◆ check_browser_version()

check_browser_version ( )
Deprecated
since 2.6

◆ check_consecutive_identical_characters()

check_consecutive_identical_characters ( $password,
$maxchars )

Check whether the given password has no more than the specified number of consecutive identical characters.

Parameters
string$passwordpassword to be checked against the password policy
integer$maxcharsmaximum number of consecutive identical characters
Return values
bool

◆ check_database_storage_engine()

check_database_storage_engine ( environment_results $result)

This function verifies that the database is not using an unsupported storage engine.

Parameters
environment_results$resultobject to update, if relevant
Return values
environment_results|nullupdated results object, or null if the storage engine is supported

◆ check_database_tables_row_format()

check_database_tables_row_format ( environment_results $result)

This function verifies if the database has tables using innoDB Antelope row format.

Parameters
environment_results$result
Return values
environment_results|nullupdated results object, or null if no Antelope table has been found.

◆ check_db_prefix_length()

check_db_prefix_length ( environment_results $result)

This function checks that the database prefix ($CFG->prefix) is <= xmldb_table\PREFIX_MAX_LENGTH.

Parameters
environment_results$result
Return values
environment_results|nullupdated results object, or null if the prefix check is passing ok.

◆ check_dir_exists()

check_dir_exists ( $dir,
$create = true,
$recursive = true )

Function to check if a directory exists and by default create it if not exists.

Previously this was accepting paths only from dataroot, but we now allow files outside of dataroot if you supply custom paths for some settings in config.php. This function does not verify that the directory is writable.

NOTE: this function uses current file stat cache, please use clearstatcache() before this if you expect that the directories may have been removed recently from a different request.

Parameters
string$dirabsolute directory path
boolean$createdirectory if does not exist
boolean$recursivecreate directory recursively
Return values
booleantrue if directory exists or created, false otherwise

◆ check_gd_version()

check_gd_version ( )

◆ check_igbinary322_version()

check_igbinary322_version ( environment_results $result)

Check if the igbinary extension installed is buggy one.

There are a few php-igbinary versions that are buggy and return any unserialised array with wrong index. This defeats key() and next() operations on them.

This library is used by MUC and also by memcached and redis when available.

Let's inform if there is some problem when:

  • php 7.2 is being used (php 7.3 and up are immune).
  • the igbinary extension is installed.
  • the version of the extension is between 3.2.2 and 3.2.4.
  • the buggy behaviour is reproduced.
Parameters
environment_results$resultobject to update, if relevant.
Return values
environment_results|nullupdated results or null.

◆ check_is_https()

check_is_https ( environment_results $result)

Check if the site is being served using an ssl url.

Note this does not really perform any request neither looks for proxies or other situations. Just looks to wwwroot and warn if it's not using https.

Parameters
environment_results$result$result
Return values
environment_results|nullupdated results object, or null if the site is https.

◆ check_libcurl_version()

check_libcurl_version ( environment_results $result)

Check if recommended version of libcurl is installed or not.

Parameters
environment_results$resultobject to update, if relevant.
Return values
environment_results|nullupdated results or null.

◆ check_max_input_vars()

check_max_input_vars ( environment_results $result)

Environment check for the php setting max_input_vars.

Parameters
environment_results$result
Return values
environment_results|null

◆ check_mod_assignment()

check_mod_assignment ( environment_results $result)

Check whether the mod_assignment is currently being used.

Parameters
environment_results$result
Return values
environment_results|null

◆ check_moodle_environment()

check_moodle_environment ( $version,
$env_select = ENV_SELECT_NEWER )

This function checks all the requirements defined in environment.xml.

Parameters
string$versionversion to check.
int$env_selectone of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. Default ENV_SELECT_NEWER (BC)
Return values
arraywith two elements. The first element true/false, depending on on whether the check passed. The second element is an array of environment_results objects that has detailed information about the checks and which ones passed.

◆ check_mysql_file_format()

check_mysql_file_format ( environment_results $result)

This function verfies that the database has tables using InnoDB Antelope row format.

Parameters
environment_results$result
Return values
environment_results|nullupdated results object, or null if no Antelope table has been found.

◆ check_mysql_file_per_table()

check_mysql_file_per_table ( environment_results $result)

This function verfies that the database has a setting of one file per table.

This is required for 'utf8mb4'.

Parameters
environment_results$result
Return values
environment_results|nullupdated results object, or null if innodb_file_per_table = 1.

◆ check_mysql_incomplete_unicode_support()

check_mysql_incomplete_unicode_support ( environment_results $result)

This function checks the database to see if it is using incomplete unicode support.

Parameters
environment_results$result$result
Return values
environment_results|nullupdated results object, or null if unicode is fully supported.

◆ check_mysql_large_prefix()

check_mysql_large_prefix ( environment_results $result)

This function verfies that the database has the setting of large prefix enabled.

This is required for 'utf8mb4'.

Parameters
environment_results$result
Return values
environment_results|nullupdated results object, or null if innodb_large_prefix = 1.

◆ check_oracle_usage()

check_oracle_usage ( environment_results $result)

Check whether the Oracle database is currently being used and warn if so.

The Oracle database support will be removed in a future version (4.5) as it is no longer supported by PHP.

Parameters
environment_results$resultobject to update, if relevant
Return values
environment_results|nullupdated results or null if the current database is not Oracle.
See also
https://tracker.moodle.org/browse/MDL-80166 for further information.

◆ check_password_policy()

check_password_policy ( $password,
& $errmsg,
$user = null )

Validate a password against the configured password policy.

Parameters
string$passwordthe password to be checked against the password policy
string$errmsgthe error message to display when the password doesn't comply with the policy.
stdClass$userthe user object to perform password validation against. Defaults to null if not provided.
Return values
booltrue if the password is valid according to the policy. false otherwise.

◆ check_php_version()

check_php_version ( $version = '5.2.4')

Returns true if the current version of PHP is greater that the specified one.

Todo
Check PHP version being required here is it too low?
Parameters
string$versionThe version of php being tested.
Return values
bool

◆ check_sixtyfour_bits()

check_sixtyfour_bits ( environment_results $result)

Check if the site is using 64 bits PHP.

Parameters
environment_results$result
Return values
environment_results|nullupdated results object, or null if the site is using 64 bits PHP.

◆ check_slasharguments()

check_slasharguments ( environment_results $result)

Method used to check the usage of slasharguments config and display a warning message.

Parameters
environment_results$resultobject to update, if relevant.
Return values
environment_results|nullupdated results or null if slasharguments is disabled.

◆ check_tls_libraries()

check_tls_libraries ( environment_results $result)

Checks for up-to-date TLS libraries.

NOTE: this is not currently used, see MDL-57262.

Parameters
environment_results$resultobject to update, if relevant.
Return values
environment_results|nullupdated results or null if unoconv path is not executable.

◆ check_unoconv_version()

check_unoconv_version ( environment_results $result)

Method used to check the installed unoconv version.

Parameters
environment_results$resultobject to update, if relevant.
Return values
environment_results|nullupdated results or null if unoconv path is not executable.

◆ check_upgrade_key()

check_upgrade_key ( $upgradekeyhash)

Assert the upgrade key is provided, if it is defined.

The upgrade key can be defined in the main config.php as $CFG->upgradekey. If it is defined there, then its value must be provided every time the site is being upgraded, regardless the administrator is logged in or not.

This is supposed to be used at certain places in /admin/index.php only.

Parameters
string | null$upgradekeyhashthe SHA-1 of the value provided by the user

◆ check_user_preferences_loaded()

check_user_preferences_loaded ( stdClass $user,
$cachelifetime = 120 )

Refresh user preference cache.

This is used most often for $USER object that is stored in session, but it also helps with performance in cron script.

Preferences for each user are loaded on first use on every page, then again after the timeout expires.

Parameters
stdClass$userUser object. Preferences are preloaded into 'preference' property
int$cachelifetimeCache life time on the current page (in seconds)
Exceptions
coding_exception
Return values
null

◆ check_xmlrpc_usage()

check_xmlrpc_usage ( environment_results $result)

Check whether the XML-RPC protocol is enabled and warn if so.

The XML-RPC protocol will be removed in a future version (4.1) as it is no longer supported by PHP.

See MDL-70889 for further information.

Parameters
environment_results$result
Return values
null|environment_results

◆ choose_from_menu()

choose_from_menu ( )
Deprecated
since Moodle 2.0

◆ clam_change_log()

clam_change_log ( )
Deprecated
since 2.7 - use new file picker instead

◆ clam_handle_infected_file()

clam_handle_infected_file ( )
Deprecated
since 2.7

◆ clam_log_infected()

clam_log_infected ( )
Deprecated
since 2.7 - use new file picker instead

◆ clam_log_upload()

clam_log_upload ( )
Deprecated
since 2.7 - use new file picker instead

◆ clam_message_admins()

clam_message_admins ( )
Deprecated
since Moodle 3.0 - this is a part of clamav plugin now.

◆ clam_replace_infected_file()

clam_replace_infected_file ( )
Deprecated
since 2.7 - infected files are now deleted in file picker

◆ clam_scan_moodle_file()

clam_scan_moodle_file ( )
Deprecated
since 2.7

◆ clean_filename()

clean_filename ( $string)

Cleans a given filename by removing suspicious or troublesome characters.

See also
clean_param()
Parameters
string$stringfile name
Return values
stringcleaned file name

◆ clean_param()

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.

$course->format = clean_param($course->format, PARAM_ALPHA); $selectedgradeitem = clean_param($selectedgradeitem, PARAM_INT);

Parameters
mixed$paramthe variable we are cleaning
string$typeexpected format of param after cleaning.
Return values
mixed
Exceptions
coding_exception

◆ clean_param_array()

clean_param_array ( ?array $param,
$type,
$recursive = false )

Makes sure array contains only the allowed types, this function does not validate array key names!

$options = clean_param($options, PARAM_INT);

Parameters
array | null$paramthe variable array we are cleaning
string$typeexpected format of param after cleaning.
bool$recursiveclean recursive arrays
Return values
array
Exceptions
coding_exception

◆ clean_text()

clean_text ( $text,
$format = FORMAT_HTML,
$options = array() )

Cleans raw text removing nasties.

Given raw text (eg typed in by a user) this function cleans it up and removes any nasty tags that could mess up Moodle pages through XSS attacks.

The result must be used as a HTML text fragment, this function can not cleanup random parts of html tags such as url or src attributes.

NOTE: the format parameter was deprecated because we can safely clean only HTML.

Parameters
string$textThe text to be cleaned
int | string$formatdeprecated parameter, should always contain FORMAT_HTML or FORMAT_MOODLE
array$optionsArray of options; currently only option supported is 'allowid' (if true, does not remove id attributes when cleaning)
Return values
stringThe cleaned up text

◆ cleanremoteaddr()

cleanremoteaddr ( $addr,
$compress = false )

Cleans an ip address.

Internal addresses are now allowed. (Originally local addresses were not allowed.)

Parameters
string$addrIPv4 or IPv6 address
bool$compressuse IPv6 address compression
Return values
stringnormalised ip address string, null if error

◆ cleanup_contexts()

cleanup_contexts ( )
Deprecated
since 2.2

◆ cleardoubleslashes()

cleardoubleslashes ( $path)

Replace 1 or more slashes or backslashes to 1 slash.

Parameters
string$pathThe path to strip
Return values
stringthe path with double slashes removed

◆ cli_error()

cli_error ( $text,
$errorcode = 1 )

Write to standard error output and exit with the given code.

Parameters
string$text
int$errorcode
Return values
void(does not return)

◆ cli_execute_parallel()

cli_execute_parallel ( $cmds,
$cwd = null,
$delay = 0 )

Execute commands in parallel.

Parameters
array$cmdslist of commands to be executed.
string$cwdabsolute path of working directory.
int$delaytime in seconds to add delay between each parallel process.
Return values
arraylist of processes.

◆ cli_get_params()

cli_get_params ( array $longoptions,
array $shortmapping = null )

Returns cli script parameters.

Parameters
array$longoptionsarray of –style options ex:('verbose'=>false)
array$shortmappingarray describing mapping of short to long style options ex:('h'=>'help', 'v'=>'verbose')
Return values
arrayarray of arrays, options, unrecognised as optionlongname=>value

◆ cli_heading()

cli_heading ( $string,
$return = false )

Print or return section heading string.

Parameters
string$stringtext
bool$returnfalse means print, true return as string
Return values
mixedvoid or string

◆ cli_input()

cli_input ( $prompt,
$default = '',
array $options = null,
$casesensitiveoptions = false )

Get input from user.

Parameters
string$prompttext prompt, should include possible options
string$defaultdefault value when enter pressed
array$optionslist of allowed options, empty means any text
bool$casesensitivetrue if options are case sensitive
Return values
stringentered text

◆ cli_logo()

cli_logo ( $padding = 2,
$return = false )

Print an ASCII version of the Moodle logo.

Parameters
int$paddingleft padding of the logo
bool$returnshould we print directly (false) or return the string (true)
Return values
mixedvoid or string

◆ cli_problem()

cli_problem ( $text)

Write error notification.

Parameters
$text
Return values
void

◆ cli_separator()

cli_separator ( $return = false)

Print or return section separator string.

Parameters
bool$returnfalse means print, true return as string
Return values
mixedvoid or string

◆ cli_set_process_title_suffix()

cli_set_process_title_suffix ( string $suffix)

This sets the cli process title suffix.

An example is appending current Task API info so a sysadmin can immediately see what task a cron process is running at any given moment.

Parameters
string$suffixprocess suffix

◆ cli_write()

cli_write ( $text,
$stream = STDOUT )

Write a text to the given stream.

Parameters
string$texttext to be written
resource$streamoutput stream to be written to, defaults to STDOUT

◆ cli_writeln()

cli_writeln ( $text,
$stream = STDOUT )

Write a text followed by an end of line symbol to the given stream.

Parameters
string$texttext to be written
resource$streamoutput stream to be written to, defaults to STDOUT

◆ close_window()

close_window ( $delay = 0,
$reloadopener = false )

Try and close the current window using JavaScript, either immediately, or after a delay.

Echo's out the resulting XHTML & javascript

Parameters
integer$delaya delay in seconds before closing the window. Default 0.
boolean$reloadopenerif true, we will see if this window was a pop-up, and try to reload the parent window before this one closes.

◆ cohort_get_visible_list()

cohort_get_visible_list ( )

◆ commit_delegated_transaction()

commit_delegated_transaction ( moodle_transaction $transaction)

Indicates delegated transaction finished successfully.

Set written times after outermost transaction finished

Parameters
moodle_transaction$transactionThe transaction to commit
Return values
void
Exceptions
dml_transaction_exceptionCreates and throws transaction related exceptions.

◆ complete_user_login()

complete_user_login ( $user,
array $extrauserinfo = [] )

Call to complete the user login process after authenticate_user_login() has succeeded.

It will setup the $USER variable and other required bits and pieces.

NOTE:

  • It will NOT log anything – up to the caller to decide what to log.
  • this function does not set any cookies any more!
Parameters
stdClass$user
array$extrauserinfo
Return values
stdClassA $USER object - BC only, do not use

◆ completion_cron()

completion_cron ( )
Deprecated
since Moodle 3.0 MDL-50287 - please do not use this function any more.

◆ complex_random_string()

complex_random_string ( $length = null)

Generate a complex random string (useful for md5 salts)

This function is based on the above random_string() however it uses a larger pool of characters and generates a string between 24 and 32 characters

Parameters
int$lengthOptional if set generates a string to exactly this length
Return values
string

◆ component_callback()

component_callback ( $component,
$function,
array $params = array(),
$default = null,
bool $migratedtohook = false )

Invoke component's callback functions.

Parameters
string$componentfrankenstyle component name, e.g. 'mod_quiz'
string$functionthe rest of the function name, e.g. 'cron' will end up calling 'mod_quiz_cron'
array$paramsparameters of callback function
mixed$defaultdefault value if callback function hasn't been defined, or if it retursn null.
bool$migratedtohookif true this is a deprecated callback, if hook callback is present then do nothing
Return values
mixed

◆ component_callback_exists()

component_callback_exists ( $component,
$function )

Determine if a component callback exists and return the function name to call.

Note that this function will include the required library files so that the functioname returned can be called directly.

Parameters
string$componentfrankenstyle component name, e.g. 'mod_quiz'
string$functionthe rest of the function name, e.g. 'cron' will end up calling 'mod_quiz_cron'
Return values
mixedComplete function name to call if the callback exists or false if it doesn't.
Exceptions
coding_exceptionif invalid component specfied

◆ component_class_callback()

component_class_callback ( $classname,
$methodname,
array $params,
$default = null )

Call the specified callback method on the provided class.

If the callback returns null, then the default value is returned instead. If the class does not exist, then the default value is returned.

Parameters
string$classnameThe name of the class to call upon.
string$methodnameThe name of the staticically defined method on the class.
array$paramsThe arguments to pass into the method.
mixed$defaultThe default value.
Return values
mixedThe return value.

◆ confirm_sesskey()

confirm_sesskey ( $sesskey = NULL)

Check the sesskey and return true of false for whether it is valid.

(You might like to imagine this function is called sesskey_is_valid().)

Every script that lets the user perform a significant action (that is, changes data in the database) should check the sesskey before doing the action. Depending on your code flow, you may want to use the require_sesskey() helper function.

Parameters
string$sesskeyThe sesskey value to check (optional). Normally leave this blank and this function will do required_param('sesskey', ...).
Return values
boolwhether the sesskey sent in the request matches the one stored in the session.

◆ connect()

connect ( $dbhost,
$dbuser,
$dbpass,
$dbname,
$prefix,
array $dboptions = null )

Connect to db The connection parameters processor that sets up stage for master write and slave readonly handles.

Must be called before other methods.

Parameters
string$dbhostThe database host.
string$dbuserThe database username.
string$dbpassThe database username's password.
string$dbnameThe name of the database being connected to.
mixed$prefixstring means moodle db prefix, false used for external databases where prefix not used
array$dboptionsdriver specific options
Return values
booltrue
Exceptions
dml_connection_exceptionif error

◆ content_to_text()

content_to_text ( $content,
$contentformat )

Converts texts or strings to plain text.

  • When used to convert user input introduced in an editor the text format needs to be passed in $contentformat like we usually do in format_text.
  • When this function is used for strings that are usually passed through format_string before displaying them we need to set $contentformat to false. This will execute html_to_text as these strings can contain multilang tags if multilang filter is applied to headings.
Parameters
string$contentThe text as entered by the user
int | false$contentformatFalse for strings or the text format: FORMAT_MOODLE/FORMAT_HTML/FORMAT_PLAIN/FORMAT_MARKDOWN
Return values
stringPlain text.

◆ context_instance_preload()

context_instance_preload ( )
Deprecated
since 2.2

◆ context_instance_preload_sql()

context_instance_preload_sql ( )
Deprecated
since 2.2

◆ context_moved()

context_moved ( )
Deprecated
since Moodle 2.2

◆ convert_tabrows_to_tree()

convert_tabrows_to_tree ( )
Deprecated
since 2.5

◆ convert_to_array()

convert_to_array ( $var)

Converts an object into an associative array.

This function converts an object into an associative array by iterating over its public properties. Because this function uses the foreach construct, Iterators are respected. It works recursively on arrays of objects. Arrays and simple values are returned as is.

If class has magic properties, it can implement IteratorAggregate and return all available properties in getIterator()

Parameters
mixed$var
Return values
array

◆ convert_tree_to_html()

convert_tree_to_html ( )
Deprecated
since 2.5

◆ core_login_extend_change_password_form()

core_login_extend_change_password_form ( $mform,
$user )

Plugins can extend forms.

Inject form elements into change_password_form.

Parameters
mform$mformthe form to inject elements into.
stdClass$userthe user object to use for context.

◆ core_login_extend_forgot_password_form()

core_login_extend_forgot_password_form ( $mform)

Inject form elements into forgot_password_form.

Parameters
mform$mformthe form to inject elements into.

◆ core_login_extend_set_password_form()

core_login_extend_set_password_form ( $mform,
$user )

Inject form elements into set_password_form.

Parameters
mform$mformthe form to inject elements into.
stdClass$userthe user object to use for context.

◆ core_login_extend_signup_form()

core_login_extend_signup_form ( $mform)

Inject form elements into signup_form.

Parameters
mform$mformthe form to inject elements into.

◆ core_login_generate_password_reset()

core_login_generate_password_reset ( $user)

Create a new record in the database to track a new password set request for user.

Parameters
object$userthe user record, the requester would like a new password set for.
Return values
recordcreated.

◆ core_login_get_return_url()

core_login_get_return_url ( )

Determine where a user should be redirected after they have been logged in.

Return values
stringurl the user should be redirected to.

◆ core_login_post_change_password_requests()

core_login_post_change_password_requests ( $data)

Plugins can perform post submission actions.

Post change_password_form submission actions.

Parameters
stdClass$datathe data object from the submitted form.

◆ core_login_post_forgot_password_requests()

core_login_post_forgot_password_requests ( $data)

Post forgot_password_form submission actions.

Parameters
stdClass$datathe data object from the submitted form.

◆ core_login_post_set_password_requests()

core_login_post_set_password_requests ( $data,
$user )

Post set_password_form submission actions.

Parameters
stdClass$datathe data object from the submitted form.
stdClass$userthe user object for set_password context.

◆ core_login_post_signup_requests()

core_login_post_signup_requests ( $data)

Post signup_form submission actions.

Parameters
stdClass$datathe data object from the submitted form.

◆ core_login_process_password_reset()

core_login_process_password_reset ( $username,
$email )

Process the password reset for the given user (via username or email).

Parameters
string$usernamethe user name
string$emailthe user email
Return values
arrayan array containing fields indicating the reset status, a info notice and redirect URL.
Since
Moodle 3.4

◆ core_login_process_password_reset_request()

core_login_process_password_reset_request ( )

Processes a user's request to set a new password in the event they forgot the old one.

If no user identifier has been supplied, it displays a form where they can submit their identifier. Where they have supplied identifier, the function will check their status, and send email as appropriate.

◆ core_login_process_password_set()

core_login_process_password_set ( $token)

This function processes a user's submitted token to validate the request to set a new password.

If the user's token is validated, they are prompted to set a new password.

Parameters
string$tokenthe one-use identifier which should verify the password reset request as being valid.
Return values
void

◆ core_login_validate_extend_change_password_form()

core_login_validate_extend_change_password_form ( $data,
$user )

Plugins can add additional validation to forms.

Inject validation into change_password_form.

Parameters
array$datathe data array from submitted form values.
stdClass$userthe user object to use for context.
Return values
array\$errorsthe updated array of errors from validation.

◆ core_login_validate_extend_forgot_password_form()

core_login_validate_extend_forgot_password_form ( $data)

Inject validation into forgot_password_form.

Parameters
array$datathe data array from submitted form values.
Return values
array\$errorsthe updated array of errors from validation.

◆ core_login_validate_extend_set_password_form()

core_login_validate_extend_set_password_form ( $data,
$user )

Inject validation into set_password_form.

Parameters
array$datathe data array from submitted form values.
stdClass$userthe user object to use for context.
Return values
array\$errorsthe updated array of errors from validation.

◆ core_login_validate_extend_signup_form()

core_login_validate_extend_signup_form ( $data)

Inject validation into signup_form.

Parameters
array$datathe data array from submitted form values.
Return values
array\$errorsthe updated array of errors from validation.

◆ core_login_validate_forgot_password_data()

core_login_validate_forgot_password_data ( $data)

Validates the forgot password form data.

This is used by the forgot_password_form and by the core_auth_request_password_rest WS.

Parameters
array$dataarray containing the data to be validated (email and username)
Return values
arrayarray of errors compatible with mform
Since
Moodle 3.4

◆ core_myprofile_navigation()

core_myprofile_navigation ( core_user\output\myprofile\tree $tree,
$user,
$iscurrentuser,
$course )

Defines core nodes for my profile navigation tree.

Parameters
core_user\output\myprofile\tree$treeTree object
stdClass$useruser object
bool$iscurrentuseris the user viewing profile, current user ?
stdClass$coursecourse object
Return values
bool

◆ core_question_find_next_unused_idnumber()

core_question_find_next_unused_idnumber ( ?string $oldidnumber,
int $categoryid )

If $oldidnumber ends in some digits then return the next available idnumber of the same form.

So idnum -> null (no digits at the end) idnum0099 -> idnum0100 (if that is unused, else whichever of idnum0101, idnume0102, ... is unused. idnum9 -> idnum10.

Parameters
string | null$oldidnumbera question idnumber, or can be null.
int$categoryida question category id.
Return values
string|nullsuggested new idnumber for a question in that category, or null if one cannot be found.

◆ core_question_question_preview_pluginfile()

core_question_question_preview_pluginfile ( $previewcontext,
$questionid,
$filecontext,
$filecomponent,
$filearea,
$args,
$forcedownload,
$options = [] )

Serve questiontext files in the question text when they are displayed in this report.

Parameters
context$previewcontextthe context in which the preview is happening.
int$questionidthe question id.
context$filecontextthe file (question) context.
string$filecomponentthe component the file belongs to.
string$fileareathe file area.
array$argsremaining file args.
bool$forcedownload
array$optionsadditional options affecting the file serving.

◆ core_tables_exist()

core_tables_exist ( )

Checks if the main tables have been installed yet or not.

Note: we can not use caches here because they might be stale, use with care!

Return values
bool

◆ count_enrolled_users()

count_enrolled_users ( context $context,
$withcapability = '',
$groupids = 0,
$onlyactive = false )

Counts list of users enrolled into course (as per above function)

Parameters
context$context
string$withcapability
int | array$groupidsThe groupids, 0 or [] means all groups and USERSWITHOUTGROUP no group
bool$onlyactiveconsider only active enrolments in enabled plugins and time restrictions
Return values
intnumber of users enrolled into course

◆ count_letters()

count_letters ( $string,
$format = null )

Count letters in a string.

Letters are defined as chars not in tags and different from whitespace.

Parameters
string$stringThe text to be searched for letters. May be HTML.
int | null$format
Return values
intThe count of letters in the specified text.

◆ count_login_failures()

count_login_failures ( )

◆ count_words()

count_words ( $string,
$format = null )

Count words in a string.

Words are defined as things between whitespace.

Parameters
string$stringThe text to be searched for words. May be HTML.
int | null$format
Return values
intThe count of words in the specified string

◆ course_category_hide()

course_category_hide ( )
Deprecated
since 2.5

◆ course_category_show()

course_category_show ( )
Deprecated
since 2.5

◆ course_get_cm_rename_action()

course_get_cm_rename_action ( )
Deprecated
since 3.1

◆ course_scale_used()

course_scale_used ( )
Deprecated
since Moodle 3.1

◆ coursemodule_visible_for_user()

coursemodule_visible_for_user ( )

◆ coursetag_delete_course_tags()

coursetag_delete_course_tags ( )
Deprecated
since 3.0

◆ coursetag_delete_keyword()

coursetag_delete_keyword ( )
Deprecated
since 3.0

◆ coursetag_get_all_tags()

coursetag_get_all_tags ( )
Deprecated
since 3.0

◆ coursetag_get_jscript()

coursetag_get_jscript ( )
Deprecated
since 3.0

◆ coursetag_get_jscript_links()

coursetag_get_jscript_links ( )
Deprecated
since 3.0

◆ coursetag_get_records()

coursetag_get_records ( )
Deprecated
since 3.0

◆ coursetag_get_tagged_courses()

coursetag_get_tagged_courses ( )
Deprecated
since 3.0

◆ coursetag_get_tags()

coursetag_get_tags ( )
Deprecated
since 3.0

◆ coursetag_store_keywords()

coursetag_store_keywords ( )
Deprecated
since 3.0

◆ create_contexts()

create_contexts ( )
Deprecated
since 2.2

◆ create_course_category()

create_course_category ( )
Deprecated
since 2.5

◆ create_user_key()

create_user_key ( $script,
$userid,
$instance = null,
$iprestriction = null,
$validuntil = null )

Creates a new private user access key.

Parameters
string$scriptunique target identifier
int$userid
int$instanceoptional instance id
string$iprestrictionoptional ip restricted access
int$validuntilkey valid only until given data
Return values
stringaccess key value

◆ create_user_record()

create_user_record ( $username,
$password,
$auth = 'manual' )

Creates a bare-bones user record.

Todo
Outline auth types and provide code example
Parameters
string$usernameNew user's username to add to record
string$passwordNew user's password to add to record
string$authForm of authentication required
Return values
stdClassA complete user object

◆ cron_bc_hack_plugin_functions()

cron_bc_hack_plugin_functions ( )
Deprecated
since Moodle 3.9 MDL-52846. Please use new task API.

◆ cron_execute_plugin_type()

cron_execute_plugin_type ( )
Deprecated
since Moodle 3.9 MDL-52846. Please use new task API.

◆ cron_prepare_core_renderer()

cron_prepare_core_renderer ( $restore = false)

Prepare the output renderer for the cron run.

This involves creating a new $PAGE, and $OUTPUT fresh for each task and prevents any one task from influencing any other.

Parameters
bool$restoreWhether to restore the original PAGE and OUTPUT
Deprecated
since 4.2 Use core\cron\prepare_core_renderer() instead.

◆ cron_run()

cron_run ( ?int $keepalive = null)

Execute cron tasks.

Parameters
int | null$keepaliveThe keepalive time for this cron run.
Deprecated
since 4.2 Use core\cron\run_main_process() instead.

◆ cron_run_adhoc_tasks()

cron_run_adhoc_tasks ( int $timenow,
$keepalive = 0,
$checklimits = true )

Execute all queued adhoc tasks, applying necessary concurrency limits and time limits.

Parameters
int$timenowThe time this process started.
int$keepaliveKeep this function alive for N seconds and poll for new adhoc tasks.
bool$checklimitsShould we check limits?
Deprecated
since 4.2 Use core\cron\run_adhoc_tasks() instead.

◆ cron_run_inner_adhoc_task()

cron_run_inner_adhoc_task ( \core\task\adhoc_task $task)

Shared code that handles running of a single adhoc task within the cron.

Parameters
core\task\adhoc_task$task
Deprecated
since 4.2 Use core\cron\run_inner_adhoc_task() instead.

◆ cron_run_inner_scheduled_task()

cron_run_inner_scheduled_task ( \core\task\task_base $task)

Shared code that handles running of a single scheduled task within the cron.

Not intended for calling directly outside of this library!

Parameters
core\task\task_base$task
Deprecated
since 4.2 Use core\cron\run_inner_scheduled_task() instead.

◆ cron_run_scheduled_tasks()

cron_run_scheduled_tasks ( int $timenow)

Execute all queued scheduled tasks, applying necessary concurrency limits and time limits.

Parameters
int$timenowThe time this process started.
Deprecated
since 4.2 Use core\cron\run_scheduled_tasks() instead.

◆ cron_run_single_task()

cron_run_single_task ( )
Deprecated
since Moodle 3.9 MDL-63580. Please use the core\task\manager\run_from_cli($task).

◆ cron_set_process_title()

cron_set_process_title ( string $title)

Sets the process title.

This makes it very easy for a sysadmin to immediately see what task a cron process is running at any given moment.

Parameters
string$titleprocess status title
Deprecated
since 4.2 Use core\cron\set_process_title() instead.

◆ cron_setup_user()

cron_setup_user ( $user = null,
$course = null,
$leavepagealone = false )

Sets up current user and course environment (lang, etc.) in cron.

Do not use outside of cron script!

Parameters
stdClass$userfull user object, null means default cron user (admin), value 'reset' means reset internal static caches.
stdClass$coursefull course record, null means $SITE
bool$leavepagealoneIf specified, stops it messing with global page object
Deprecated
since 4.2. Use core\core\setup_user() instead.
Return values
void

◆ cron_trace_time_and_memory()

cron_trace_time_and_memory ( )

Output some standard information during cron runs.

Specifically current time and memory usage. This method also does gc_collect_cycles() (before displaying memory usage) to try to help PHP manage memory better.

Deprecated
since 4.2 Use core\cron\trace_time_and_memory() instead.

◆ css_is_colour()

css_is_colour ( )
Deprecated
since Moodle 3.2

◆ css_is_width()

css_is_width ( )
Deprecated
since Moodle 3.2

◆ css_minify_css()

css_minify_css ( )
Deprecated
since 2.6

◆ css_send_cached_css()

css_send_cached_css ( $csspath,
$etag )

Sends a cached CSS file.

This function sends the cached CSS file. Remember it is generated on the first request, then optimised/minified, and finally cached for serving.

Parameters
string$csspathThe path to the CSS file we want to serve.
string$etagThe revision to make sure we utilise any caches.

◆ css_send_cached_css_content()

css_send_cached_css_content ( $csscontent,
$etag )

Sends a cached CSS content.

Parameters
string$csscontentThe actual CSS markup.
string$etagThe revision to make sure we utilise any caches.

◆ css_send_temporary_css()

css_send_temporary_css ( $css)

Sends CSS directly and disables all caching.

The Content-Length of the body is also included, but the script is not ended.

Parameters
string$cssThe CSS content to send

◆ css_send_uncached_css()

css_send_uncached_css ( $css)

Sends CSS directly without caching it.

This function takes a raw CSS string, optimises it if required, and then serves it. Turning both themedesignermode and CSS optimiser on at the same time is awful for performance because of the optimiser running here. However it was done so that theme designers could utilise the optimised output during development to help them optimise their CSS... not that they should write lazy CSS.

Parameters
string$css

◆ css_send_unmodified()

css_send_unmodified ( $lastmodified,
$etag )

Send file not modified headers.

Parameters
int$lastmodified
string$etag

◆ css_sort_by_count()

css_sort_by_count ( )
Deprecated
since Moodle 3.2

◆ css_store_css()

if(!defined('THEME_DESIGNER_CACHE_LIFETIME')) css_store_css ( theme_config $theme,
$csspath,
$csscontent )

Stores CSS in a file at the given path.

This function either succeeds or throws an exception.

Parameters
theme_config$themeThe theme that the CSS belongs to.
string$csspathThe path to store the CSS at.
string$csscontentthe complete CSS in one string.

◆ css_write_file()

css_write_file ( $filename,
$content )

Writes a CSS file.

Parameters
string$filename
string$content

◆ current_language()

current_language ( )

Returns the code for the current language.

Return values
string

◆ current_theme()

current_theme ( )
Deprecated
use $PAGE->theme->name instead.

◆ custom_script_path()

custom_script_path ( )

Detect a custom script replacement in the data directory that will replace an existing moodle script.

Return values
string|boolfull path name if a custom script exists, false if no custom script exists

◆ data_submitted()

data_submitted ( )

Determine if there is data waiting to be processed from a form.

Used on most forms in Moodle to check for data Returns the data as an object, if it's found. This object can be used in foreach loops without casting because it's cast to (array) automatically

Checks that submitted POST data exists and returns it as object.

Return values
mixedfalse or object

◆ date_format_string()

date_format_string ( $date,
$format,
$tz = 99 )

Returns a formatted date ensuring it is UTF-8.

If we are running under Windows convert to Windows encoding and then back to UTF-8 (because it's impossible to specify UTF-8 to fetch locale info in Win32).

Parameters
int$datethe timestamp - since Moodle 2.9 this is a real UTC timestamp
string$formatstrftime format.
int | float | string$tzthe user timezone
Return values
stringthe formatted date/time.
Since
Moodle 2.3.3

◆ dayofweek()

dayofweek ( $day,
$month,
$year )

Calculate the position in the week of a specific calendar day.

Parameters
int$dayThe day of the date whose position in the week is sought
int$monthThe month of the date whose position in the week is sought
int$yearThe year of the date whose position in the week is sought
Return values
int

◆ days_in_month()

days_in_month ( $month,
$year )

Calculate the number of days in a given month.

Parameters
int$monthThe month whose day count is sought
int$yearThe year of the month whose day count is sought
Return values
int

◆ db_replace()

db_replace ( $search,
$replace,
$additionalskiptables = '' )

Moved from admin/replace.php so that we can use this in cron.

Parameters
string$searchstring to look for
string$replacestring to replace
Return values
boolsuccess or fail

◆ db_should_replace()

db_should_replace ( $table,
$column = '',
$additionalskiptables = '' )

Given a table and optionally a column name should replaces be done?

Parameters
string$tablename
string$columnname
Return values
boolsuccess or fail

◆ debugging()

debugging ( $message = '',
$level = DEBUG_NORMAL,
$backtrace = null )

Standard Debugging Function.

Returns true if the current site debugging settings are equal or above specified level. If passed a parameter it will emit a debugging notice similar to trigger_error(). The routing of notices is controlled by $CFG->debugdisplay eg use like this:

1) debugging('a normal debug notice'); 2) debugging('something really picky', DEBUG_ALL); 3) debugging('annoying debug message only for developers', DEBUG_DEVELOPER); 4) if (debugging()) { perform extra debugging operations (do not use print or echo) }

In code blocks controlled by debugging() (such as example 4) any output should be routed via debugging() itself, or the lower-level trigger_error() or error_log(). Using echo or print will break XHTML JS and HTTP headers.

It is also possible to define NO_DEBUG_DISPLAY which redirects the message to error_log.

Parameters
string$messagea message to print
int$levelthe level at which this debugging statement should show
array$backtraceuse different backtrace
Return values
bool

◆ decompose_update_into_safe_changes()

decompose_update_into_safe_changes ( array $newvalues,
$unusedvalue )

Helper used by update_field_with_unique_index().

Given a desired set of changes, break them down into single udpates that can be done one at a time without breaking any unique index constraints.

Suppose the input is array(1 => 2, 2 => 1) and -1. Then the output will be array (array(1, -1), array(2, 1), array(-1, 2)). This function solves this problem in the general case, not just for simple swaps. The unit tests give more examples.

Note that, it is the responsibility of the caller to make sure that the requested rename is legal. For example, if you ask for something impossible like array(1 => 2, 2 => 2) then the results are undefined. (You will probably get a unique key violation error from the database later.)

Parameters
array$newvaluesThe desired re-ordering. E.g. array(1 => 4, 2 => 1, 3 => 3, 4 => 2).
int$unusedvalueA value that is not currently used.
Return values
arrayA safe way to perform the re-order. An array of two-element arrays array($from, $to). E.g. array(array(1, -1), array(2, 1), array(4, 2), array(-1, 4)).

◆ dedupe_user_access()

dedupe_user_access ( )
Deprecated
since Moodle 3.4 and removed immediately. MDL-49398.

◆ default_error_handler()

default_error_handler ( $errno,
$errstr,
$errfile,
$errline )

Default error handler, prevents some white screens.

Parameters
int$errno
string$errstr
string$errfile
int$errline
Return values
boolfalse means use default error handler

◆ default_exception_handler()

default_exception_handler ( $ex)

Default exception handler.

Parameters
Exception$ex
Return values
void-does not return. Terminates execution!

◆ default_page_type_list()

default_page_type_list ( $pagetype,
$parentcontext = null,
$currentcontext = null )

Generates a default page type list when a more appropriate callback cannot be decided upon.

Parameters
string$pagetype
stdClass$parentcontext
stdClass$currentcontext
Return values
array

◆ delete_context()

delete_context ( )
Deprecated
since Moodle 2.2

◆ delete_course()

delete_course ( $courseorid,
$showfeedback = true )

Delete a course, including all related data from the database, and any associated files.

Parameters
mixed$courseoridThe id of the course or course object to delete.
bool$showfeedbackWhether to display notifications of each action the function performs.
Return values
booltrue if all the removals succeeded. false if there were any failures. If this method returns false, some of the removals will probably have succeeded, and others failed, but you have no way of knowing which.

◆ delete_course_module()

delete_course_module ( )
Deprecated
since 2.5

◆ delete_event()

delete_event ( )
Deprecated
please use calendar_event->delete() instead.

◆ delete_question_bank_entry()

delete_question_bank_entry ( $entryid)

Check if there is more versions left for the entry.

If not delete the entry.

Parameters
int$entryid

◆ delete_user()

delete_user ( stdClass $user)

Marks user deleted in internal user database and notifies the auth plugin.

Also unenrols user from all roles and does other cleanup.

Any plugin that needs to purge user data should register the 'user_deleted' event.

Parameters
stdClass$userfull user object before delete
Return values
booleansuccess
Exceptions
coding_exceptionif invalid $user parameter detected

◆ delete_user_key()

delete_user_key ( $script,
$userid )

Delete the user's new private user access keys for a particular script.

Parameters
string$scriptunique target identifier
int$userid
Return values
void

◆ detect_munged_arguments()

detect_munged_arguments ( )
Deprecated
use clean_param($string, PARAM_FILE) instead.

◆ display_auth_lock_options()

display_auth_lock_options ( $settings,
$auth,
$userfields,
$helptext,
$mapremotefields,
$updateremotefields,
$customfields = array() )

Helper function used to print locking for auth plugins on admin pages.

Parameters
admin_settingpage$settingsMoodle admin settings instance
string$authauthentication plugin shortname
array$userfieldsuser profile fields
string$helptexthelp text to be displayed at top of form
boolean$mapremotefieldsMap fields or lock only.
boolean$updateremotefieldsAllow remote updates
array$customfieldslist of custom profile fields
Since
Moodle 3.3

◆ display_size()

display_size ( $size,
int $decimalplaces = 1,
string $fixedunits = '' )

Converts bytes into display form.

Parameters
int$sizeThe size to convert to human readable form
int$decimalplacesIf specified, uses fixed number of decimal places
string$fixedunitsIf specified, uses fixed units (e.g. 'KB')
Return values
stringDisplay version of size

◆ dndupload_add_to_course()

dndupload_add_to_course ( $course,
$modnames )

Add the Javascript to enable drag and drop upload to a course page.

Parameters
object$courseThe currently displayed course
array$modnamesThe list of enabled (visible) modules on this site
Return values
void

◆ download_as_dataformat()

download_as_dataformat ( $filename,
$dataformat,
$columns,
$iterator,
$callback = null )

Sends a formated data file to the browser.

@subpackage dataformat

Parameters
string$filenameThe base filename without an extension
string$dataformatA dataformat name
array$columnsAn ordered map of column keys and labels
Iterator$iteratorAn iterator over the records, usually a RecordSet
callable$callbackAn option function applied to each record before writing
Exceptions
coding_exception
Deprecated
since Moodle 3.9 - MDL-68500 please use core\dataformat\download_data

◆ draw_rand_array()

draw_rand_array ( $array,
$draws )

Given an arbitrary array, and a number of draws, this function returns an array with that amount of items.

The indexes are retained.

Todo
Finish documenting this function
Parameters
array$array
int$draws
Return values
array

◆ drop_plugin_tables()

drop_plugin_tables ( $name,
$file,
$feedback = true )

Delete all plugin tables.

Parameters
string$nameName of plugin, used as table prefix
string$filePath to install.xml file
bool$feedbackdefaults to true
Return values
boolAlways returns true

◆ dst_changes_for_year()

dst_changes_for_year ( )
Deprecated
since Moodle 2.9

◆ dst_offset_on()

dst_offset_on ( $time,
$strtimezone = null )

Calculates the Daylight Saving Offset for a given date/time (timestamp)

  • Note: Daylight saving only works for string timezones and not for float.
Parameters
int$timemust NOT be compensated at all, it has to be a pure timestamp
int | float | string$strtimezoneuser timezone
Return values
int

◆ during_initial_install()

during_initial_install ( )

Indicates whether we are in the middle of the initial Moodle install.

Very occasionally it is necessary avoid running certain bits of code before the Moodle installation has completed. The installed flag is set in admin/index.php after Moodle core and all the plugins have been installed, but just before the person doing the initial install is asked to choose the admin password.

Return values
booleantrue if the initial install is not complete.

◆ editors_get_available()

editors_get_available ( )

Get the list of available editors.

Return values
arrayArray ('editorname'=>'localised editor name')

◆ editors_get_enabled()

editors_get_enabled ( )

Returns list of enabled text editors.

Return values
arrayof name=>texteditor

◆ editors_get_preferred_editor()

editors_get_preferred_editor ( $format = NULL)

Returns users preferred editor for given format.

Parameters
int$formattext format or null of none
Return values
texteditorobject

◆ editors_get_preferred_format()

editors_get_preferred_format ( )

Returns users preferred text format.

Return values
intstandard text format

◆ editors_head_setup()

editors_head_setup ( )

Setup all JS and CSS needed for editors.

Return values
void

◆ email_is_not_allowed()

email_is_not_allowed ( $email)

Check that an email is allowed.

It returns an error message if there was a problem.

Parameters
string$emailContent of email
Return values
string|false

◆ email_should_be_diverted()

email_should_be_diverted ( $email)

A helper function to test for email diversion.

Parameters
string$email
Return values
boolReturns true if the email should be diverted

◆ email_to_user()

email_to_user ( $user,
$from,
$subject,
$messagetext,
$messagehtml = '',
$attachment = '',
$attachname = '',
$usetrueaddress = true,
$replyto = '',
$replytoname = '',
$wordwrapwidth = 79 )

Send an email to a specified user.

Parameters
stdClass$userA $USER object
stdClass$fromA $USER object
string$subjectplain text subject line of the email
string$messagetextplain text version of the message
string$messagehtmlcomplete html version of the message (optional)
string$attachmenta file on the filesystem, either relative to $CFG->dataroot or a full path to a file in one of the following directories: $CFG->cachedir, $CFG->dataroot, $CFG->dirroot, $CFG->localcachedir, $CFG->tempdir
string$attachnamethe name of the file (extension indicates MIME)
bool$usetrueaddressdetermines whether $from email address should be sent out. Will be overruled by user profile setting for maildisplay
string$replytoEmail address to reply to
string$replytonameName of reply to recipient
int$wordwrapwidthcustom word wrap width, default 79
Return values
boolReturns true if mail was sent OK and false if there was an error.

◆ endecrypt()

endecrypt ( $pwd,
$data,
$case )

Based on a class by Mukul Sabharwal [mukulsabharwal @ yahoo.com].

Todo
Finish documenting this function
Parameters
string$pwdThe password to use when encrypting or decrypting
string$dataThe data to be decrypted/encrypted
string$caseEither 'de' for decrypt or '' for encrypt
Return values
string

◆ enrol_accessing_via_instance()

enrol_accessing_via_instance ( stdClass $instance)

Is current user accessing course via this enrolment method?

This is intended for operations that are going to affect enrol instances.

Parameters
stdClass$instanceenrol instance
Return values
bool

◆ enrol_add_course_navigation()

enrol_add_course_navigation ( navigation_node $coursenode,
$course )

Add navigation nodes.

Parameters
navigation_node$coursenode
object$course
Return values
void

◆ enrol_calculate_duration()

enrol_calculate_duration ( $timestart,
$timeend )

Calculate duration base on start time and end time.

Parameters
int$timestartTime start
int$timeendTime end
Return values
float|intCalculated duration

◆ enrol_check_plugins()

enrol_check_plugins ( $user,
bool $ignoreintervalcheck = true )

Check all the login enrolment information for the given user object by querying the enrolment plugins This function may be very slow, use only once after log-in or login-as.

Parameters
stdClass$userUser object.
bool$ignoreintervalcheckForce to ignore checking configured sync intervals.
Return values
void

◆ enrol_cohort_can_view_cohort()

enrol_cohort_can_view_cohort ( )

◆ enrol_cohort_enrol_all_users()

enrol_cohort_enrol_all_users ( )
Deprecated
since Moodle 2.8 MDL-35618 this functionality is removed

◆ enrol_cohort_get_cohorts()

enrol_cohort_get_cohorts ( )
Deprecated
since Moodle 2.8 MDL-36014, MDL-35618 this functionality is removed

◆ enrol_cohort_search_cohorts()

enrol_cohort_search_cohorts ( )
Deprecated
since Moodle 2.8 MDL-35618 this functionality is removed

◆ enrol_course_delete()

enrol_course_delete ( $course,
$userid = null )

Called when course is about to be deleted.

If a user id is passed, only enrolments that the user has permission to un-enrol will be removed, otherwise all enrolments in the course will be removed.

Parameters
stdClass$course
int | null$userid
Return values
void

◆ enrol_course_edit_form()

enrol_course_edit_form ( MoodleQuickForm $mform,
$data,
$context )

This function adds necessary enrol plugins UI into the course edit form.

Parameters
MoodleQuickForm$mform
object$datacourse edit form data
object$contextcontext of existing course or parent category if course does not exist
Return values
void

◆ enrol_course_edit_validation()

enrol_course_edit_validation ( array $data,
$context )

Validate course edit form data.

Parameters
array$dataraw form data
object$contextcontext of existing course or parent category if course does not exist
Return values
arrayerrors array

◆ enrol_course_updated()

enrol_course_updated ( $inserted,
$course,
$data )

Update enrol instances after course edit form submission.

Parameters
bool$insertedtrue means new course added, false course already existed
object$course
object$dataform data
Return values
void

◆ enrol_get_all_users_courses()

enrol_get_all_users_courses ( $userid,
$onlyactive = false,
$fields = null,
$sort = null )

Returns list of courses user is enrolled into without performing any capability checks.

The $fields param is a list of field names to ADD so name just the fields you really need, which will be added and uniq'd.

Parameters
int$useridUser whose courses are returned, defaults to the current user.
bool$onlyactiveReturn only active enrolments in courses user may see.
string | array$fieldsExtra fields to be returned (array or comma-separated list).
string | null$sortComma separated list of fields to sort by, defaults to respecting navsortmycoursessort.
Return values
array

◆ enrol_get_course_by_user_enrolment_id()

enrol_get_course_by_user_enrolment_id ( $ueid)

Returns the course where a user enrolment belong to.

Parameters
int$ueiduser_enrolments id
Return values
stdClass

◆ enrol_get_course_description_texts()

enrol_get_course_description_texts ( $course)

Returns course enrolment detailed information.

Parameters
object$course
Return values
arrayof html fragments - can be used to construct lists

◆ enrol_get_course_info_icons()

enrol_get_course_info_icons ( $course,
array $instances = NULL )

Returns course enrolment information icons.

Parameters
object$course
array$instancesenrol instances of this course, improves performance
Return values
arrayof pix_icon

◆ enrol_get_course_users()

enrol_get_course_users ( $courseid = false,
$onlyactive = false,
$usersfilter = [],
$uefilter = [],
$usergroups = [] )

Return all users enrolled in a course.

Parameters
int$courseidCourse id or false if using $uefilter (user enrolment ids may belong to different courses)
bool$onlyactiveconsider only active enrolments in enabled plugins and time restrictions
array$usersfilterLimit the results obtained to this list of user ids. $uefilter compatibility not guaranteed.
array$uefilterLimit the results obtained to this list of user enrolment ids. $usersfilter compatibility not guaranteed.
array$usergroupsLimit the results of users to the ones that belong to one of the submitted group ids.
Return values
stdClass[]

◆ enrol_get_course_users_roles()

enrol_get_course_users_roles ( int $courseid)

Returns list of roles per users into course.

Parameters
int$courseidCourse id.
Return values
arrayArray[$userid][$roleid] = role_assignment.

◆ enrol_get_courses_sortingsql()

enrol_get_courses_sortingsql ( $sort = null)

Returns SQL ORDER arguments which reflect the admin settings to sort my courses.

Parameters
string | null$sortSQL ORDER arguments which were originally requested (optionally).
Return values
stringSQL ORDER arguments.

◆ enrol_get_enrolment_end()

enrol_get_enrolment_end ( $courseid,
$userid )

This function returns the end of current active user enrolment.

It deals correctly with multiple overlapping user enrolments.

Parameters
int$courseid
int$userid
Return values
int|booltimestamp when active enrolment ends, false means no active enrolment now, 0 means never

◆ enrol_get_instances()

enrol_get_instances ( $courseid,
$enabled )

Returns enrolment instances in given course.

Parameters
int$courseid
bool$enabled
Return values
arrayof enrol instances

◆ enrol_get_my_courses()

enrol_get_my_courses ( $fields = null,
$sort = null,
$limit = 0,
$courseids = [],
$allaccessible = false,
$offset = 0,
$excludecourses = [] )

Returns list of courses current $USER is enrolled in and can access.

The $fields param is a list of field names to ADD so name just the fields you really need, which will be added and uniq'd.

If $allaccessible is true, this will additionally return courses that the current user is not enrolled in, but can access because they are open to the user for other reasons (course view permission, currently viewing course as a guest, or course allows guest access without password).

Parameters
string | array$fieldsExtra fields to be returned (array or comma-separated list).
string | null$sortComma separated list of fields to sort by, defaults to respecting navsortmycoursessort. Allowed prefixes for sort fields are: "ul" for the user_lastaccess table, "c" for the courses table, "ue" for the user_enrolments table.
int$limitmax number of courses
array$courseidsthe list of course ids to filter by
bool$allaccessibleInclude courses user is not enrolled in, but can access
int$offsetOffset the result set by this number
array$excludecoursesIDs of hidden courses to exclude from search
Return values
array

◆ enrol_get_period_list()

enrol_get_period_list ( )

Get the list of options for the enrolment period dropdown.

Return values
arrayList of options for the enrolment period dropdown

◆ enrol_get_plugin()

enrol_get_plugin ( $name)

Returns instance of enrol plugin.

Parameters
string$namename of enrol plugin ('manual', 'guest', ...)
Return values
enrol_plugin

◆ enrol_get_plugins()

enrol_get_plugins ( $enabled)

Returns instances of enrol plugins.

Parameters
bool$enabledreturn enabled only
Return values
arrayof enrol plugins name=>instance

◆ enrol_get_shared_courses()

moodle_database enrol_get_shared_courses ( $user1,
$user2,
$preloadcontexts = false,
$checkexistsonly = false )

Returns any courses shared by the two users.

The courses has to be visible and enrolments has to be active, timestart and timeend restrictions are ignored.

$DB

Parameters
stdClass | int$user1
stdClass | int$user2
bool$preloadcontextsIf set to true contexts for the returned courses will be preloaded.
bool$checkexistsonlyIf set to true then this function will return true if the users share any courses and false if not.
Return values
array|boolAn array of courses that both users are enrolled in OR if $checkexistsonly set returns true if the users share any courses and false if not.

◆ enrol_get_users_courses()

enrol_get_users_courses ( $userid,
$onlyactive = false,
$fields = null,
$sort = null )

Returns list of courses user is enrolled into.

Note: Use enrol_get_all_users_courses() if you need the list without any capability checks.

The $fields param is a list of field names to ADD so name just the fields you really need, which will be added and uniq'd.

Parameters
int$useridUser whose courses are returned, defaults to the current user.
bool$onlyactiveReturn only active enrolments in courses user may see.
string | array$fieldsExtra fields to be returned (array or comma-separated list).
string | null$sortComma separated list of fields to sort by, defaults to respecting navsortmycoursessort.
Return values
array

◆ enrol_is_enabled()

enrol_is_enabled ( $enrol)

Checks if a given plugin is in the list of enabled enrolment plugins.

Parameters
string$enrolEnrolment plugin name
Return values
booleanWhether the plugin is enabled

◆ enrol_output_fragment_user_enrolment_form()

enrol_output_fragment_user_enrolment_form ( $args)

Serve the user enrolment form as a fragment.

Parameters
array$argsList of named arguments for the fragment loader.
Return values
string

◆ enrol_selfenrol_available()

enrol_selfenrol_available ( $courseid)

Is there a chance users might self enrol.

Parameters
int$courseid
Return values
bool

◆ enrol_send_welcome_email_options()

enrol_send_welcome_email_options ( )

Send welcome email "from" options.

Return values
arraylist of from options

◆ enrol_sharing_course()

enrol_sharing_course ( $user1,
$user2 )

Do these two students share any course?

The courses has to be visible and enrolments has to be active, timestart and timeend restrictions are ignored.

This function calls {

See also
enrol_get_shared_courses()} setting checkexistsonly to true.
Parameters
stdClass | int$user1
stdClass | int$user2
Return values
bool

◆ enrol_try_internal_enrol()

enrol_try_internal_enrol ( $courseid,
$userid,
$roleid = null,
$timestart = 0,
$timeend = 0 )

Try to enrol user via default internal auth plugin.

For now this is always using the manual enrol plugin...

Parameters
$courseid
$userid
$roleid
$timestart
$timeend
Return values
boolsuccess

◆ enrol_user_delete()

enrol_user_delete ( $user)

Called when user is about to be deleted.

Parameters
object$user
Return values
void

◆ enrol_user_sees_own_courses()

enrol_user_sees_own_courses ( $user = null)

Can user access at least one enrolled course?

Cheat if necessary, but find out as fast as possible!

Parameters
int | stdClass$usernull means use current user
Return values
bool

◆ environment_check()

object environment_check ( $version,
$env_select )

This function will check for everything (DB, PHP and PHP extensions for now) returning an array of environment_result objects.

Parameters
string$versionxml version we are going to use to test this server
int$env_selectone of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use.
Return values
environment_results[]array of results encapsulated in one environment_result object

◆ environment_check_database()

environment_check_database ( $version,
$env_select )

This function will check if database requirements are satisfied.

@uses NO_VERSION_DATA_FOUND @uses NO_DATABASE_SECTION_FOUND @uses NO_DATABASE_VENDORS_FOUND @uses NO_DATABASE_VENDOR_MYSQL_FOUND @uses NO_DATABASE_VENDOR_POSTGRES_FOUND @uses NO_DATABASE_VENDOR_VERSION_FOUND

Parameters
string$versionxml version we are going to use to test this server
int | string$env_selectone of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. String means plugin name.
Return values
objectresults encapsulated in one environment_result object

◆ environment_check_moodle()

environment_check_moodle ( $version,
$env_select )

This function will check if Moodle requirements are satisfied.

@uses NO_VERSION_DATA_FOUND

Parameters
string$versionxml version we are going to use to test this server
int | string$env_selectone of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. String means plugin name.
Return values
objectresults encapsulated in one environment_result object

◆ environment_check_pcre_unicode()

environment_check_pcre_unicode ( $version,
$env_select )

Looks for buggy PCRE implementation, we need unicode support in Moodle...

Parameters
string$versionxml version we are going to use to test this server
int | string$env_selectone of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. String means plugin name.
Return values
stdClassresults encapsulated in one environment_result object, null if irrelevant

◆ environment_check_php()

environment_check_php ( $version,
$env_select )

This function will check if php requirements are satisfied.

@uses NO_VERSION_DATA_FOUND @uses NO_PHP_SECTION_FOUND @uses NO_PHP_VERSION_FOUND

Parameters
string$versionxml version we are going to use to test this server
int | string$env_selectone of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. String means plugin name.
Return values
objectresults encapsulated in one environment_result object

◆ environment_check_php_extensions()

environment_check_php_extensions ( $version,
$env_select )

This function will check if php extensions requirements are satisfied.

@uses NO_VERSION_DATA_FOUND @uses NO_PHP_EXTENSIONS_SECTION_FOUND @uses NO_PHP_EXTENSIONS_NAME_FOUND

Parameters
string$versionxml version we are going to use to test this server
int | string$env_selectone of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. String means plugin name.
Return values
arrayarray of results encapsulated in one environment_result object

◆ environment_check_php_settings()

environment_check_php_settings ( $version,
$env_select )

This function will check if php extensions requirements are satisfied.

@uses NO_VERSION_DATA_FOUND @uses NO_PHP_SETTINGS_NAME_FOUND

Parameters
string$versionxml version we are going to use to test this server
int | string$env_selectone of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. String means plugin name.
Return values
arrayarray of results encapsulated in one environment_result object

◆ environment_check_unicode()

environment_check_unicode ( $version,
$env_select )

This function will check if unicode database requirements are satisfied.

@uses NO_VERSION_DATA_FOUND @uses NO_UNICODE_SECTION_FOUND

Parameters
string$versionxml version we are going to use to test this server
int | string$env_selectone of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. String means plugin name.
Return values
objectresults encapsulated in one environment_result object

◆ environment_custom_checks()

environment_custom_checks ( $version,
$env_select )

This function will do the custom checks.

@uses CUSTOM_CHECK_FUNCTION_MISSING @uses CUSTOM_CHECK_FILE_MISSING @uses NO_CUSTOM_CHECK_FOUND

Parameters
string$versionxml version we are going to use to test this server.
int | string$env_selectone of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. String means plugin name.
Return values
arrayarray of results encapsulated in environment_result objects.

◆ environment_get_errors()

environment_get_errors ( $environment_results)

Returns array of critical errors in plain text format.

Parameters
array$environment_resultsarray of results gathered
Return values
arrayerrors

◆ environment_verify_plugin()

environment_verify_plugin ( $plugin,
$pluginxml )

Checks if a plugin tag has a name attribute and it matches the plugin being tested.

Parameters
string$pluginthe name of the plugin.
array$pluginxmlthe xmlised structure for the plugin tag being tested.
Return values
booleantrue if the name attribute exists and matches the plugin being tested.

◆ error()

error ( )
Deprecated
since 2.0

◆ events_cleanup()

events_cleanup ( )
Deprecated
since Moodle 3.6. Please use the Events 2 API.

◆ events_cron()

events_cron ( )
Deprecated
since Moodle 3.1

◆ events_dequeue()

events_dequeue ( )
Deprecated
since Moodle 3.6. Please use the Events 2 API.

◆ events_dispatch()

events_dispatch ( )
Deprecated
since Moodle 3.1

◆ events_get_cached()

events_get_cached ( )
Deprecated
since Moodle 3.6. Please use the Events 2 API.

◆ events_get_handlers()

events_get_handlers ( )
Deprecated
since Moodle 3.6. Please use the Events 2 API.

◆ events_is_registered()

events_is_registered ( )
Deprecated
since Moodle 3.1

◆ events_load_def()

events_load_def ( )
Deprecated
since Moodle 3.1

◆ events_pending_count()

events_pending_count ( )
Deprecated
since Moodle 3.1

◆ events_process_queued_handler()

events_process_queued_handler ( )
Deprecated
since Moodle 3.1

◆ events_queue_handler()

events_queue_handler ( )
Deprecated
since Moodle 3.1

◆ events_trigger()

events_trigger ( )
Deprecated
since 2.6

◆ events_trigger_legacy()

events_trigger_legacy ( )
Deprecated
since Moodle 3.1

◆ events_uninstall()

events_uninstall ( )
Deprecated
since Moodle 3.6. Please use the Events 2 API.

◆ events_update_definition()

events_update_definition ( )
Deprecated
since Moodle 3.1

◆ exceeds_password_length()

exceeds_password_length ( string $password,
int $pepperlength = 0 )

Validates user's password length.

Parameters
string$password
int$pepperlengthThe length of the used peppers
Return values
bool

◆ exists_auth_plugin()

exists_auth_plugin ( $auth)

Returns whether a given authentication plugin exists.

Parameters
string$authForm of authentication to check for. Defaults to the global setting in $CFG.
Return values
booleanWhether the plugin is available.

◆ external_function_info()

external_function_info ( )
Deprecated
since Moodle 3.1. Use external_api\external_function_info().

◆ external_update_descriptions()

external_update_descriptions ( $component)

Web service discovery function used during install and upgrade.

Parameters
string$componentname of component (moodle, etc.)
Return values
void

◆ external_update_services()

external_update_services ( )

Allow plugins and subsystems to add external functions to other plugins or built-in services.

This function is executed just after all the plugins have been updated.

◆ extract_draft_file_urls_from_text()

extract_draft_file_urls_from_text ( $text,
$forcehttps = false,
$contextid = null,
$component = null,
$filearea = null,
$itemid = null,
$filename = null )

Factory method for extracting draft file links from arbitrary text using regular expressions.

Only text is required; other file fields may be passed to filter.

Parameters
string$textSome html content.
bool$forcehttpsforce https urls.
int$contextidThis parameter and the next three identify the file area to save to.
string$componentThe component name.
string$fileareaThe filearea.
int$itemidThe item id for the filearea.
string$filenameThe specific filename of the file.
Return values
array

◆ fetch_context_capabilities()

fetch_context_capabilities ( )
Deprecated
since 2.2

◆ filter()

moodle_text_filter::filter ( $text,
array $options = array() )
abstract

Override this function to actually implement the filtering.

Filter developers must make sure that filtering done after text cleaning does not introduce security vulnerabilities.

Parameters
string$textsome HTML content to process.
array$optionsoptions passed to the filters
Return values
stringthe HTML content after the filtering has been applied.

Reimplemented in filter_activitynames, filter_algebra, filter_codehighlighter, filter_displayh5p, filter_emoticon, filter_glossary, filter_mathjaxloader, filter_mediaplugin, filter_multilang, filter_tidy, and filter_urltolink.

◆ filter_add_javascript()

filter_add_javascript ( $text)

Add missing openpopup javascript to HTML files.

Parameters
string$text
Return values
string

◆ filter_context_may_have_filter_settings()

filter_context_may_have_filter_settings ( $context)

Certain types of context (block and user) may not have local filter settings.

the function checks a context to see whether it may have local config.

Parameters
object$contexta context.
Return values
booleanwhether this context may have local filter settings.

◆ filter_delete_all_for_context()

filter_delete_all_for_context ( $contextid)

Delete all the data in the database relating to a context, used when contexts are deleted.

Parameters
integer$contextidThe id of the context being deleted.

◆ filter_delete_all_for_filter()

filter_delete_all_for_filter ( $filter)

Delete all the data in the database relating to a filter, prior to deleting it.

Parameters
string$filterThe filter name, for example 'tex'.

◆ filter_get_active_in_context()

filter_get_active_in_context ( $context)

Get the list of active filters, in the order that they should be used for a particular context, along with any local configuration variables.

Parameters
context$contexta context
Return values
arrayan array where the keys are the filter names, for example 'tex' and the values are any local configuration for that filter, as an array of name => value pairs from the filter_config table. In a lot of cases, this will be an empty array. So, an example return value for this function might be array(tex' => array())

◆ filter_get_active_state()

filter_get_active_state ( string $filtername,
$contextid = null )

Returns the active state for a filter in the given context.

Parameters
string$filternameThe filter name, for example 'tex'.
integer$contextidThe id of the context to get the data for.
Return values
intvalue of active field for the given filter.

◆ filter_get_all_installed()

filter_get_all_installed ( )

Get the names of all the filters installed in this Moodle.

Return values
arraypath => filter name from the appropriate lang file. e.g. array('tex' => 'TeX Notation'); sorted in alphabetical order of name.

◆ filter_get_all_local_settings()

filter_get_all_local_settings ( $contextid)

This function is for use by backup.

Gets all the filter information specific to one context.

Parameters
int$contextid
Return values
arrayArray with two elements. The first element is an array of objects with fields filter and active. These come from the filter_active table. The second element is an array of objects with fields filter, name and value from the filter_config table.

◆ filter_get_available_in_context()

filter_get_available_in_context ( $context)

List all of the filters that are available in this context, and what the local and inherited states of that filter are.

Parameters
context$contexta context that is not the system context.
Return values
arrayan array with filter names, for example 'tex' as keys. and and the values are objects with fields: ->filter filter name, same as the key. ->localstate TEXTFILTER_ON/OFF/INHERIT ->inheritedstate TEXTFILTER_ON/OFF - the state that will be used if localstate is set to TEXTFILTER_INHERIT.

◆ filter_get_global_states()

filter_get_global_states ( )

This function is for use by the filter administration page.

Return values
array'filtername' => object with fields 'filter' (=filtername), 'active' and 'sortorder'

◆ filter_get_globally_enabled()

filter_get_globally_enabled ( )

Return a list of all the filters that may be in use somewhere.

Return values
arraywhere the keys and values are both the filter name, like 'tex'.

◆ filter_get_globally_enabled_filters_with_config()

filter_get_globally_enabled_filters_with_config ( )

Get the globally enabled filters.

This returns the filters which could be used in any context. Essentially the filters which are not disabled for the entire site.

Return values
arrayKeys are filter names, and values the config.

◆ filter_get_local_config()

filter_get_local_config ( $filter,
$contextid )

Get local config variables for a filter in a context.

Normally (when your filter is running) you don't need to call this, becuase the config is fetched for you automatically. You only need this, for example, when you are getting the config so you can show the user an editing from.

Parameters
string$filterThe filter name, for example 'tex'.
integer$contextidThe ID of the context to get the local config for.
Return values
arrayof name => value pairs.

◆ filter_get_name()

filter_get_name ( $filter)

Look up the name of this filter.

Parameters
string$filterthe filter name
Return values
stringthe human-readable name for this filter.

◆ filter_get_string_filters()

filter_get_string_filters ( )

Return the names of the filters that should also be applied to strings (when they are enabled).

Return values
arraywhere the keys and values are both the filter name, like 'tex'.

◆ filter_has_global_settings()

filter_has_global_settings ( $filter)

Does this filter have a global settings page in the admin tree? (The settings page for a filter must be called, for example, filtersettingfiltertex.)

Parameters
string$filterThe filter name, for example 'tex'.
Return values
booleanWhether there should be a 'Settings' link on the config page.

◆ filter_has_local_settings()

filter_has_local_settings ( $filter)

Does this filter have local (per-context) settings?

Parameters
string$filterThe filter name, for example 'tex'.
Return values
booleanWhether there should be a 'Settings' link on the manage filters in context page.

◆ filter_is_enabled()

filter_is_enabled ( $filtername)
Parameters
string$filternameThe filter name, for example 'tex'.
Return values
booleanis this filter allowed to be used on this site. That is, the admin has set the global 'active' setting to On, or Off, but available.

◆ filter_phrases()

filter_phrases ( $text,
$linkarray,
$ignoretagsopen = null,
$ignoretagsclose = null,
$overridedefaultignore = false,
$linkarrayalreadyprepared = false )

Process phrases intelligently found within a HTML text (such as adding links).

Parameters
string$textthe text that we are filtering
filterobject[]$linkarrayan array of filterobjects
array$ignoretagsopenan array of opening tags that we should ignore while filtering
array$ignoretagsclosean array of corresponding closing tags
bool$overridedefaultignoreTrue to only use tags provided by arguments
bool$linkarrayalreadypreparedTrue to say that filter_prepare_phrases_for_filtering has already been called for $linkarray. Default false.
Return values
string

◆ filter_preload_activities()

filter_preload_activities ( course_modinfo $modinfo)

Preloads the list of active filters for all activities (modules) on the course using two database queries.

Parameters
course_modinfo$modinfoCourse object from get_fast_modinfo

◆ filter_prepare_phrase_for_replacement()

filter_prepare_phrase_for_replacement ( filterobject $linkobject)

Fill in the remaining ->work... fields, that would be needed to replace the phrase.

Parameters
filterobject$linkobjectthe link object on which to set additional fields.

◆ filter_prepare_phrases_for_filtering()

filter_prepare_phrases_for_filtering ( array $linkarray)

Prepare a list of link for processing with filter_phrases().

Parameters
filterobject[]$linkarraythe links that will be passed to filter_phrases().
Return values
filterobject[]the updated list of links with necessary pre-processing done.

◆ filter_remove_duplicates()

filter_remove_duplicates ( $linkarray)

Remove duplicate from a list of filterobject.

Parameters
filterobject[]$linkarraya list of filterobject.
Return values
filterobject[]the same list, but with dupicates removed.

◆ filter_save_ignore_tags()

filter_save_ignore_tags ( & $text,
$filterignoretagsopen,
$filterignoretagsclose,
& $ignoretags )

Extract open/lose tags and their contents to avoid being processed by filters.

Useful to extract pieces of code like ... tags. It returns the text converted with some <#xTEXTFILTER_EXCL_SEPARATORx#> codes replacing the extracted text. Such extracted texts are returned in the ignoretags array (as values), with codes as keys.

Parameters
string$textthe text that we are filtering (in/out)
array$filterignoretagsopenan array of open tags to start searching
array$filterignoretagsclosean array of close tags to end searching
array$ignoretagsan array of saved strings useful to rebuild the original text (in/out)

◆ filter_save_tags()

filter_save_tags ( & $text,
& $tags )

Extract tags (any text enclosed by < and > to avoid being processed by filters.

It returns the text converted with some <xTEXTFILTER_EXCL_SEPARATORx%> codes replacing the extracted text. Such extracted texts are returned in the tags array (as values), with codes as keys.

Parameters
string$textthe text that we are filtering (in/out)
array$tagsan array of saved strings useful to rebuild the original text (in/out)

◆ filter_set_applies_to_strings()

filter_set_applies_to_strings ( $filter,
$applytostrings )

Sets whether a particular active filter should be applied to all strings by format_string, or just used by format_text.

Parameters
string$filterThe filter name, for example 'tex'.
boolean$applytostringsif true, this filter will apply to format_string and format_text, when it is enabled.

◆ filter_set_global_state()

filter_set_global_state ( $filtername,
$state,
$move = 0 )

Set the global activated state for a text filter.

Parameters
string$filternameThe filter name, for example 'tex'.
int$stateOne of the values TEXTFILTER_ON, TEXTFILTER_OFF or TEXTFILTER_DISABLED.
int$move-1 means up, 0 means the same, 1 means down

◆ filter_set_local_config()

filter_set_local_config ( $filter,
$contextid,
$name,
$value )

Set a particular local config variable for a filter in a context.

Parameters
string$filterThe filter name, for example 'tex'.
integer$contextidThe id of the context to get the local config for.
string$namethe setting name.
string$valuethe corresponding value.

◆ filter_set_local_state()

filter_set_local_state ( $filter,
$contextid,
$state )

Set the local activated state for a text filter.

Parameters
string$filterThe filter name, for example 'tex'.
integer$contextidThe id of the context to get the local config for.
integer$stateOne of the values TEXTFILTER_ON, TEXTFILTER_OFF or TEXTFILTER_INHERIT.
Return values
void

◆ filter_stage_post_clean()

moodle_text_filter::filter_stage_post_clean ( string $text,
array $options )

Filter HTML text at the very end after text is sanitised.

NOTE: this is called even if $options['noclean'] is true and text is not cleaned.

Parameters
string$text
array$options
Return values
string

◆ filter_stage_pre_clean()

moodle_text_filter::filter_stage_pre_clean ( string $text,
array $options )

Filter HTML text before sanitising text.

NOTE: this is called even if $options['noclean'] is true and text is not cleaned.

Parameters
string$text
array$options
Return values
string

◆ filter_stage_pre_format()

moodle_text_filter::filter_stage_pre_format ( string $text,
array $options )

Filter text before changing format to HTML.

Parameters
string$text
array$options
Return values
string

◆ filter_stage_string()

moodle_text_filter::filter_stage_string ( string $text,
array $options )

Filter simple text coming from format_string().

Note that unless $CFG->formatstringstriptags is disabled HTML tags are not expected in returned value.

Parameters
string$text
array$options
Return values
string

◆ filter_string() [1/3]

filter_manager::filter_string ( $string,
$context )

Filter a piece of string.

Parameters
string$stringThe text to filter
context$contextthe context.
Return values
stringresulting string

Reimplemented in performance_measuring_filter_manager.

◆ filter_string() [2/3]

null_filter_manager::filter_string ( $string,
$context )

As for the equivalent filter_manager method.

Parameters
string$stringThe text to filter
context$contextnot used.
Return values
stringresulting string

◆ filter_string() [3/3]

performance_measuring_filter_manager::filter_string ( $string,
$context )

Filter a piece of string.

Parameters
string$stringThe text to filter
context$contextthe context.
Return values
stringresulting string

Reimplemented from filter_manager.

◆ filter_text() [1/4]

filter_manager::filter_text ( $text,
$context,
array $options = array(),
array $skipfilters = null )

Filter some text.

Parameters
string$textThe text to filter
context$contextthe context.
array$optionsoptions passed to the filters
array$skipfiltersof filter names. Any filters that should not be applied to this text.
Return values
stringresulting text

Reimplemented in performance_measuring_filter_manager.

◆ filter_text() [2/4]

filter_text ( )
Deprecated
use the text formatting in a standard way instead (https://moodledev.io/docs/apis/subsystems/output#output-functions) this was abused mostly for embedding of attachments

◆ filter_text() [3/4]

null_filter_manager::filter_text ( $text,
$context,
array $options = array(),
array $skipfilters = null )

As for the equivalent filter_manager method.

Parameters
string$textThe text to filter
context$contextnot used.
array$optionsnot used
array$skipfiltersnot used
Return values
stringresulting text.

◆ filter_text() [4/4]

performance_measuring_filter_manager::filter_text ( $text,
$context,
array $options = array(),
array $skipfilters = null )

Filter some text.

Parameters
string$textThe text to filter
context$contextthe context.
array$optionsoptions passed to the filters
array$skipfiltersof filter names. Any filters that should not be applied to this text.
Return values
stringresulting text

Reimplemented from filter_manager.

◆ filter_unset_local_config()

filter_unset_local_config ( $filter,
$contextid,
$name )

Remove a particular local config variable for a filter in a context.

Parameters
string$filterThe filter name, for example 'tex'.
integer$contextidThe id of the context to get the local config for.
string$namethe setting name.

◆ find_day_in_month()

find_day_in_month ( $startday,
$weekday,
$month,
$year )

Calculates when the day appears in specific month.

Parameters
int$startdaystarting day of the month
int$weekdayThe day when week starts (normally taken from user preferences)
int$monthThe month whose day is sought
int$yearThe year of the month whose day is sought
Return values
int

◆ fix_align_rtl()

fix_align_rtl ( $align)

Returns swapped left<=> right if in RTL environment.

Part of RTL Moodles support.

Parameters
string$alignalign to check
Return values
string

◆ fix_course_sortorder()

object fix_course_sortorder ( )

Fixes course category and course sortorder, also verifies category and course parents and paths.

(circular references are not fixed)

@global object @uses MAX_COURSE_CATEGORIES @uses SITEID @uses CONTEXT_COURSE

Return values
void

◆ fix_current_language()

fix_current_language ( string $lang)

Fix the current language to the given language code.

Parameters
string$langThe language code to use.
Return values
void

◆ fix_utf8()

fix_utf8 ( $value)

Makes sure the data is using valid utf8, invalid characters are discarded.

Note: this function is not intended for full objects with methods and private properties.

Parameters
mixed$value
Return values
mixedwith proper utf-8 encoding

◆ flatten_category_tree()

flatten_category_tree ( & $categories,
$id,
$depth = 0,
$nochildrenof = -1 )

Private method, only for the use of add_indented_names().

Recursively adds an indentedname field to each category, starting with the category with id $id, and dealing with that category and all its children, and return a new array, with those categories in the right order.

Parameters
array$categoriesan array of categories which has had childids fields added by flatten_category_tree(). Passed by reference for performance only. It is not modfied.
int$idthe category to start the indenting process from.
int$depththe indent depth. Used in recursive calls.
int$nochildrenof
Return values
arraya new array of categories, in the right order for the tree.
Deprecated
since Moodle 4.0 MDL-71585
See also
qbank_managecategories\helper
Todo
Final deprecation on Moodle 4.4 MDL-72438

◆ force_current_language()

force_current_language ( $language)

Force the current language to get strings and dates localised in the given language.

After calling this function, all strings will be provided in the given language until this function is called again, or equivalent code is run.

Parameters
string$language
Return values
stringprevious $SESSION->forcelang value

◆ format_admin_setting()

format_admin_setting ( $setting,
$title = '',
$form = '',
$description = '',
$label = true,
$warning = '',
$defaultinfo = NULL,
$query = '' )

Format admin settings.

Parameters
object$setting
string$titlelabel element
string$formform fragment, html code - not highlighted automatically
string$description
mixed$labellink label to id, true by default or string being the label to connect it to
string$warningwarning text
sting$defaultinfodefaults info, null means nothing, '' is converted to "Empty" string, defaults to null
string$querysearch query to be highlighted
Return values
stringXHTML

◆ format_backtrace()

format_backtrace ( $callers,
$plaintext = false )

Formats a backtrace ready for output.

This function does not include function arguments because they could contain sensitive information not suitable to be exposed in a response.

Parameters
array$callersbacktrace array, as returned by debug_backtrace().
boolean$plaintextif false, generates HTML, if true generates plain text.
Return values
stringformatted backtrace, ready for output.

◆ format_float()

format_float ( $float,
$decimalpoints = 1,
$localized = true,
$stripzeros = false )

Given a float, prints it nicely.

Localized floats must not be used in calculations!

The stripzeros feature is intended for making numbers look nicer in small areas where it is not necessary to indicate the degree of accuracy by showing ending zeros. If you turn it on with $decimalpoints set to 3, for example, then it will display '5.4' instead of '5.400' or '5' instead of '5.000'.

Parameters
float$floatThe float to print
int$decimalpointsThe number of decimal places to print. -1 is a special value for auto detect (full precision).
bool$localizeduse localized decimal separator
bool$stripzerosIf true, removes final zeros after decimal point. It will be ignored and the trailing zeros after the decimal point are always striped if $decimalpoints is -1.
Return values
stringlocale float

◆ format_module_intro()

format_module_intro ( $module,
$activity,
$cmid,
$filter = true )

Formats activity intro text.

Parameters
string$modulename of module
object$activityinstance of activity
int$cmidcourse module id
bool$filterfilter resulting html text
Return values
string

◆ format_string()

format_string ( $string,
$striplinks = true,
$options = null )

Given a simple string, this function returns the string processed by enabled string filters if $CFG->filterall is enabled.

This function should be used to print short strings (non html) that need filter processing e.g. activity titles, post subjects, glossary concepts.

@staticvar bool $strcache

Parameters
string$stringThe string to be filtered. Should be plain text, expect possibly for multilang tags.
boolean$striplinksTo strip any link in the result text. Moodle 1.8 default changed from false to true! MDL-8713
array$optionsoptions array/object or courseid
Return values
string

◆ format_text()

format_text ( $text,
$format = FORMAT_MOODLE,
$options = null,
$courseiddonotuse = null )

Given text in a variety of format codings, this function returns the text as safe HTML.

This function should mainly be used for long strings like posts, answers, glossary items etc. For short strings format_string().

Options:
     trusted     :   If true the string won't be cleaned. Default false required noclean=true.
     noclean     :   If true the string won't be cleaned, unless $CFG->forceclean is set. Default false required trusted=true.
     nocache     :   If true the strign will not be cached and will be formatted every call. Default false.
     filter      :   If true the string will be run through applicable filters as well. Default true.
     para        :   If true then the returned string will be wrapped in div tags. Default true.
     newlines    :   If true then lines newline breaks will be converted to HTML newline breaks. Default true.
     context     :   The context that will be used for filtering.
     overflowdiv :   If set to true the formatted text will be encased in a div
                     with the class no-overflow before being returned. Default false.
     allowid     :   If true then id attributes will not be removed, even when
                     using htmlpurifier. Default false.
     blanktarget :   If true all  tags will have target="_blank" added unless target is explicitly specified.

@staticvar array $croncache

Parameters
string$textThe text to be formatted. This is raw text originally from user input.
int$formatIdentifier of the text format to be used [FORMAT_MOODLE, FORMAT_HTML, FORMAT_PLAIN, FORMAT_MARKDOWN]
stdClass | array$optionstext formatting options
int$courseiddonotusedeprecated course id, use context option instead
Return values
string

◆ format_text_email()

format_text_email ( $text,
$format )

Given text in a variety of format codings, this function returns the text as plain text suitable for plain email.

Parameters
string$textThe text to be formatted. This is raw text originally from user input.
int$formatIdentifier of the text format to be used [FORMAT_MOODLE, FORMAT_HTML, FORMAT_PLAIN, FORMAT_WIKI, FORMAT_MARKDOWN]
Return values
string

◆ format_text_menu()

format_text_menu ( )

Just returns an array of text formats suitable for a popup menu.

Return values
array

◆ format_time()

format_time ( $totalsecs,
$str = null )

Format a date/time (seconds) as weeks, days, hours etc as needed.

Given an amount of time in seconds, returns string formatted nicely as years, days, hours etc as needed

@uses MINSECS @uses HOURSECS @uses DAYSECS @uses YEARSECS

Parameters
int$totalsecsTime in seconds
stdClass$strShould be a time object
Return values
stringA nicely formatted date/time string

◆ format_weeks_get_section_dates()

format_weeks_get_section_dates ( )
Deprecated
since 2.4

◆ formerr()

formerr ( )

◆ fullclone()

fullclone ( $thing)

This function will make a complete copy of anything it's given, regardless of whether it's an object or not.

Parameters
mixed$thingSomething you want cloned
Return values
mixedWhat ever it is you passed it

◆ fullname()

fullname ( $user,
$override = false )

Returns a persons full name.

Given an object containing all of the users name values, this function returns a string with the full name of the person. The result may depend on system settings or language. 'override' will force the alternativefullnameformat to be used. In English, fullname as well as alternativefullnameformat is set to 'firstname lastname' by default. But you could have fullname set to 'firstname lastname' and alternativefullnameformat set to 'firstname middlename alternatename lastname'.

Parameters
stdClass$userA $USER object to get full name of.
bool$overrideIf true then the alternativefullnameformat format rather than fullnamedisplay format will be used.
Return values
string

◆ gc_cache_flags()

gc_cache_flags ( )

Garbage-collect volatile flags.

Return values
boolAlways returns true

◆ generate_email_messageid()

generate_email_messageid ( $localpart = null)

Generate a unique email Message-ID using the moodle domain and install path.

Parameters
string$localpartAn optional unique message id prefix.
Return values
stringThe formatted ID ready for appending to the email headers.

◆ generate_email_processing_address()

generate_email_processing_address ( $modid,
$modargs )

Generate an email processing address.

Parameters
int$modid
string$modargs
Return values
stringReturns email processing address

◆ generate_email_signoff()

generate_email_signoff ( )

Generate a signoff for emails based on support settings.

Return values
string

◆ generate_email_supportuser()

generate_email_supportuser ( )
Deprecated
since Moodle 2.6

◆ generate_image_thumbnail()

generate_image_thumbnail ( $filepath,
$width,
$height )

Generates a thumbnail for the given image.

If the GD library has at least version 2 and PNG support is available, the returned data is the content of a transparent PNG file containing the thumbnail. Otherwise, the function returns contents of a JPEG file with black background containing the thumbnail.

Parameters
string$filepaththe full path to the original image file
int$widththe width of the requested thumbnail
int$heightthe height of the requested thumbnail
Return values
string|boolfalse if a problem occurs, the thumbnail image data otherwise

◆ generate_image_thumbnail_from_image()

generate_image_thumbnail_from_image ( $original,
$imageinfo,
$width,
$height )

Generates a thumbnail for the given image string.

If the GD library has at least version 2 and PNG support is available, the returned data is the content of a transparent PNG file containing the thumbnail. Otherwise, the function returns contents of a JPEG file with black background containing the thumbnail.

Parameters
resource$originalThe image to work on.
array$imageinfoContains [0] => originalwidth, [1] => originalheight.
int$widthThe width of the requested thumbnail.
int$heightThe height of the requested thumbnail.
Return values
string|boolFalse if a problem occurs, the thumbnail image data otherwise.

◆ generate_image_thumbnail_from_string()

generate_image_thumbnail_from_string ( $filedata,
$width,
$height )

Generates a thumbnail for the given image string.

If the GD library has at least version 2 and PNG support is available, the returned data is the content of a transparent PNG file containing the thumbnail. Otherwise, the function returns contents of a JPEG file with black background containing the thumbnail.

Parameters
string$filedataThe image content as a string
int$widththe width of the requested thumbnail
int$heightthe height of the requested thumbnail
Return values
string|boolfalse if a problem occurs, the thumbnail image data otherwise

◆ generate_page_type_patterns()

generate_page_type_patterns ( $pagetype,
$parentcontext = null,
$currentcontext = null )

Given a specific page type, parent context and currect context, return all the page type patterns that might be used by this block.

Parameters
string$pagetypefor example 'course-view-weeks' or 'mod-quiz-view'.
stdClass$parentcontextBlock's parent context
stdClass$currentcontextCurrent context of block
Return values
arrayan array of all the page type patterns that might match this page type.

◆ generate_password()

generate_password ( $maxlen = 10)

Returns a randomly generated password of length $maxlen.

inspired by

and

Parameters
int$maxlenThe maximum size of the password being generated.
Return values
string

◆ generate_uuid()

generate_uuid ( )
Deprecated
since Moodle 3.8 MDL-61038 - please do not use this function any more.
See also
core\uuid\generate()

◆ get_accesshide()

get_accesshide ( $text,
$elem = 'span',
$class = '',
$attrs = '' )

Return a HTML element with the class "accesshide", for accessibility.

Please use cautiously - where possible, text should be visible!

Parameters
string$textPlain text.
string$elemLowercase element name, default "span".
string$classAdditional classes for the element.
string$attrsAdditional attributes string in the form, "name='value' name2='value2'"
Return values
stringHTML string.

◆ get_admin()

get_admin ( )
static

Returns $user object of the main admin user.

stdClass $mainadmin

Return values
stdClass$USER record from DB, false if not found

◆ get_admins()

get_admins ( )

Returns list of all admins, using 1 DB query.

Return values
array

◆ get_all_component_hash()

static get_all_component_hash ( ?array $components = null)
static

Returns hash of all core + plugin /db/ directories.

This is relatively slow and not fully cached, use with care!

Parameters
array | null$componentsoptional component directory => hash array to use. Only used in PHPUnit.
Return values
stringsha1 hash.

◆ get_all_directory_hashes()

static get_all_directory_hashes ( ?array $directories = null)
static

Get the hashes of all core + plugin /db/ directories.

Parameters
array | null$directoriesoptional component directory array to hash. Only used in PHPUnit.
Return values
arrayof directory => hash.

◆ get_all_instances_in_course()

get_all_instances_in_course ( $modulename,
$course,
$userid = NULL,
$includeinvisible = false )

Returns an array of all the active instances of a particular module in a given course, sorted in the order they are defined.

Returns an array of all the active instances of a particular module in a given course, sorted in the order they are defined in the course. Returns an empty array on any errors.

The returned objects includle the columns cw.section, cm.visible, cm.groupmode, and cm.groupingid, and are indexed by cm.id.

Simply calls all_instances_in_courses() with a single provided course

Parameters
string$modulenameThe name of the module to get instances for
object$courseThe course obect.
Return values
arrayof module instance objects, including some extra fields from the course_modules and course_sections tables, or an empty array if an error occurred.
Parameters
int$userid
int$includeinvisible

◆ get_all_instances_in_courses()

object get_all_instances_in_courses ( $modulename,
$courses,
$userid = NULL,
$includeinvisible = false )

Returns an array of all the active instances of a particular module in given courses, sorted in the order they are defined.

Returns an array of all the active instances of a particular module in given courses, sorted in the order they are defined in the course. Returns an empty array on any errors.

The returned objects includle the columns cw.section, cm.visible, cm.groupmode, cm.groupingid and cm.lang and are indexed by cm.id.

@global object

Parameters
string$modulenameThe name of the module to get instances for
array$coursesan array of course objects.
int$userid
int$includeinvisible
Return values
arrayof module instance objects, including some extra fields from the course_modules and course_sections tables, or an empty array if an error occurred.

◆ get_all_mods()

get_all_mods ( )
Deprecated
since 2.4

◆ get_all_sections()

get_all_sections ( )
Deprecated
since 2.4

◆ get_all_subcategories()

get_all_subcategories ( )
Deprecated
since 2.5. Please use core_course_category\get() and core_course_category\get_children()

◆ get_all_user_name_fields()

get_all_user_name_fields ( )

◆ get_all_versions()

static get_all_versions ( )
static

Returns hash of all versions including core and all plugins.

This is relatively slow and not fully cached, use with care!

Return values
arrayas (string)plugintype_pluginname => (int)version

◆ get_all_versions_hash()

static get_all_versions_hash ( )
static

Returns hash of all versions including core and all plugins.

This is relatively slow and not fully cached, use with care!

Return values
stringsha1 hash

◆ get_array_of_activities()

get_array_of_activities ( int $courseid,
bool $usecache = false )

For a given course, returns an array of course activity objects Each item in the array contains he following properties:

Parameters
int$courseidcourse id
bool$usecacheget activities from cache if modinfo exists when $usecache is true
Return values
arraylist of activities
Deprecated
since Moodle 4.0. Please use course_modinfo::get_array_of_activities() instead.

◆ get_auth_plugin()

get_auth_plugin ( $auth)

Returns an authentication plugin instance.

Parameters
string$authname of authentication plugin
Return values
auth_plugin_baseAn instance of the required authentication plugin.

◆ get_backpack_settings()

get_backpack_settings ( $userid,
$refresh = false )

Returns external backpack settings and badges from this backpack.

This function first checks if badges for the user are cached and tries to retrieve them from the cache. Otherwise, badges are obtained through curl request to the backpack.

Parameters
int$useridBackpack user ID.
boolean$refreshRefresh badges collection in cache.
Return values
null|objectReturns null is there is no backpack or object with backpack settings.

◆ get_backup_temp_directory()

get_backup_temp_directory ( $directory)

Get the full path of a directory under $CFG->backuptempdir.

Parameters
string$directorythe relative path of the directory under $CFG->backuptempdir
Return values
string|falseReturns full path to directory given a valid string; otherwise, false.

◆ get_browser_version_classes()

get_browser_version_classes ( )
Deprecated
since 2.6

◆ get_cache_flag()

get_cache_flag ( $type,
$name,
$changedsince = null )

Get volatile flags.

Parameters
string$type
string$name
int$changedsincedefault null
Return values
string|falseThe cache flag value or false

◆ get_cache_flags()

get_cache_flags ( $type,
$changedsince = null )

Get volatile flags.

Parameters
string$type
int$changedsincedefault null
Return values
arrayrecords array

◆ get_callable_name()

get_callable_name ( $callable)

Get human readable name describing the given callable.

This performs syntax check only to see if the given param looks like a valid function, method or closure. It does not check if the callable actually exists.

Parameters
callable | string | array$callable
Return values
string|boolHuman readable name of callable, or false if not a valid callable.

◆ get_categories()

get_categories ( )
Deprecated
since 2.5

◆ get_categories_for_contexts()

get_categories_for_contexts ( $contexts,
$sortorder = 'parent,
sortorder ,
name ASC' ,
$top = false )

Get all the category objects, including a count of the number of questions in that category, for all the categories in the lists $contexts.

Parameters
mixed$contextseither a single contextid, or a comma-separated list of context ids.
string$sortorderused as the ORDER BY clause in the select statement.
bool$topWhether to return the top categories or not.
Return values
arrayof category objects.
Deprecated
since Moodle 4.0 MDL-71585
See also
qbank_managecategories\helper
Todo
Final deprecation on Moodle 4.4 MDL-72438

◆ get_category_courses_array()

get_category_courses_array ( )
Deprecated
since 2.5

◆ get_category_courses_array_recursively()

get_category_courses_array_recursively ( )
Deprecated
since 2.5

◆ get_child_categories()

get_child_categories ( )
Deprecated
since 2.5. Please use core_course_category\get($parentid)->get_children().

◆ get_child_contexts()

get_child_contexts ( )
Deprecated
since 2.2

◆ get_clam_error_code()

get_clam_error_code ( )
Deprecated
since Moodle 3.0 - this is a part of clamav plugin now.

◆ get_complete_user_data()

get_complete_user_data ( $field,
$value,
$mnethostid = null,
$throwexception = false )

Get a complete user record, which includes all the info in the user record.

Intended for setting as $USER session variable

Parameters
string$fieldThe user field to be checked for a given value.
string$valueThe value to match for $field.
int$mnethostid
bool$throwexceptionIf true, it will throw an exception when there's no record found or when there are multiple records found. Otherwise, it will just return false.
Return values
mixedFalse, or A $USER object.

◆ get_component_classes_in_namespace()

static get_component_classes_in_namespace ( $component = null,
$namespace = '' )
static

Returns all classes in a component matching the provided namespace.

It checks that the class exists.

e.g. get_component_classes_in_namespace('mod_forum', 'event')

Parameters
string | null$componentA valid moodle component (frankenstyle) or null if searching all components
string$namespaceNamespace from the component name or empty string if all $component classes.
Return values
arrayThe full class name as key and the class path as value, empty array if $component is null and $namespace is empty.

◆ get_component_directory()

get_component_directory ( $component)
static

Return exact absolute path to a plugin directory.

Parameters
string$componentname such as 'moodle', 'mod_forum'
Return values
stringfull path to component directory; NULL if not found
Deprecated
since 2.6, use core_component\normalize_component()
Parameters
string$componentname such as 'moodle', 'mod_forum'
Return values
stringfull path to component directory; NULL if not found

◆ get_component_list()

static get_component_list ( )
static

Returns a list of frankenstyle component names and their paths, for all components (plugins and subsystems).

E.g. [ 'mod' => [ 'mod_forum' => FORUM_PLUGIN_PATH, ... ], ... 'core' => [ 'core_comment' => COMMENT_SUBSYSTEM_PATH, ... ] ]

Return values
arrayan associative array of components and their corresponding paths.

◆ get_component_names()

static get_component_names ( )
static

Returns a list of frankenstyle component names.

E.g. [ 'core_course', 'core_message', 'mod_assign', ... ]

Return values
arraythe list of frankenstyle component names.

◆ get_component_version()

get_component_version ( $component,
$source = 'installed' )

Returns the version of installed component.

Parameters
string$componentcomponent name
string$sourceeither 'disk' or 'installed' - where to get the version information from
Return values
string|boolversion number or false if the component is not found

◆ get_config()

get_config ( $plugin,
$name = null )

Get configuration values from the global config table or the config_plugins table.

If called with one parameter, it will load all the config variables for one plugin, and return them as an object.

If called with 2 parameters it will return a string single value or false if the value is not found.

NOTE: this function is called from lib/db/upgrade.php

Parameters
string$pluginfull component name
string$namedefault null
Return values
mixedhash-like object or single value, return false no config found
Exceptions
dml_exception

◆ get_context_instance()

get_context_instance ( $contextlevel,
$instance = 0,
$strictness = IGNORE_MISSING )

Get the context instance as an object.

This function will create the context instance if it does not exist yet.

Deprecated
since 2.2, use context_course\instance() or other relevant class instead
Todo
This will be deleted in Moodle 2.8, refer MDL-34472
Parameters
integer$contextlevelThe context level, for example CONTEXT_COURSE, or CONTEXT_MODULE.
integer$instanceThe instance id. For $level = CONTEXT_COURSE, this would be $course->id, for $level = CONTEXT_MODULE, this would be $cm->id. And so on. Defaults to 0
int$strictnessIGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; MUST_EXIST means throw exception if no record or multiple records found
Return values
contextThe context object.

◆ get_context_instance_by_id()

get_context_instance_by_id ( )
Deprecated
since Moodle 2.2 MDL-35009 - please do not use this function any more.

◆ get_context_url()

get_context_url ( )
Deprecated
since 2.2

◆ get_contextlevel_name()

get_contextlevel_name ( )
Deprecated
since 2.2

◆ get_core_api_names()

static get_core_api_names ( )
static

Returns the list of available API names.

Return values
string[]the list of available API names.

◆ get_core_apis()

static get_core_apis ( )
static

List all core APIs and their attributes.

This is a list of all the existing / allowed APIs in moodle, each one with the following attributes:

  • component: the component, usually a subsystem or core, the API belongs to.
  • allowedlevel2: if the API is allowed as level2 namespace or no.
  • allowedspread: if the API can spread out from its component or no.
Return values
stdClass[]array of APIs (as keys) with their attributes as object instances.

◆ get_core_subsystems() [1/2]

get_core_subsystems ( $fullpaths = false)

List all core subsystems and their location.

This is a list of components that are part of the core and their language strings are defined in /lang/en/<<subsystem>>.php. If a given plugin is not listed here and it does not have proper plugintype prefix, then it is considered as course activity module.

The location is optionally dirroot relative path. NULL means there is no special directory for this subsystem. If the location is set, the subsystem's renderer.php is expected to be there.

Deprecated
since 2.6, use core_component\get_core_subsystems()
Parameters
bool$fullpathsfalse means relative paths from dirroot, use true for performance reasons
Return values
arrayof (string)name => (string|null)location

◆ get_core_subsystems() [2/2]

static get_core_subsystems ( )
static

List all core subsystems and their location.

This is a list of components that are part of the core and their language strings are defined in /lang/en/<<subsystem>>.php. If a given plugin is not listed here and it does not have proper plugintype prefix, then it is considered as course activity module.

The location is absolute file path to dir. NULL means there is no special directory for this subsystem. If the location is set, the subsystem's renderer.php is expected to be there.

Return values
arrayof (string)name => (string|null)full dir location

◆ get_course()

get_course ( $courseid,
$clone = true )

Gets a course object from database.

If the course id corresponds to an already-loaded $COURSE or $SITE object, then the loaded object will be used, saving a database query.

If it reuses an existing object, by default the object will be cloned. This means you can modify the object safely without affecting other code.

Parameters
int$courseidCourse id
bool$cloneIf true (default), makes a clone of the record
Return values
stdClassA course object
Exceptions
dml_exceptionIf not found in database

◆ get_course_and_cm_from_cmid()

get_course_and_cm_from_cmid ( $cmorid,
$modulename = '',
$courseorid = 0,
$userid = 0 )

Efficiently retrieves the $course (stdclass) and $cm (cm_info) objects, given a cmid.

If module name is also provided, it will ensure the cm is of that type.

Usage: list($course, $cm) = get_course_and_cm_from_cmid($cmid, 'forum');

Using this method has a performance advantage because it works by loading modinfo for the course - which will then be cached and it is needed later in most requests. It also guarantees that the $cm object is a cm_info and not a stdclass.

The $course object can be supplied if already known and will speed up this function - although it is more efficient to use this function to get the course if you are starting from a cmid.

To avoid security problems and obscure bugs, you should always specify $modulename if the cmid value came from user input.

By default this obtains information (for example, whether user can access the activity) for current user, but you can specify a userid if required.

Parameters
stdClass | int$cmoridId of course-module, or database object
string$modulenameOptional modulename (improves security)
stdClass | int$courseoridOptional course object if already loaded
int$useridOptional userid (default = current)
Return values
arrayArray with 2 elements $course and $cm
Exceptions
moodle_exceptionIf the item doesn't exist or is of wrong module name

◆ get_course_and_cm_from_instance()

get_course_and_cm_from_instance ( $instanceorid,
$modulename,
$courseorid = 0,
$userid = 0 )

Efficiently retrieves the $course (stdclass) and $cm (cm_info) objects, given an instance id or record and module name.

Usage: list($course, $cm) = get_course_and_cm_from_instance($forum, 'forum');

Using this method has a performance advantage because it works by loading modinfo for the course - which will then be cached and it is needed later in most requests. It also guarantees that the $cm object is a cm_info and not a stdclass.

The $course object can be supplied if already known and will speed up this function - although it is more efficient to use this function to get the course if you are starting from an instance id.

By default this obtains information (for example, whether user can access the activity) for current user, but you can specify a userid if required.

Parameters
stdclass | int$instanceoridId of module instance, or database object
string$modulenameModulename (required)
stdClass | int$courseoridOptional course object if already loaded
int$useridOptional userid (default = current)
Return values
arrayArray with 2 elements $course and $cm
Exceptions
moodle_exceptionIf the item doesn't exist or is of wrong module name

◆ get_course_category()

get_course_category ( )
Deprecated
since 2.5. Please use core_course_category\get($catid, IGNORE_MISSING) or core_course_category\get($catid, MUST_EXIST).

◆ get_course_category_tree()

get_course_category_tree ( )
Deprecated
since 2.5

◆ get_course_context()

get_course_context ( )
Deprecated
since 2.2

◆ get_course_display_name_for_list()

get_course_display_name_for_list ( $course)

Gets the name of a course to be displayed when showing a list of courses.

By default this is just $course->fullname but user can configure it. The result of this function should be passed through print_string.

Parameters
stdClass | core_course_list_element$courseMoodle course object
Return values
stringDisplay name of course (either fullname or short + fullname)

◆ get_course_mods()

object get_course_mods ( $courseid)

MODULE FUNCTIONS /////////////////////////////////////////////////.

Just gets a raw list of all modules in a course

Parameters
int$courseidThe id of the course as found in the 'course' table.
Return values
array

◆ get_course_participants()

get_course_participants ( )
Deprecated
use get_enrolled_users($context) instead.

◆ get_course_section()

get_course_section ( )
Deprecated
since 2.4

◆ get_courseid_from_context()

get_courseid_from_context ( )
Deprecated
since 2.2

◆ get_coursemodule_from_id()

object get_coursemodule_from_id ( $modulename,
$cmid,
$courseid = 0,
$sectionnum = false,
$strictness = IGNORE_MISSING )

Given an id of a course module, finds the coursemodule description.

Please note that this function performs 1-2 DB queries. When possible use cached course modinfo. For example get_fast_modinfo($courseorid)->get_cm($cmid) See also cm_info::get_course_module_record()

Parameters
string$modulenamename of module type, eg. resource, assignment,... (optional, slower and less safe if not specified)
int$cmidcourse module id (id in course_modules table)
int$courseidoptional course id for extra validation
bool$sectionnuminclude relative section number (0,1,2 ...)
int$strictnessIGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; IGNORE_MULTIPLE means return first, ignore multiple records found(not recommended); MUST_EXIST means throw exception if no record or multiple records found
Return values
stdClass

◆ get_coursemodule_from_instance()

object get_coursemodule_from_instance ( $modulename,
$instance,
$courseid = 0,
$sectionnum = false,
$strictness = IGNORE_MISSING )

Given an instance number of a module, finds the coursemodule description.

Please note that this function performs DB query. When possible use cached course modinfo. For example get_fast_modinfo($courseorid)->instances[$modulename][$instance] See also cm_info::get_course_module_record()

Parameters
string$modulenamename of module type, eg. resource, assignment,...
int$instancemodule instance number (id in resource, assignment etc. table)
int$courseidoptional course id for extra validation
bool$sectionnuminclude relative section number (0,1,2 ...)
int$strictnessIGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; IGNORE_MULTIPLE means return first, ignore multiple records found(not recommended); MUST_EXIST means throw exception if no record or multiple records found
Return values
stdClass

◆ get_coursemodules_in_course()

get_coursemodules_in_course ( $modulename,
$courseid,
$extrafields = '' )

Returns all course modules of given activity in course.

Parameters
string$modulenameThe module name (forum, quiz, etc.)
int$courseidThe course id to get modules for
string$extrafieldsextra fields starting with m.
Return values
arrayArray of results

◆ get_courses() [1/2]

core_course_category::get_courses ( $options = array())

Retrieves the list of courses accessible by user.

was called with option 'summary'.

Not all information is cached, try to avoid calling this method twice in the same request.

The following fields are always retrieved:

  • id, visible, fullname, shortname, idnumber, category, sortorder

If you plan to use properties/methods core_course_list_element\$summary and/or core_course_list_element\get_course_contacts() you can preload this information using appropriate 'options'. Otherwise they will be retrieved from DB on demand and it may end with bigger DB load.

Note that method core_course_list_element\has_summary() will not perform additional DB queries even if $options['summary'] is not specified

List of found course ids is cached for 10 minutes. Cache may be purged prior to this when somebody edits courses or categories, however it is very difficult to keep track of all possible changes that may affect list of courses.

Parameters
array$optionsoptions for retrieving children
  • recursive - return courses from subcategories as well. Use with care, this may be a huge list!
  • summary - preloads fields 'summary' and 'summaryformat'
  • coursecontacts - preloads course contacts
  • sort - list of fields to sort. Example array('idnumber' => 1, 'shortname' => 1, 'id' => -1) will sort by idnumber asc, shortname asc and id desc. Default: array('sortorder' => 1) Only cached fields may be used for sorting!
  • offset
  • limit - maximum number of children to return, 0 or null for no limit
  • idonly - returns the array or course ids instead of array of objects used only in get_courses_count()
Return values
core_course_list_element[]

Otherwise will be retrieved from DB on first request

◆ get_courses() [2/2]

object get_courses ( $categoryid = "all",
$sort = "c.sortorder ASC",
$fields = "c.*" )

Returns list of courses, for whole site, or category.

Returns list of courses, for whole site, or category Important: Using c.* for fields is extremely expensive because we are using distinct. You almost NEVER need all the fields in such a large SELECT

Consider using core_course_category\get_courses() or core_course_category\search_courses() instead since they use caching.

@global object @global object @uses CONTEXT_COURSE

Parameters
string | int$categoryidEither a category id or 'all' for everything
string$sortA field and direction to sort by
string$fieldsThe additional fields to return (note that "id, category, visible" are always present)
Return values
arrayArray of courses

◆ get_courses_page()

get_courses_page ( )
Deprecated
since Moodle 3.7

◆ get_courses_search()

object get_courses_search ( $searchterms,
$sort,
$page,
$recordsperpage,
& $totalcount,
$requiredcapabilities = array(),
$searchcond = [],
$params = [] )

A list of courses that match a search.

@global object

Parameters
array$searchtermsAn array of search criteria
string$sortA field and direction to sort by
int$pageThe page number to get
int$recordsperpageThe number of records per page
int$totalcountPassed in by reference.
array$requiredcapabilitiesExtra list of capabilities used to filter courses
array$searchcondadditional search conditions, for example ['c.enablecompletion = :p1']
array$paramsnamed parameters for additional search conditions, for example ['p1' => 1]
Return values
stdClass[]$COURSE records

◆ get_courses_wmanagers()

get_courses_wmanagers ( )
Deprecated
since 2.5

◆ get_current_group()

get_current_group ( )
Deprecated
Since year 2006 - please do not use this function any more.

◆ get_db_directories()

get_db_directories ( )

Returns list of all directories where we expect install.xml files.

Return values
arrayArray of paths

◆ get_db_handle()

get_db_handle ( )
abstractprotected

Gets db handle currently used with queries.

Return values
resource

◆ get_default_home_page()

get_default_home_page ( )

Returns the default home page to display if current one is not defined or can't be applied.

The default behaviour is to return Dashboard if it's enabled or My courses page if it isn't.

Return values
intThe default home page.

◆ get_device_cfg_var_name()

get_device_cfg_var_name ( )
Deprecated
since 2.6

◆ get_device_type()

get_device_type ( )
Deprecated
since 2.6

◆ get_device_type_list()

get_device_type_list ( )
Deprecated
since 2.6

◆ get_directory_list()

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.

If excludefiles is defined, then that file/directory is ignored If getdirs is true, then (sub)directories are included in the output If getfiles is true, then files are included in the output (at least one of these must be true!)

Todo
Finish documenting this function. Add examples of $excludefile usage.
Parameters
string$rootdirA given root directory to start from
string | array$excludefilesIf defined then the specified file/directory is ignored
bool$descendIf true then subdirectories are recursed as well
bool$getdirsIf true then (sub)directories are included in the output
bool$getfilesIf true then files are included in the output
Return values
arrayAn array with all the filenames in all subdirectories, relative to the given rootdir

◆ get_directory_size()

get_directory_size ( $rootdir,
$excludefile = '' )

Adds up all the files in a directory and works out the size.

Parameters
string$rootdirThe directory to start from
string$excludefileA file to exclude when summing directory size
Return values
intThe summed size of all files and subfiles within the root directory

◆ get_docs_url()

get_docs_url ( $path = null)

Returns the Moodle Docs URL in the users language for a given 'More help' link.

There are three cases:

  1. In the normal case, $path will be a short relative path 'component/thing', like 'mod/folder/view' 'group/import'. This gets turned into an link to MoodleDocs in the user's language, and for the appropriate Moodle version. E.g. 'group/import' may become 'http://docs.moodle.org/2x/en/group/import'. The 'http://docs.moodle.org' bit comes from $CFG->docroot.

This is the only option that should be used in standard Moodle code. The other two options have been implemented because they are useful for third-party plugins.

  1. $path may be an absolute URL, starting http:// or https://. In this case, the link is used as is.
  2. $path may start %WWWROOT%%, in which case that is replaced by $CFG->wwwroot to make the link.
Parameters
string$paththe place to link to. See above for details.
Return values
stringThe MoodleDocs URL in the user's language. for example $path}

◆ get_emoticon_manager()

get_emoticon_manager ( )

Factory function for emoticon_manager.

Return values
emoticon_managersingleton

◆ get_enabled_auth_plugins()

get_enabled_auth_plugins ( $fix = false)

Returns array of active auth plugins.

Parameters
bool$fixfix $CFG->auth if needed. Only set if logged in as admin.
Return values
array

◆ get_enrolled_join()

get_enrolled_join ( context $context,
$useridcolumn,
$onlyactive = false,
$onlysuspended = false,
$enrolid = 0 )

Returns array with sql joins and parameters returning all ids of users enrolled into course.

This function is using 'ej[0-9]+_' prefix for table names and parameters.

Exceptions
coding_exception
Parameters
context$context
string$useridcolumnUser id column used the calling query, e.g. u.id
bool$onlyactiveconsider only active enrolments in enabled plugins and time restrictions
bool$onlysuspendedinverse of onlyactive, consider only suspended enrolments
int$enrolidThe enrolment ID. If not 0, only users enrolled using this enrolment method will be returned.
Return values
core\dml\sql_joinContains joins, wheres, params

◆ get_enrolled_sql()

get_enrolled_sql ( context $context,
$withcapability = '',
$groupids = 0,
$onlyactive = false,
$onlysuspended = false,
$enrolid = 0 )

Returns array with sql code and parameters returning all ids of users enrolled into course.

This function is using 'eu[0-9]+_' prefix for table names and parameters.

Parameters
context$context
string$withcapability
int | array$groupidsThe groupids, 0 or [] means all groups and USERSWITHOUTGROUP no group
bool$onlyactiveconsider only active enrolments in enabled plugins and time restrictions
bool$onlysuspendedinverse of onlyactive, consider only suspended enrolments
int$enrolidThe enrolment ID. If not 0, only users enrolled using this enrolment method will be returned.
Return values
arraylist($sql, $params)

◆ get_enrolled_users()

get_enrolled_users ( context $context,
$withcapability = '',
$groupids = 0,
$userfields = 'u.*',
$orderby = null,
$limitfrom = 0,
$limitnum = 0,
$onlyactive = false )

Returns list of users enrolled into course.

Parameters
context$context
string$withcapability
int | array$groupidsThe groupids, 0 or [] means all groups and USERSWITHOUTGROUP no group
string$userfieldsrequested user record fields
string$orderby
int$limitfromreturn a subset of records, starting at this point (optional, required if $limitnum is set).
int$limitnumreturn a subset comprising this many records (optional, required if $limitfrom is set).
bool$onlyactiveconsider only active enrolments in enabled plugins and time restrictions
Return values
arrayof user records

◆ get_enrolled_with_capabilities_join()

get_enrolled_with_capabilities_join ( context $context,
$prefix = '',
$capability = '',
$groupids = 0,
$onlyactive = false,
$onlysuspended = false,
$enrolid = 0 )

Returns an array of joins, wheres and params that will limit the group of users to only those enrolled and with given capability (if specified).

Note this join will return duplicate rows for users who have been enrolled several times (e.g. as manual enrolment, and as self enrolment). You may need to use a SELECT DISTINCT in your query (see get_enrolled_sql for example).

In case is guaranteed some of the joins never match any rows, the resulting join_sql->cannotmatchanyrows will be true. This happens when the capability is prohibited.

Parameters
context$context
string$prefixoptional, a prefix to the user id column
string | array$capabilityoptional, may include a capability name, or array of names. If an array is provided then this is the equivalent of a logical 'OR', i.e. the user needs to have one of these capabilities.
int | array$groupidsThe groupids, 0 or [] means all groups and USERSWITHOUTGROUP no group
bool$onlyactiveconsider only active enrolments in enabled plugins and time restrictions
bool$onlysuspendedinverse of onlyactive, consider only suspended enrolments
int$enrolidThe enrolment ID. If not 0, only users enrolled using this enrolment method will be returned.
Return values
core\dml\sql_joinContains joins, wheres, params and cannotmatchanyrows

◆ get_environment_for_version()

get_environment_for_version ( $version,
$env_select )

This function will return the xmlized data belonging to one Moodle version.

Parameters
string$versiontop version from which we start to look backwards
int | string$env_selectone of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. String means plugin name.
Return values
mixedthe xmlized structure or false on error

◆ get_exception_info()

get_exception_info ( $ex)

Returns detailed information about specified exception.

Parameters
Throwable$exany sort of exception or throwable.
Return values
stdClassstandardised info to display. Fields are clear if you look at the end of this function.

◆ get_extra_user_fields()

get_extra_user_fields ( )

◆ get_extra_user_fields_sql()

get_extra_user_fields_sql ( )

◆ get_fast_modinfo()

get_fast_modinfo ( $courseorid,
$userid = 0,
$resetonly = false )

Returns reference to full info about modules in course (including visibility).

Cached and as fast as possible (0 or 1 db query).

use get_fast_modinfo($courseid, 0, true) to reset the static cache for particular course use get_fast_modinfo(0, 0, true) to reset the static cache for all courses

use rebuild_course_cache($courseid, true) to reset the application AND static cache for particular course when it's contents has changed

Parameters
int | stdClass$courseoridobject from DB table 'course' (must have field 'id' and recommended to have field 'cacherev') or just a course id. Just course id is enough when calling get_fast_modinfo() for current course or site or when calling for any other course for the second time.
int$useridUser id to populate 'availble' and 'uservisible' attributes of modules and sections. Set to 0 for current user (default). Set to -1 to avoid calculation of dynamic user-depended data.
bool$resetonlywhether we want to get modinfo or just reset the cache
Return values
course_modinfo|nullModule information for course, or null if resetting
Exceptions
moodle_exceptionwhen course is not found (nothing is thrown if resetting)

◆ get_file_argument()

get_file_argument ( )

Extracts file argument either from file parameter or PATH_INFO.

Note: $scriptname parameter is not needed anymore

Return values
stringfile path (only safe characters)

◆ get_file_browser()

get_file_browser ( )

Returns local file storage instance.

Return values
file_browser

◆ get_file_packer()

get_file_packer ( $mimetype = 'application/zip')

Returns file packer.

Parameters
string$mimetypedefault application/zip
Return values
file_packer

◆ get_file_storage()

get_file_storage ( $reset = false)

Returns local file storage instance.

Return values
file_storage

◆ get_file_url()

get_file_url ( )
Deprecated
since 3.1 - replacement legacy file API methods can be found on the moodle_url class, for example: The moodle_url\make_legacyfile_url() method can be used to generate a legacy course file url. To generate course module file.php url the moodle_url\make_file_url() should be used.

◆ get_formatted_help_string()

get_formatted_help_string ( $identifier,
$component,
$ajax = false,
$a = null )

Get the value of a help string fully prepared for display in the current language.

Parameters
string$identifierThe identifier of the string to search for.
string$componentThe module the string is associated with.
boolean$ajaxWhether this help is called from an AJAX script. This is used to influence text formatting and determines which format to output the doclink in.
string | object | array$aAn object, string or number that can be used within translation strings
Return values
stdClassAn object containing:
  • heading: Any heading that there may be for this help string.
  • text: The wiki-formatted help string.
  • doclink: An object containing a link, the linktext, and any additional CSS classes to apply to that link. Only present if $ajax = false.
  • completedoclink: A text representation of the doclink. Only present if $ajax = true.

◆ get_generic_section_name()

get_generic_section_name ( )
Deprecated
since 2.4

◆ get_google_client()

get_google_client ( )

Wrapper to get a Google Client object.

This automatically sets the config to Moodle's defaults.

Return values
Google_Client

◆ get_group_picture_url()

get_group_picture_url ( $group,
$courseid,
$large = false,
$includetoken = false )

Return the url to the group picture.

Parameters
stdClass$groupA group object.
int$courseidThe course ID for the group.
bool$largeA large or small group picture? Default is small.
boolean$includetokenWhether to use a user token when displaying this group image. True indicates to generate a token for current user, and integer value indicates to generate a token for the user whose id is the value indicated. If the group picture is included in an e-mail or some other location where the audience is a specific user who will not be logged in when viewing, then we use a token to authenticate the user.
Return values
moodle_urlReturns the url for the group picture.

◆ get_home_page()

get_home_page ( )

Gets the homepage to use for the current user.

Return values
intOne of HOMEPAGE_*

◆ get_host_from_url()

get_host_from_url ( $url)

Returns host part from url.

Parameters
string$urlfull url
Return values
stringhost, null if not found

◆ get_html_lang()

get_html_lang ( $dir = false)

Return a string containing 'lang', xml:lang and optionally 'dir' HTML attributes.

Internationalisation, for print_header and backup/restorelib.

Parameters
bool$dirDefault false
Return values
stringAttributes

◆ get_html_lang_attribute_value()

get_html_lang_attribute_value ( string $langcode)

Converts a language code to hyphen-separated format in accordance to the BCP47 syntax.

For additional information, check out MDN web docs - lang.

Parameters
string$langcodeThe language code to convert.
Return values
string

◆ get_import_export_formats()

get_import_export_formats ( $type)

Get list of available import or export formats.

Parameters
string$type'import' if import list, otherwise export list assumed
Return values
arraysorted list of import/export formats available

◆ get_latest_version_available()

get_latest_version_available ( $version,
$env_select )

This function will return the most recent version in the environment.xml file previous or equal to the version requested.

Parameters
string$versiontop version from which we start to look backwards
int$env_selectone of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use.
Return values
string|boolstring more recent version or false if not found

◆ get_level()

get_level ( $element)

Here all the restrict functions are coded to be used by the environment checker.

All those functions will receive the result object and will return it modified as needed (status and bypass string)

Parameters
array$elementthe element from the environment.xml file that should have either a level="required" or level="optional" attribute.
Return values
string"required" or "optional".

◆ get_list_of_charsets()

get_list_of_charsets ( )

Returns a list of charset codes.

Returns a list of charset codes. It's hardcoded, so they should be added manually (checking that such charset is supported by the texlib library!)

Return values
arrayAnd associative array with contents in the form of charset => charset

◆ get_list_of_environment_versions()

get_list_of_environment_versions ( $contents)

This function will return the list of Moodle versions available.

Return values
arrayof versions

◆ get_list_of_plugins()

get_list_of_plugins ( $directory = 'mod',
$exclude = '',
$basedir = '' )

Lists plugin-like directories within specified directory.

This function was originally used for standard Moodle plugins, please use new core_component\get_plugin_list() now.

This function is used for general directory listing and backwards compatility.

Parameters
string$directoryrelative directory from root
string$excludedir name to exclude from the list (defaults to none)
string$basedirfull path to the base dir where $plugin resides (defaults to $CFG->dirroot)
Return values
arraySorted array of directory names found under the requested parameters

◆ get_list_of_themes()

get_list_of_themes ( )

Returns a list of valid and compatible themes.

Return values
array

◆ get_list_of_timezones()

get_list_of_timezones ( )
Deprecated
since Moodle 2.9

◆ get_local_referer()

get_local_referer ( $stripquery = true)

Returns the cleaned local URL of the HTTP_REFERER less the URL query string parameters if required.

Parameters
bool$stripqueryif true, also removes the query part of the url.
Return values
stringThe resulting referer or empty string.

◆ get_log_manager()

get_log_manager ( $forcereload = false)

LOG FUNCTIONS /////////////////////////////////////////////////////.

Get instance of log manager.

Parameters
bool$forcereload
Return values
core\log\manager

◆ get_login_url()

get_login_url ( )

Returns full login url.

Any form submissions for authentication to this URL must include username, password as well as a logintoken generated by core\session\manager\get_login_token().

Return values
stringlogin url

◆ get_logs()

get_logs ( )
Deprecated
since Moodle 3.2

◆ get_logs_usercourse()

get_logs_usercourse ( )
Deprecated
since Moodle 3.2

◆ get_logs_userday()

get_logs_userday ( )
Deprecated
since Moodle 3.2

◆ get_mailer()

get_mailer ( $action = 'get')

Get mailer instance, enable buffering, flush buffer or disable buffering.

Parameters
string$action'get', 'buffer', 'close' or 'flush'
Return values
moodle_phpmailer|nullmailer instance if 'get' used or nothing

◆ get_max_courses_in_category()

get_max_courses_in_category ( )

Return maximum number of courses in a category.

@uses MAX_COURSES_IN_CATEGORY

Return values
intnumber of courses

◆ get_max_upload_file_size()

get_max_upload_file_size ( $sitebytes = 0,
$coursebytes = 0,
$modulebytes = 0,
$unused = false )

Returns the maximum size for uploading files.

There are seven possible upload limits:

  1. in Apache using LimitRequestBody (no way of checking or changing this)
  2. in php.ini for 'upload_max_filesize' (can not be changed inside PHP)
  3. in .htaccess for 'upload_max_filesize' (can not be changed inside PHP)
  4. in php.ini for 'post_max_size' (can not be changed inside PHP)
  5. by the Moodle admin in $CFG->maxbytes
  6. by the teacher in the current course $course->maxbytes
  7. by the teacher for the current module, eg $assignment->maxbytes

These last two are passed to this function as arguments (in bytes). Anything defined as 0 is ignored. The smallest of all the non-zero numbers is returned.

Todo
Finish documenting this function
Parameters
int$sitebytesSet maximum size
int$coursebytesCurrent course $course->maxbytes (in bytes)
int$modulebytesCurrent module ->maxbytes (in bytes)
bool$unusedThis parameter has been deprecated and is not used any more.
Return values
intThe maximum size for uploading files.

◆ get_max_upload_sizes()

get_max_upload_sizes ( $sitebytes = 0,
$coursebytes = 0,
$modulebytes = 0,
$custombytes = null )

Returns an array of possible sizes in local language.

Related to get_max_upload_file_size() - this function returns an array of possible sizes in an array, translated to the local language.

The list of options will go up to the minimum of $sitebytes, $coursebytes or $modulebytes.

If $coursebytes or $sitebytes is not 0, an option will be included for "Course/Site upload limit (X)" with the value set to 0. This option will be the first in the list.

@uses SORT_NUMERIC

Parameters
int$sitebytesSet maximum size
int$coursebytesCurrent course $course->maxbytes (in bytes)
int$modulebytesCurrent module ->maxbytes (in bytes)
int | array$custombytescustom upload size/s which will be added to list, Only value/s smaller then maxsize will be added to list.
Return values
array

◆ get_mnet_environment()

get_mnet_environment ( )

helper function to load up and initialise the mnet environment this must be called before you use mnet functions.

Return values
mnet_environmentthe equivalent of old $MNET global

◆ get_mnet_remote_client()

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.

Return values
mnet_remote_clientthe equivalent of old $MNETREMOTE_CLIENT global

◆ get_module_metadata()

get_module_metadata ( )
Deprecated
since 3.9

◆ get_moodle_cookie()

get_moodle_cookie ( )

Gets a moodle cookie with a weakly encrypted username.

Return values
stringusername

◆ get_my_remotecourses()

object get_my_remotecourses ( $userid = 0)

List of remote courses that a user has access to via MNET.

Works only on the IDP

@global object

Parameters
int@userid The user id to get remote courses for
Return values
arrayArray of $COURSE of course objects

◆ get_my_remotehosts()

object get_my_remotehosts ( )

List of remote hosts that a user has access to via MNET.

Works on the SP

@global object

Return values
array|boolArray of host objects or false

◆ get_newuser_language()

get_newuser_language ( )

Returns the string of the language for the new user.

Return values
stringlanguage for the new user

◆ get_next_version()

get_next_version ( int $questionbankentryid)

Get the next version number to create base on a Question bank entry id.

Parameters
int$questionbankentryidQuestion bank entry id.
Return values
intnext version number.
Exceptions
dml_exception

◆ get_other_mapping()

static core\event\get_other_mapping ( )
static

Used for maping events on restore.

Return values
bool

◆ get_parent_contextid()

get_parent_contextid ( )
Deprecated
since Moodle 2.2

◆ get_parent_contexts()

get_parent_contexts ( )
Deprecated
since 2.2, use $context->get_parent_context_ids() instead

◆ get_parent_language()

get_parent_language ( $lang = null)

Returns parent language of current active language if defined.

Parameters
string$langnull means current language
Return values
string

◆ get_password_peppers()

get_password_peppers ( )

Get the available password peppers.

The latest pepper is checked for minimum entropy as part of this function. We only calculate the entropy of the most recent pepper, because passwords are always updated to the latest pepper, and in the past we may have enforced a lower minimum entropy. Also, we allow the latest pepper to be empty, to allow admins to migrate off peppers.

Return values
arrayThe password peppers.
Exceptions
coding_exceptionIf the entropy of the password pepper is less than the recommended minimum.

◆ get_performance_info()

get_performance_info ( )

get_performance_info() pairs up with init_performance_info() loaded in setup.php.

Returns an array with 'html' and 'txt' values ready for use, and each of the individual stats provided separately as well.

Return values
array

◆ get_performance_summary()

performance_measuring_filter_manager::get_performance_summary ( )

Return performance information, in the form required by get_performance_info().

Return values
arraythe performance info.

◆ get_plugin_directory()

get_plugin_directory ( $plugintype,
$name )
static

Returns the exact absolute path to plugin directory.

Parameters
string$plugintypetype of plugin
string$pluginnamename of the plugin
Return values
stringfull path to plugin directory; null if not found
Deprecated
since 2.6, use core_component\get_plugin_directory()
Parameters
string$plugintypetype of plugin
string$namename of the plugin
Return values
stringfull path to plugin directory; NULL if not found

◆ get_plugin_list()

get_plugin_list ( $plugintype)
static

Get list of plugins of given type.

Use when listing real plugins of one type.

Parameters
string$plugintype
Return values
arrayas (string)pluginname => (string)fulldir
Deprecated
since 2.6, use core_component\get_plugin_list()
Parameters
string$plugintypetype of plugin
Return values
arrayname=>fulllocation pairs of plugins of given type

◆ get_plugin_list_with_class()

get_plugin_list_with_class ( $plugintype,
$class,
$file = null )
static

Get a list of all the plugins of a given type that define a certain class in a certain file.

The plugin component names and class names are returned.

Parameters
string$plugintypethe type of plugin, e.g. 'mod' or 'report'.
string$classthe part of the name of the class after the frankenstyle prefix. e.g 'thing' if you are looking for classes with names like report_courselist_thing. If you are looking for classes with the same name as the plugin name (e.g. qtype_multichoice) then pass ''. Frankenstyle namespaces are also supported.
string$filethe name of file within the plugin that defines the class.
Return values
arraywith frankenstyle plugin names as keys (e.g. 'report_courselist', 'mod_forum') and the class names as values (e.g. 'report_courselist_thing', 'qtype_multichoice').

The plugin component names and class names are returned.

Deprecated
since 2.6, use core_component\get_plugin_list_with_class()
Parameters
string$plugintypethe type of plugin, e.g. 'mod' or 'report'.
string$classthe part of the name of the class after the frankenstyle prefix. e.g 'thing' if you are looking for classes with names like report_courselist_thing. If you are looking for classes with the same name as the plugin name (e.g. qtype_multichoice) then pass ''.
string$filethe name of file within the plugin that defines the class.
Return values
arraywith frankenstyle plugin names as keys (e.g. 'report_courselist', 'mod_forum') and the class names as values (e.g. 'report_courselist_thing', 'qtype_multichoice').

◆ get_plugin_list_with_file() [1/2]

static get_plugin_list_with_file ( $plugintype,
$file,
$include = false )
static

Get a list of all the plugins of a given type that contain a particular file.

Parameters
string$plugintypethe type of plugin, e.g. 'mod' or 'report'.
string$filethe name of file that must be present in the plugin. (e.g. 'view.php', 'db/install.xml').
bool$includeif true (default false), the file will be include_once-ed if found.
Return values
arraywith plugin name as keys (e.g. 'forum', 'courselist') and the path to the file relative to dirroot as value (e.g. "$CFG->dirroot/mod/forum/view.php").

◆ get_plugin_list_with_file() [2/2]

get_plugin_list_with_file ( )
Deprecated
since 2.6

◆ get_plugin_list_with_function()

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.

The plugin component names and function names are returned.

Parameters
string$plugintypethe type of plugin, e.g. 'mod' or 'report'.
string$functionthe part of the name of the function after the frankenstyle prefix. e.g 'hook' if you are looking for functions with names like report_courselist_hook.
string$filethe name of file within the plugin that defines the function. Defaults to lib.php.
Return values
arraywith frankenstyle plugin names as keys (e.g. 'report_courselist', 'mod_forum') and the function names as values (e.g. 'report_courselist_hook', 'forum_hook').

◆ get_plugin_types() [1/2]

get_plugin_types ( $fullpaths = true)

Lists all plugin types.

Deprecated
since 2.6, use core_component\get_plugin_types()
Parameters
bool$fullpathsfalse means relative paths from dirroot
Return values
arrayArray of strings - name=>location

◆ get_plugin_types() [2/2]

static get_plugin_types ( )
static

Get list of available plugin types together with their location.

Return values
arrayas (string)plugintype => (string)fulldir

◆ get_plugin_types_with_subplugins()

static get_plugin_types_with_subplugins ( )
static

Returns list of plugin types that allow subplugins.

Return values
arrayas (string)plugintype => (string)fulldir

◆ get_plugins_with_function()

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.

Parameters
string$functionthe part of the name of the function after the frankenstyle prefix. e.g 'hook' if you are looking for functions with names like report_courselist_hook.
string$filethe name of file within the plugin that defines the function. Defaults to lib.php.
bool$includeWhether to include the files that contain the functions or not.
bool$migratedtohookif true this is a deprecated lib.php callback, if hook callback is present then do nothing
Return values
arraywith [plugintype][plugin] = functionname

◆ get_print_section_cm_text()

get_print_section_cm_text ( )
Deprecated
since 2.5

◆ get_question_bank_entry()

get_question_bank_entry ( int $questionid)

Get the question_bank_entry object given a question id.

Parameters
int$questionidQuestion id.
Return values
false|mixed
Exceptions
dml_exception

◆ get_question_options()

get_question_options ( & $questions,
$loadtags = false,
$filtercourses = null )

Updates the question objects with question type specific information by calling {.

See also
get_question_options()}

Can be called either with an array of question objects or with a single question object.

Parameters
mixed$questionsEither an array of question objects to be updated or just a single question object
bool$loadtagsload the question tags from the tags table. Optional, default false.
stdClass[]$filtercoursesThe courses to filter the course tags by.
Return values
boolIndicates success or failure.

◆ get_question_version()

get_question_version ( $questionid)

Get the question versions given a question id in a descending sort .

Parameters
int$questionidQuestion id.
Return values
array
Exceptions
dml_exception

◆ get_real_size()

get_real_size ( $size = 0)

Converts numbers like 10M into bytes.

Parameters
string$sizeThe size to be converted
Return values
int

◆ get_recent_enrolments()

get_recent_enrolments ( )

◆ get_records_csv()

get_records_csv ( )
Deprecated
since Moodle 3.2
See also
csv_import_reader\load_csv_content()

◆ get_referer()

get_referer ( )
Deprecated
since Moodle 3.0 MDL-49360 - please do not use this function any more.

◆ get_related_contexts_string()

get_related_contexts_string ( )
Deprecated
since 2.2

◆ get_request_storage_directory()

get_request_storage_directory ( $exceptiononerror = true,
bool $forcecreate = false )

Get a per-request storage directory in the tempdir.

The directory is automatically cleaned up during the shutdown handler.

Parameters
bool$exceptiononerrorthrow exception if error encountered
bool$forcecreateForce creation of a new parent directory
Return values
stringReturns full path to directory if successful, false if not; may throw exception

◆ get_role_context_caps()

get_role_context_caps ( )
Deprecated
since Moodle 2.2

◆ get_roles_on_exact_context()

get_roles_on_exact_context ( )
Deprecated
since Moodle 3.6. Please use the get_roles_used_in_context().

◆ get_roles_with_assignment_on_context()

get_roles_with_assignment_on_context ( )
Deprecated
since Moodle 3.6. Please use the get_roles_used_in_context().

◆ get_safe_orderby()

get_safe_orderby ( array $orderbymap,
string $orderbykey,
string $direction = '',
bool $useprefix = true )

Prepare a safe ORDER BY statement from user interactable requests.

This allows safe user specified sorting (ORDER BY), by abstracting the SQL from the value being requested by the user. A standard string (and optional direction) can be specified, which will be mapped to a predefined allow list of SQL ordering. The mapping can optionally include a 'default', which will be used if the key provided is invalid.

Example usage: -If $orderbymap = [ 'courseid' => 'c.id', 'somecustomvalue'=> 'c.startdate, c.shortname', 'default' => 'c.fullname', ] -A value from the map array's keys can be passed in by a user interaction (eg web service) along with an optional direction. -get_safe_orderby($orderbymap, 'courseid', 'DESC') would return: ORDER BY c.id DESC -get_safe_orderby($orderbymap, 'somecustomvalue') would return: ORDER BY c.startdate, c.shortname -get_safe_orderby($orderbymap, 'invalidblah', 'DESC') would return: ORDER BY c.fullname DESC -If no default key was specified in $orderbymap, the invalidblah example above would return empty string.

Parameters
array$orderbymapAn array in the format [keystring => sqlstring]. A default fallback can be set with the key 'default'.
string$orderbykeyA string to be mapped to a key in $orderbymap.
string$directionOptional ORDER BY direction (ASC/DESC, case insensitive).
bool$useprefixWhether ORDER BY is prefixed to the output (true by default). This should not be modified in most cases. It is included to enable get_safe_orderby_multiple() to use this function multiple times.
Return values
stringThe ORDER BY statement, or empty string if $orderbykey is invalid and no default is mapped.

◆ get_safe_orderby_multiple()

get_safe_orderby_multiple ( array $orderbymap,
array $orderbykeys,
array $directions = [] )

Prepare a safe ORDER BY statement from user interactable requests using multiple values.

This allows safe user specified sorting (ORDER BY) similar to get_safe_orderby(), but supports multiple keys and directions. This is useful in cases where combinations of columns are needed and/or each item requires a specified direction (ASC/DESC). The mapping can optionally include a 'default', which will be used if the key provided is invalid.

Example usage: -If $orderbymap = [ 'courseid' => 'c.id', 'fullname'=> 'c.fullname', 'default' => 'c.startdate', ] -An array of values from the map's keys can be passed in by a user interaction (eg web service), with optional directions. -get_safe_orderby($orderbymap, ['courseid', 'fullname'], ['DESC', 'ASC']) would return: ORDER BY c.id DESC, c.fullname ASC -get_safe_orderby($orderbymap, ['courseid', 'invalidblah'], ['aaa', 'DESC']) would return: ORDER BY c.id, c.startdate DESC -If no default key was specified in $orderbymap, the invalidblah example above would return: ORDER BY c.id

Parameters
array$orderbymapAn array in the format [keystring => sqlstring]. A default fallback can be set with the key 'default'.
array$orderbykeysAn array of strings to be mapped to keys in $orderbymap.
array$directionsOptional array of ORDER BY direction (ASC/DESC, case insensitive). The array keys should match array keys in $orderbykeys.
Return values
stringThe ORDER BY statement, or empty string if $orderbykeys contains no valid items and no default is mapped.

◆ get_scales_menu()

object get_scales_menu ( $courseid = 0)

Returns a menu of all available scales from the site as well as the given course.

Parameters
int$courseidThe id of the course as found in the 'course' table.
Return values
array

◆ get_selected_theme_for_device_type()

get_selected_theme_for_device_type ( )
Deprecated
since 2.6

◆ get_separator()

get_separator ( )

Return the breadcrumb trail navigation separator.

Return values
stringHTML string.

◆ get_site()

get_site ( )

OTHER SITE AND COURSE FUNCTIONS /////////////////////////////////////////////.

Returns $course object of the top-level site.

Return values
objectA $COURSE object for the site, exception if not found

◆ get_site_identifier()

get_site_identifier ( )

Returns the site identifier.

Return values
string\$CFG-,>siteidentifier,firstmaking sure it is properly initialised.

◆ get_string()

get_string ( $identifier,
$component = '',
$a = null,
$lazyload = false )

Returns a localized string.

Returns the translated string specified by $identifier as for $module. Uses the same format files as STphp. $a is an object, string or number that can be used within translation strings

eg 'hello {$a->firstname} {$a->lastname}' or 'hello {$a}'

If you would like to directly echo the localized string use the function print_string()

Example usage of this function involves finding the string you would like a local equivalent of and using its identifier and module information to retrieve it.
If you open moodle/lang/en/moodle.php and look near line 278 you will find a string to prompt a user for their word for 'course' $string['course'] = 'Course'; So if you want to display the string 'Course' in any language that supports it on your site you just need to use the identifier 'course' $mystring = ''. get_string('course') .''; or If the string you want is in another file you'd take a slightly different approach. Looking in moodle/lang/en/calendar.php you find around line 75: $string['typecourse'] = 'Course event'; If you want to display the string "Course event" in any language supported you would use the identifier 'typecourse' and the module 'calendar' (because it is in the file calendar.php): $mystring = '

'. get_string('typecourse', 'calendar') .'

';

As a last resort, should the identifier fail to map to a string the returned string will be [[ $identifier ]]

In Moodle 2.3 there is a new argument to this function $lazyload. Setting $lazyload to true causes get_string to return a lang_string object rather than the string itself. The fetching of the string is then put off until the string object is first used. The object can be used by calling it's out method or by casting the object to a string, either directly e.g. (string)$stringobject or indirectly by using the string within another string or echoing it out e.g. echo $stringobject return "<p>{$stringobject}</p>"; It is worth noting that using $lazyload and attempting to use the string as an array key will cause a fatal error as objects cannot be used as array keys. But you should never do that anyway! For more information lang_string

Parameters
string$identifierThe key identifier for the localized string
string$componentThe module where the key identifier is stored, usually expressed as the filename in the language pack without the .php on the end but can also be written as mod/forum or grade/export/xls. If none is specified then moodle.php is used.
string | object | array | int$aAn object, string or number that can be used within translation strings
bool$lazyloadIf set to true a string object is returned instead of the string itself. The string then isn't calculated until it is first used.
Return values
stringThe localized string.
Exceptions
coding_exception

◆ get_string_filters()

filter_manager::get_string_filters ( $context)
protected

Get all the filters that apply to a given context for calls to format_string.

Parameters
context$contextthe context.
Return values
moodle_text_filter[]A text filter

◆ get_string_manager()

get_string_manager ( $forcereload = false)

Returns current string_manager instance.

The param $forcereload is needed for CLI installer only where the string_manager instance must be replaced during the install.php script life time.

Parameters
bool$forcereloadshall the singleton be released and new instance created instead?
Return values
core_string_manager

◆ get_strings()

get_strings ( $array,
$component = '' )

Converts an array of strings to their localized value.

Parameters
array$arrayAn array of strings
string$componentThe language module that these strings can be found in.
Return values
stdClasstranslated strings.

◆ get_subplugins()

static get_subplugins ( $component)
static

Return all subplugins of this component.

Parameters
string$component,.
Return values
array\$subtype,=>array($component,..),nullif no subtypes defined

◆ get_subsystem_directory()

static get_subsystem_directory ( $subsystem)
static

Returns the exact absolute path to plugin directory.

Parameters
string$subsystemtype of core subsystem
Return values
stringfull path to subsystem directory; null if not found

◆ get_subtype_parent()

static get_subtype_parent ( $type)
static

Returns parent of this subplugin type.

Parameters
string$type
Return values
stringparent component or null

◆ get_system_context()

get_system_context ( $cache = true)

Returns system context or null if can not be created yet.

See also
context_system\instance()
Deprecated
since 2.2
Parameters
bool$cacheuse caching
Return values
contextsystem context (null if context table not created yet)

◆ get_text_filters()

filter_manager::get_text_filters ( $context)
protected

Get all the filters that apply to a given context for calls to format_text.

Parameters
context$context
Return values
moodle_text_filter[]A text filter

◆ get_texteditor()

get_texteditor ( $editorname)

Returns instance of text editor.

Parameters
string$editornamename of editor (textarea, tiny, ...)
Return values
object|booltexeditor instance or false if does not exist

◆ get_time_interval_string()

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.

E.g. $intervalstring = get_time_interval_string(12345600, 12345660); Will produce the string: '0d 0h 1m'

Parameters
int$time1unix timestamp
int$time2unix timestamp
string$formatstring (can be lang string) containing format chars: https://www.php.net/manual/en/dateinterval.format.php.
bool$dropzeroesIf format is not provided and this is set to true, do not include zero time units. e.g. a duration of 3 days and 2 hours will be displayed as '3d 2h' instead of '3d 2h 0s'
bool$fullformatIf format is not provided and this is set to true, display time units in full format. e.g. instead of showing "3d", "3 days" will be returned.
Return values
stringthe formatted string describing the time difference, e.g. '10d 11h 45m'.

◆ get_timezone_offset()

get_timezone_offset ( )
Deprecated
since Moodle 2.9

◆ get_timezone_record()

get_timezone_record ( )
Deprecated
since Moodle 2.9

◆ get_trace()

core\task\get_trace ( )
protected

Get the progress_trace.

Return values
progress_trace

◆ get_used_table_names()

get_used_table_names ( )

Returns names of all known tables == tables that moodle knows about.

Return values
arrayArray of lowercase table names

◆ get_user_access_sitewide()

get_user_access_sitewide ( )

◆ get_user_courses_bycap()

get_user_courses_bycap ( )
Deprecated
since 2.2

◆ get_user_device_type()

get_user_device_type ( )
Deprecated
since 2.6

◆ get_user_field_name()

get_user_field_name ( )

◆ get_user_fieldnames()

get_user_fieldnames ( )

Returns an array of user fields.

Return values
arrayUser field/column names

◆ get_user_key()

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).

Parameters
string$scriptunique target identifier
int$userid
int$instanceoptional instance id
string$iprestrictionoptional ip restricted access
int$validuntilkey valid only until given date
Return values
stringaccess key value

◆ get_user_max_upload_file_size()

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.

This function takes in account get_max_upload_file_size() the user's capabilities

Parameters
context$contextThe context in which to check user capabilities
int$sitebytesSet maximum size
int$coursebytesCurrent course $course->maxbytes (in bytes)
int$modulebytesCurrent module ->maxbytes (in bytes)
stdClass$userThe user
bool$unusedThis parameter has been deprecated and is not used any more.
Return values
intThe maximum size for uploading files.

◆ get_user_preferences()

get_user_preferences ( $name = null,
$default = null,
$user = null )

Used to fetch user preference(s)

If no arguments are supplied this function will return all of the current user preferences as an array.

If a name is specified then this function attempts to return that particular preference value. If none is found, then the optional value $default is returned, otherwise null.

If a $user object is submitted it's 'preference' property is used for the preferences cache.

Parameters
string$nameName of the key to use in finding a preference value
mixed | null$defaultValue to be returned if the $name key is not set in the user preferences
stdClass | int | null$userA moodle user object or id, null means current user
Exceptions
coding_exception
Return values
string|mixed|nullA string containing the value of a single preference. An array with all of the preferences or null

◆ get_user_timezone()

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.

Parameters
float | int | string$tztimezone to calculate GMT time offset before calculating user timezone, 99 is default user timezone
Return values
float|string

◆ get_user_timezone_offset()

get_user_timezone_offset ( )
Deprecated
since Moodle 2.9

◆ get_users()

object get_users ( $get = true,
$search = '',
$confirmed = false,
array $exceptions = null,
$sort = 'firstname ASC',
$firstinitial = '',
$lastinitial = '',
$page = '',
$recordsperpage = '',
$fields = '*',
$extraselect = '',
array $extraparams = null )

Returns a subset of users.

@uses DEBUG_DEVELOPER @uses SQL_PARAMS_NAMED

Parameters
bool$getIf false then only a count of the records is returned
string$searchA simple string to search for
bool$confirmedA switch to allow/disallow unconfirmed users
array$exceptionsA list of IDs to ignore, eg 2,4,5,8,9,10
string$sortA SQL snippet for the sorting criteria to use
string$firstinitialUsers whose first name starts with $firstinitial
string$lastinitialUsers whose last name starts with $lastinitial
string$pageThe page or records to return
string$recordsperpageThe number of records to return per page
string$fieldsA comma separated list of fields to be returned from the chosen table.
Return values
array|int|bool$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.

◆ get_users_confirmed()

object get_users_confirmed ( )

Full list of users that have confirmed their accounts.

Return values
arrayof unconfirmed users

◆ get_users_from_config()

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.

All users are verified if they still have the necessary capability.

Parameters
string$valuethe value of the config setting.
string$capabilitythe capability - must match the one passed to the admin_setting_users_with_capability constructor.
bool$includeadminsinclude administrators.
Return values
arrayof user objects.

◆ get_users_listing()

get_users_listing ( $sort = 'lastaccess',
$dir = 'ASC',
$page = 0,
$recordsperpage = 0,
$search = '',
$firstinitial = '',
$lastinitial = '',
$extraselect = '',
array $extraparams = null,
$extracontext = null )

Return filtered (if provided) list of users in site, except guest and deleted users.

Parameters
string$sortAn SQL field to sort by
string$dirThe sort direction ASC|DESC
int$pageThe page or records to return
int$recordsperpageThe number of records to return per page
string$searchA simple string to search for
string$firstinitialUsers whose first name starts with $firstinitial
string$lastinitialUsers whose last name starts with $lastinitial
string$extraselectAn additional SQL select statement to append to the query
array$extraparamsAdditional parameters to use for the above $extraselect
stdClass$extracontextIf specified, will include user 'extra fields' as appropriate for current user and given context
Return values
arrayArray of $USER records

◆ getremoteaddr()

getremoteaddr ( $default = '0.0.0.0')

Returns most reliable client address.

Parameters
string$defaultIf an address can't be determined, then return this
Return values
stringThe remote IP address

◆ getweek()

getweek ( $startdate,
$thedate )

Given dates in seconds, how many weeks is the date from startdate The first week is 1, the second 2 etc ...

Parameters
int$startdateTimestamp for the start date
int$thedateTimestamp for the end date
Return values
string

◆ grade_print_tabs()

grade_print_tabs ( $active_type,
$active_plugin,
$plugin_info,
$return = false )

Print grading plugin selection tab-based navigation.

Deprecated
since Moodle 4.0. Tabs navigation has been replaced with tertiary navigation.
Parameters
string$active_typetype of plugin on current page - import, export, report or edit
string$active_pluginactive plugin type - grader, user, cvs, ...
array$plugin_infoArray of plugins
boolean$returnreturn as string
Return values
nothingor string if $return true

◆ groupmode()

groupmode ( )

This means that cm_info\$groupmode should be ignored and cm_info\$coursegroupmode be used instead.

Deprecated
since Moodle 2.0 MDL-14617 - please do not use this function any more.

◆ groups_course_module_visible()

groups_course_module_visible ( )
Deprecated
Since Moodle 2.8

◆ groups_filter_users_by_course_module_visible()

groups_filter_users_by_course_module_visible ( )
Deprecated
Since Moodle 2.8

◆ groups_get_all_groups_for_courses()

groups_get_all_groups_for_courses ( )
Deprecated
since Moodle 3.6.

◆ guest_user()

guest_user ( )

Retrieve the guest user object.

Return values
stdClassA $USER object

◆ has_monologo_icon()

static has_monologo_icon ( string $plugintype,
string $pluginname )
static

Checks for the presence of monologo icons within a plugin.

Only checks monologo icons in PNG and SVG formats as they are formats that can have transparent background.

Parameters
string$plugintypeThe plugin type.
string$pluginnameThe plugin name.
Return values
boolTrue if the plugin has a monologo icon

◆ hash()

moodle_text_filter::hash ( )
Deprecated
Since Moodle 3.0 MDL-50491. This was used by the old text filtering system, but no more.

◆ hash_internal_user_password()

hash_internal_user_password ( # string $password[\SensitiveParameter],
$fasthash = false,
$pepperlength = 0 )

Calculate hash for a plain text password.

Parameters
string$passwordPlain text password to be hashed.
bool$fasthashIf true, use a low number of rounds when generating the hash This is faster to generate but makes the hash less secure. It is used when lots of hashes need to be generated quickly.
int$pepperlengthLenght of the peppers
Return values
stringThe hashed password.
Exceptions
moodle_exceptionIf a problem occurs while generating the hash.

◆ hash_local_config_cache()

hash_local_config_cache ( )

Calculate a proper hash to be able to invalidate stale cached configs.

Only to be used to verify bootstrap.php status.

Return values
stringmd5 hash of all the sensible bits deciding if cached config is stale or no.

◆ hide_event()

hide_event ( )
Deprecated
please use calendar_event->toggle_visibility(false) instead.

◆ highlight()

highlight ( $needle,
$haystack,
$matchcase = false,
$prefix = '<span class="highlight">',
$suffix = '</span>' )

This function will highlight search words in a given string.

It cares about HTML and will not ruin links. It's best to use this function after performing any conversions to HTML.

Parameters
string$needleThe search string. Syntax like "word1 +word2 -word3" is dealt with correctly.
string$haystackThe string (HTML) within which to highlight the search terms.
boolean$matchcasewhether to do case-sensitive. Default case-insensitive.
string$prefixthe string to put before each search term found.
string$suffixthe string to put after each search term found.
Return values
stringThe highlighted HTML.

◆ highlightfast()

highlightfast ( $needle,
$haystack )

This function will highlight instances of $needle in $haystack.

It's faster that the above function highlight() and doesn't care about HTML or anything.

Parameters
string$needleThe string to search for
string$haystackThe string to search for $needle in
Return values
stringThe highlighted HTML

◆ html_is_blank()

html_is_blank ( $string)

Tests whether anything was returned by text editor.

This function is useful for testing whether something you got back from the HTML editor actually contains anything. Sometimes the HTML editor appear to be empty, but actually you get back a
tag or something.

Parameters
string$stringa string containing HTML.
Return values
booleandoes the string contain any actual content - that is text, images, objects, etc.

◆ html_to_text()

html_to_text ( $html,
$width = 75,
$dolinks = true )

Given HTML text, make it into plain text using external function.

Parameters
string$htmlThe text to be converted.
integer$widthWidth to wrap the text at. (optional, default 75 which is a good value for email. 0 means do not limit line length.)
boolean$dolinksBy default, any links in the HTML are collected, and printed as a list at the end of the HTML. If you don't want that, set this argument to false.
Return values
stringplain text equivalent of the HTML.

◆ httpsrequired()

httpsrequired ( )
Deprecated
Loginhttps is no longer supported

◆ idnumber_exist_in_question_category()

idnumber_exist_in_question_category ( $questionidnumber,
$categoryid,
$limitfrom = 0,
$limitnum = 1 )

Check if an idnumber exist in the category.

Parameters
int$questionidnumber
int$categoryid
int$limitfrom
int$limitnum
Return values
array

◆ imagecopybicubic()

imagecopybicubic ( $dst_img,
$src_img,
$dst_x,
$dst_y,
$src_x,
$src_y,
$dst_w,
$dst_h,
$src_w,
$src_h )

Copies a rectangular portion of the source image to another rectangle in the destination image.

This function calls imagecopyresampled() if it is available and GD version is 2 at least. Otherwise it reimplements the same behaviour. See the PHP manual page for more info.

@externalurl http://php.net/manual/en/function.imagecopyresampled.php

Parameters
resource | GdImage$dst_imgthe destination GD image resource
resource | GdImage$src_imgthe source GD image resource
int$dst_xvthe X coordinate of the upper left corner in the destination image
int$dst_ythe Y coordinate of the upper left corner in the destination image
int$src_xthe X coordinate of the upper left corner in the source image
int$src_ythe Y coordinate of the upper left corner in the source image
int$dst_wthe width of the destination rectangle
int$dst_hthe height of the destination rectangle
int$src_wthe width of the source rectangle
int$src_hthe height of the source rectangle
Return values
booltru on success, false otherwise

◆ in_object_vars()

in_object_vars ( $var,
$object )

Checks whether the given variable name is defined as a variable within the given object.

This will NOT work with stdClass objects, which have no class variables.

Parameters
string$varThe variable name
object$objectThe object to check
Return values
boolean

◆ increment_revision_number()

increment_revision_number ( $table,
$field,
$select,
array $params = null )

Increment standard revision field.

The revision are based on current time and are incrementing. There is a protection for runaway revisions, it may not go further than one hour into future.

The field has to be XMLDB_TYPE_INTEGER with size 10.

Parameters
string$table
string$fieldname of the field containing revision
string$selectuse empty string when updating all records
array$paramsoptional select parameters

◆ ini_get_bool()

ini_get_bool ( $ini_get_arg)

This function makes the return value of ini_get consistent if you are setting server directives through the .htaccess file in apache.

Current behavior for value set from php.ini On = 1, Off = [blank] Current behavior for value set from .htaccess On = On, Off = Off Contributed by jdell @ unr.edu

Parameters
string$ini_get_argThe argument to get
Return values
boolTrue for on false for not

◆ init_performance_info()

init_performance_info ( )

Initializes our performance info early.

Pairs up with get_performance_info() which is actually in moodlelib.php. This function is here so that we can call it before all the libs are pulled in.

@uses $PERF

◆ initialise_fullme()

initialise_fullme ( )

Initialises $FULLME and friends.

Private function. Should only be called from setup.php.

◆ initialise_fullme_cli()

initialise_fullme_cli ( )

Initialises $FULLME and friends for command line scripts.

This is a private method for use by initialise_fullme.

◆ initialise_local_config_cache()

initialise_local_config_cache ( )

Cache any immutable config locally to avoid constant DB lookups.

Only to be used only from lib/setup.php

◆ install_cli_database()

install_cli_database ( array $options,
$interactive )

Install Moodle DB, config.php must exist, there must not be any tables in db yet.

Parameters
array$optionsadminpass is mandatory
bool$interactive
Return values
void

◆ install_core()

install_core ( $version,
$verbose )

Install core moodle tables and initialize.

Parameters
float$versiontarget version
bool$verbose
Return values
void,maythrow exception

◆ install_db_validate()

install_db_validate ( $database,
$dbhost,
$dbuser,
$dbpass,
$dbname,
$prefix,
$dboptions )

This is in function because we want the /install.php to parse in PHP4.

Parameters
object$database
string$dbhsot
string$dbuser
string$dbpass
string$dbname
string$prefix
mixed$dboptions
Return values
string

◆ install_generate_configphp()

install_generate_configphp ( $database,
$cfg )

Returns content of config.php file.

Uses PHP_EOL for generating proper end of lines for the given platform.

Parameters
moodle_database$databasedatabase instance
object$cfgcopy of $CFG
Return values
string

◆ install_guess_wwwroot()

install_guess_wwwroot ( )

Tries to detect the right www root setting.

Return values
stringdetected www root

◆ install_helpbutton()

install_helpbutton ( $url,
$title = '' )

Print help button.

Parameters
string$url
string$titel
Return values
void

◆ install_ini_get_bool()

install_ini_get_bool ( $ini_get_arg)

Copy of.

See also
{ini_get_bool()}
Parameters
string$ini_get_arg
Return values
bool

◆ install_init_dataroot()

install_init_dataroot ( $dataroot,
$dirpermissions )

Creates dataroot if not exists yet, makes sure it is writable, add lang directory and add .htaccess just in case it works.

Parameters
string$datarootfull path to dataroot
int$dirpermissions
Return values
boolsuccess

◆ install_print_footer()

object install_print_footer ( $config,
$reload = false )

Prints installation page header, we can not use weblib yet in installer.

Parameters
stdClass$config
bool$reloadprint reload button instead of next
Return values
void

◆ install_print_header()

object install_print_header ( $config,
$stagename,
$heading,
$stagetext,
$stageclass = "alert-info" )

Prints installation page header, we can not use weblib yet in installer.

Parameters
stdClass$config
string$stagename
string$heading
string$stagetext
string$stageclass
Return values
void

◆ install_print_help_page()

object install_print_help_page ( $help)

Prints complete help page used during installation.

Does not return.

Parameters
string$help

◆ instance()

static filter_manager::instance ( )
static

Factory method.

Use this to get the filter manager.

Return values
filter_managerthe singleton instance.

◆ instance_is_visible()

object instance_is_visible ( $moduletype,
$module )

Determine whether a module instance is visible within a course.

Given a valid module object with info about the id and course, and the module's type (eg "forum") returns whether the object is visible or not according to the 'eye' icon only.

NOTE: This does NOT take into account visibility to a particular user. To get visibility access for a specific user, use get_fast_modinfo, get a cm_info object from this, and check the ->uservisible property; or use the core_availability\info_module\is_user_visible() static function.

Parameters
$moduletypeName of the module eg 'forum'
$moduleObject which is the instance of the module
Return values
boolSuccess

◆ invalidate_opcode_php_cache()

static invalidate_opcode_php_cache ( $file)
static

Invalidate opcode cache for given file, this is intended for php files that are stored in dataroot.

Note: we need it here because this class must be self-contained.

Parameters
string$file

◆ ip_is_public()

ip_is_public ( $ip)

Is IP address a public address?

Parameters
string$ipThe ip to check
Return values
booltrue if the ip is public

◆ iplookup_find_location()

iplookup_find_location ( $ip)

Returns location information.

Parameters
string$ip
Return values
array

◆ is_core_api()

static is_core_api ( $apiname)
static

Return true if apiname is a core API.

Parameters
string$apinamename of the API.
Return values
booltrue if core API.

◆ is_core_subsystem()

static is_core_subsystem ( $subsystemname)
static

Return true if subsystemname is core subsystem.

Parameters
string$subsystemnamename of the subsystem.
Return values
booltrue if core subsystem.

◆ is_course_participant()

is_course_participant ( )
Deprecated
use is_enrolled($context, $userid) instead.

◆ is_dataroot_insecure()

is_dataroot_insecure ( $fetchtest = false)

Try to verify that dataroot is not accessible from web.

Try to verify that dataroot is not accessible from web. It is not 100% correct but might help to reduce number of vulnerable sites. Protection from httpd.conf and .htaccess is not detected properly.

@uses INSECURE_DATAROOT_WARNING @uses INSECURE_DATAROOT_ERROR

Parameters
bool$fetchtesttry to test public access by fetching file, default false
Return values
mixedempty means secure, INSECURE_DATAROOT_ERROR found a critical problem, INSECURE_DATAROOT_WARNING might be problematic

◆ is_early_init()

is_early_init ( $backtrace)

This function encapsulates the tests for whether an exception was thrown in early init – either during setup.php or during init of $OUTPUT.

If another exception is thrown then, and if we do not take special measures, we would just get a very cryptic message "Exception thrown without a stack frame in Unknown on line 0". That makes debugging very hard, so we do take special measures in default_exception_handler, with the help of this function.

Parameters
array$backtracethe stack trace to analyse.
Return values
booleanwhether the stack trace is somewhere in output initialisation.

◆ is_enabled_auth()

is_enabled_auth ( $auth)

Checks if a given plugin is in the list of enabled authentication plugins.

Parameters
string$authAuthentication plugin.
Return values
booleanWhether the plugin is enabled.

◆ is_enrolled()

is_enrolled ( context $context,
$user = null,
$withcapability = '',
$onlyactive = false )

Returns true if user is enrolled (is participating) in course this is intended for students and teachers.

Since 2.2 the result for active enrolments and current user are cached.

Parameters
context$context
int | stdClass$userif null $USER is used, otherwise user object or id expected
string$withcapabilityextra capability name
bool$onlyactiveconsider only active enrolments in enabled plugins and time restrictions
Return values
bool

◆ is_float_problem()

is_float_problem ( )

Detects if float supports at least 10 decimal digits.

Detects if float supports at least 10 decimal digits and also if float-->string conversion works as expected.

Return values
booltrue if problem found

◆ is_https()

is_https ( )

Determines whether or not the Moodle site is being served over HTTPS.

This is done simply by checking the value of $CFG->wwwroot, which seems to be the only reliable method.

Return values
booleanTrue if site is served over HTTPS, false otherwise.

◆ is_in_popup()

is_in_popup ( )

Returns true if the page is displayed in a popup window.

Gets the information from the URL parameter inpopup.

Todo
Use a central function to create the popup calls all over Moodle and In the moment only works with resources and probably questions.
Return values
boolean

◆ is_internal_auth()

is_internal_auth ( $auth)

Returns true if an internal authentication method is being used.

if method not specified then, global default is assumed

Parameters
string$authForm of authentication required
Return values
bool

◆ is_latest()

is_latest ( string $version,
string $questionbankentryid )

Checks if question is the latest version.

Parameters
string$versionQuestion version to check.
string$questionbankentryidEntry to check against.
Return values
bool

◆ is_major_upgrade_required()

is_major_upgrade_required ( )

Check whether a major upgrade is needed.

That is defined as an upgrade that changes something really fundamental in the database, so nothing can possibly work until the database has been updated, and that is defined by the hard-coded version number in this function.

Return values
bool

◆ is_mnet_remote_user()

is_mnet_remote_user ( $user)

Returns whether or not the user object is a remote MNET user.

This function is in moodlelib because it does not rely on loading any of the MNET code.

Parameters
object$userA valid user object
Return values
boolTrue if the user is from a remote Moodle.

◆ is_moodle_cookie_secure()

is_moodle_cookie_secure ( )

Determine wether the secure flag should be set on cookies.

Return values
bool

◆ is_newnav()

is_newnav ( $navigation)

Check if the passed navigation is of the new style.

Parameters
mixed$navigation
Return values
booltrue for yes false for no

◆ is_number()

is_number ( $value)

Return true if given value is integer or string with integer value.

Parameters
mixed$valueString or Int
Return values
booltrue if number, false if not

◆ is_primary_admin()

is_primary_admin ( $userid)

Is a userid the primary administrator?

Parameters
int$useridint id of user to check
Return values
boolean

◆ is_proxybypass()

is_proxybypass ( $url)

Check if $url matches anything in proxybypass list.

Any errors just result in the proxy being used (least bad)

Parameters
string$urlurl to check
Return values
booleantrue if we should bypass the proxy

◆ is_restored_user()

is_restored_user ( $username)

Returns true if the user is a 'restored' one.

Used in the login process to inform the user and allow him/her to reset the password

Parameters
string$usernameusername to be checked
Return values
bool

◆ is_rtl_compatible()

is_rtl_compatible ( $paramtype)

Whether the PARAM_* type is compatible in RTL.

Being compatible with RTL means that the data they contain can flow from right-to-left or left-to-right without compromising the user experience.

Take URLs for example, they are not RTL compatible as they should always flow from the left to the right. This also applies to numbers, email addresses, configuration snippets, base64 strings, etc...

This function tries to best guess which parameters can contain localised strings.

Parameters
string$paramtypeConstant PARAM_*.
Return values
bool

◆ is_valid_plugin_name() [1/2]

is_valid_plugin_name ( $name)

This method validates a plug name.

It is much faster than calling clean_param.

Parameters
string$namea string that might be a plugin name.
Return values
boolif this string is a valid plugin name.

◆ is_valid_plugin_name() [2/2]

static is_valid_plugin_name ( $plugintype,
$pluginname )
static

This method validates a plug name.

It is much faster than calling clean_param.

Parameters
string$plugintypetype of plugin
string$pluginnamea string that might be a plugin name.
Return values
boolif this string is a valid plugin name.

◆ is_web_crawler()

is_web_crawler ( )

◆ ismoving()

ismoving ( $courseid)

Determines if the logged in user is currently moving an activity.

Parameters
int$courseidThe id of the course being tested
Return values
bool

◆ isPropagationStopped()

core\hook\isPropagationStopped ( )

Is propagation stopped?

This will typically only be used by the Dispatcher to determine if the previous listener halted propagation.

Return values
boolTrue if the Event is complete and no further listeners should be called. False to continue calling listeners.

◆ js_minify()

js_minify ( )
Deprecated
since 2.6

◆ ldap_addslashes()

ldap_addslashes ( $text)

Quote control characters in AttributeValue parts of a RelativeDistinguishedName used in LDAP distinguished names - See RFC 4514/2253.

Parameters
stringthe AttributeValue to quote
Return values
stringthe AttributeValue quoted

◆ ldap_connect_moodle()

ldap_connect_moodle ( $host_url,
$ldap_version,
$user_type,
$bind_dn,
$bind_pw,
$opt_deref,
& $debuginfo,
$start_tls = false )

Tries connect to specified ldap servers.

Returns a valid LDAP connection or false.

Parameters
string$host_url
integer$ldap_versioneither 2 (LDAPv2) or 3 (LDAPv3).
string$user_typethe configured user type for this connection.
string$bind_dnthe binding user dn. If an emtpy string, anonymous binding is used.
string$bind_pwthe password for the binding user. Ignored for anonymous bindings.
boolean$opt_derefwhether to set LDAP_OPT_DEREF on this connection or not.
string&$debuginfothe debugging information in case the connection fails.
boolean$start_tlswhether to use LDAP with TLS (not to be confused with LDAP+SSL)
Return values
mixedconnection result or false.

◆ ldap_filter_addslashes()

ldap_filter_addslashes ( $text)

Quote control characters in texts used in LDAP filters - see RFC 4515/2254.

Parameters
stringfilter string to quote
Return values
stringthe filter string quoted

◆ ldap_find_userdn()

ldap_find_userdn ( $ldapconnection,
$username,
$contexts,
$objectclass,
$search_attrib,
$search_sub )

Search specified contexts for username and return the user dn like: cn=username,ou=suborg,o=org.

Parameters
mixed$ldapconnectiona valid LDAP connection.
mixed$usernameusername (external LDAP encoding, no db slashes).
array$contextscontexts to look for the user.
string$objectclassobjectlass of the user (in LDAP filter syntax).
string$search_attribthe attribute use to look for the user.
boolean$search_subwhether to search subcontexts or not.
Return values
mixedthe user dn (external LDAP encoding, no db slashes) or false

◆ ldap_get_dn_special_chars()

if(!defined( 'LDAP_DN_SPECIAL_CHARS')) if(!defined('LDAP_DN_SPECIAL_CHARS_QUOTED_NUM')) if(!defined( 'LDAP_DN_SPECIAL_CHARS_QUOTED_ALPHA')) if(!defined('LDAP_DN_SPECIAL_CHARS_QUOTED_ALPHA_REGEX')) ldap_get_dn_special_chars ( )

The order of the special characters in these arrays IS IMPORTANT.

Make sure '::::5C' (and '\') are the first elements of the arrays. Otherwise we'll double replace '::' with '\5C' which is Bad(tm)

◆ ldap_get_entries_moodle()

ldap_get_entries_moodle ( $ldapconnection,
$searchresult )

Returns values like ldap_get_entries but is binary compatible and returns all attributes as array.

Parameters
mixed$ldapconnectionA valid LDAP connection
mixed$searchresultA search result from ldap_search, ldap_list, etc.
Return values
arrayldap-entries with lower-cased attributes as indexes

◆ ldap_getdefaults()

ldap_getdefaults ( )

Initializes needed variables for ldap-module.

Uses names defined in ldap_supported_usertypes. $default is first defined as: $default['pseudoname'] = array( 'typename1' => 'value', 'typename2' => 'value' .... );

Return values
arrayof default values

◆ ldap_isgroupmember()

ldap_isgroupmember ( $ldapconnection,
$userid,
$group_dns,
$member_attrib )

Checks if user belongs to specific group(s) or is in a subtree.

Returns true if user belongs to a group in grupdns string OR if the DN of the user is in a subtree of the DN provided as "group"

Parameters
mixed$ldapconnectionA valid LDAP connection.
string$useridLDAP user id (dn/cn/uid/...) to test membership for.
array$group_dnsarrary of group dn
string$member_attribthe name of the membership attribute.
Return values
boolean

◆ ldap_normalise_objectclass()

ldap_normalise_objectclass ( $objectclass,
$default = '*' )

Normalise the supplied objectclass filter.

This normalisation is a rudimentary attempt to format the objectclass filter correctly.

Parameters
string$objectclassThe objectclass to normalise
string$defaultThe default objectclass value to use if no objectclass was supplied
Return values
stringThe normalised objectclass.

◆ ldap_paged_results_supported()

ldap_paged_results_supported ( $ldapversion,
$ldapconnection = null )

Check if we can use paged results (see RFC 2696).

We need to use LDAP version 3 (or later), otherwise the server cannot use them. If we also pass in a valid LDAP connection handle, we also check whether the server actually supports them.

Parameters
ldapversioninteger The LDAP protocol version we use.
ldapconnectionresource An existing LDAP connection (optional).
Return values
booleantrue is paged results can be used, false otherwise.

◆ ldap_stripslashes()

ldap_stripslashes ( $text)

Unquote control characters in AttributeValue parts of a RelativeDistinguishedName used in LDAP distinguished names - See RFC 4514/2253.

Parameters
stringthe AttributeValue quoted
Return values
stringthe AttributeValue unquoted

◆ ldap_supported_usertypes()

if(!defined('ROOTDSE')) if(!defined( 'LDAP_PAGED_RESULTS_CONTROL')) if(!defined('LDAP_DEFAULT_PAGESIZE')) ldap_supported_usertypes ( )

Returns predefined user types.

Return values
arrayof predefined user types

◆ link_arrow_left()

link_arrow_left ( $text,
$url = '',
$accesshide = false,
$addclass = '',
$addparams = [] )

Return the left arrow with text ('previous'), and optionally embedded in a link.

Parameters
string$textHTML/plain text label (set to blank only for breadcrumb separator cases).
string$urlAn optional link to use in a surrounding HTML anchor.
bool$accesshideTrue if text should be hidden (for screen readers only).
string$addclassAdditional class names for the link, or the arrow character.
Return values
stringHTML string.

◆ link_arrow_right()

link_arrow_right ( $text,
$url = '',
$accesshide = false,
$addclass = '',
$addparams = [] )

Return the right arrow with text ('next'), and optionally embedded in a link.

Parameters
string$textHTML/plain text label (set to blank only for breadcrumb separator cases).
string$urlAn optional link to use in a surrounding HTML anchor.
bool$accesshideTrue if text should be hidden (for screen readers only).
string$addclassAdditional class names for the link, or the arrow character.
Return values
stringHTML string.

◆ load_course_context()

load_course_context ( )
Deprecated
since Moodle 3.4 and removed immediately. MDL-49398.

◆ load_environment_xml()

load_environment_xml ( $env_select = ENV_SELECT_NEWER)

This function will load the environment.xml file and xmlize it.

@staticvar array $data @uses ENV_SELECT_NEWER @uses ENV_SELECT_DATAROOT @uses ENV_SELECT_RELEASE

Parameters
int | string$env_selectone of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use. String means plugin name.
Return values
mixedthe xmlized structure or false on error

◆ load_filters()

filter_manager::load_filters ( $context)
protected

Load all the filters required by this context.

Parameters
context$contextthe context.

◆ load_renamed_classes()

static load_renamed_classes ( ?string $fulldir)
staticprotected

Loads the db/renamedclasses.php file from the given directory.

The renamedclasses.php should contain a key => value array ($renamedclasses) where the key is old class name, and the value is the new class name. It is only included when we are populating the component cache. After that is not needed.

Parameters
string | null$fulldirThe directory to the renamed classes.

◆ load_role_access_by_context()

load_role_access_by_context ( )
Deprecated
since Moodle 3.4 and removed immediately. MDL-49398.

◆ log()

core\task\log ( $message,
$depth = 1 )
protected

Log a message to the progress tracer.

Parameters
string$message
int$depth

◆ log_finish()

core\task\log_finish ( $message,
$depth = 0 )
protected

Log an end message to the progress tracer.

Parameters
string$message
int$depth

◆ log_start()

core\task\log_start ( $message,
$depth = 0 )
protected

Log a start message to the progress tracer.

Parameters
string$message
int$depth

◆ log_update_descriptions()

log_update_descriptions ( $component)

Log_display description function used during install and upgrade.

Parameters
string$componentname of component (moodle, etc.)
Return values
void

◆ login_attempt_failed()

login_attempt_failed ( $user)

To be called after failed user login.

Parameters
stdClass$user
Exceptions
moodle_exception

◆ login_attempt_valid()

login_attempt_valid ( $user)

To be called after valid user login.

Parameters
stdClass$user

◆ login_captcha_enabled()

login_captcha_enabled ( )

Returns whether the captcha element is enabled for the login form, and the admin settings fulfil its requirements.

Return values
bool

◆ login_is_lockedout()

login_is_lockedout ( $user)

Verify if user is locked out.

Parameters
stdClass$user
Return values
booltrue if user locked out

◆ login_lock_account()

login_lock_account ( $user)

Lockout user and send notification email.

Parameters
stdClass$user

◆ login_unlock_account()

login_unlock_account ( $user,
bool $notify = false )

Unlock user account and reset timers.

Parameters
stdClass$user
bool$notifyNotify the user their account has been unlocked.

◆ make_backup_temp_directory()

make_backup_temp_directory ( $directory,
$exceptiononerror = true )

Create a directory under $CFG->backuptempdir and make sure it is writable.

Do not use for storing generic temp files - see make_temp_directory() instead for this purpose.

Backup temporary files must be on a shared storage.

Parameters
string$directorythe relative path of the directory to be created under $CFG->backuptempdir
bool$exceptiononerrorthrow exception if error encountered
Return values
string|falseReturns full path to directory if successful, false if not; may throw exception

◆ make_cache_directory()

make_cache_directory ( $directory,
$exceptiononerror = true )

Create a directory under cachedir and make sure it is writable.

Note: this cache directory is shared by all cluster nodes.

Parameters
string$directorythe full path of the directory to be created under $CFG->cachedir
bool$exceptiononerrorthrow exception if error encountered
Return values
string|falseReturns full path to directory if successful, false if not; may throw exception

◆ make_categories_list()

make_categories_list ( )
Deprecated
since 2.5

◆ make_categories_options()

make_categories_options ( )
Deprecated
since Moodle 3.10

◆ make_editing_buttons()

make_editing_buttons ( )
Deprecated
since 2.5. Please use: $courserenderer = $PAGE->get_renderer('core', 'course'); $actions = course_get_cm_edit_actions($mod, $indent, $section); return ' ' . $courserenderer->course_section_cm_edit_actions($actions);

◆ make_filter_object() [1/2]

filter_manager::make_filter_object ( $filtername,
$context,
$localconfig )
protected

Factory method for creating a filter.

Parameters
string$filternameThe filter name, for example 'tex'.
context$contextcontext object.
array$localconfigarray of local configuration variables for this filter.
Return values
moodle_text_filterThe filter, or null, if this type of filter is not recognised or could not be created.

Reimplemented in performance_measuring_filter_manager.

◆ make_filter_object() [2/2]

performance_measuring_filter_manager::make_filter_object ( $filtername,
$context,
$localconfig )
protected

Factory method for creating a filter.

Parameters
string$filternameThe filter name, for example 'tex'.
context$contextcontext object.
array$localconfigarray of local configuration variables for this filter.
Return values
moodle_text_filterThe filter, or null, if this type of filter is not recognised or could not be created.

Reimplemented from filter_manager.

◆ make_grades_menu()

make_grades_menu ( $gradingtype)

Creates an array that represents all the current grades that can be chosen using the given grading type.

Negative numbers are scales, zero is no grade, and positive numbers are maximum grades.

Todo
Finish documenting this function or better deprecated this completely!
Parameters
int$gradingtype
Return values
array

◆ make_localcache_directory()

make_localcache_directory ( $directory,
$exceptiononerror = true )

Create a directory under localcachedir and make sure it is writable.

The files in this directory MUST NOT change, use revisions or content hashes to work around this limitation - this means you can only add new files here.

The content of this directory gets purged automatically on all cluster nodes after calling purge_all_caches() before new data is written to this directory.

Note: this local cache directory does not need to be shared by cluster nodes.

Parameters
string$directorythe relative path of the directory to be created under $CFG->localcachedir
bool$exceptiononerrorthrow exception if error encountered
Return values
string|falseReturns full path to directory if successful, false if not; may throw exception

◆ make_menu_from_list()

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.

Parameters
string$listThe string to explode into array bits
string$separatorThe separator used within the list string
Return values
arrayThe now assembled array

◆ make_request_directory()

make_request_directory ( bool $exceptiononerror = true,
bool $forcecreate = false )

Create a per-request directory and make sure it is writable.

This can only be used during the current request and will be tidied away automatically afterwards.

A new, unique directory is always created within a shared base request directory.

In some exceptional cases an alternative base directory may be required. This can be accomplished using the $forcecreate parameter. Typically this will only be requried where the file may be required during a shutdown handler which may or may not be registered after a previous request directory has been created.

Parameters
bool$exceptiononerrorthrow exception if error encountered
bool$forcecreateForce creation of a new parent directory
Return values
stringThe full path to directory if successful, false if not; may throw exception

◆ make_temp_directory()

make_temp_directory ( $directory,
$exceptiononerror = true )

Create a directory under tempdir and make sure it is writable.

Where possible, please use make_request_directory() and limit the scope of your data to the current HTTP request.

Do not use for storing cache files - see make_cache_directory(), and make_localcache_directory() instead for this purpose.

Temporary files must be on a shared storage, and heavy usage is discouraged due to the performance impact upon clustered environments.

Parameters
string$directorythe full path of the directory to be created under $CFG->tempdir
bool$exceptiononerrorthrow exception if error encountered
Return values
string|falseReturns full path to directory if successful, false if not; may throw exception

◆ make_timestamp()

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.

Parameters
int$yearThe year part to create timestamp of
int$monthThe month part to create timestamp of
int$dayThe day part to create timestamp of
int$hourThe hour part to create timestamp of
int$minuteThe minute part to create timestamp of
int$secondThe second part to create timestamp of
int | float | string$timezoneTimezone modifier, used to calculate GMT time offset. if 99 then default user's timezone is used
bool$applydstToggle Daylight Saving Time, default true, will be applied only if timezone is 99 or string.
Return values
intGMT timestamp

◆ make_unique_id_code()

make_unique_id_code ( $extra = '')

make_unique_id_code

Todo
Finish documenting this function

@uses $_SERVER

Parameters
string$extraExtra string to append to the end of the code
Return values
string

◆ make_unique_writable_directory()

make_unique_writable_directory ( $basedir,
$exceptiononerror = true )

Create a new unique directory within the specified directory.

Parameters
string$basedirThe directory to create your new unique directory within.
bool$exceptiononerrorthrow exception if error encountered
Return values
stringThe created directory
Exceptions
invalid_dataroot_permissions

◆ make_upload_directory()

make_upload_directory ( $directory,
$exceptiononerror = true )

Create a directory under dataroot and make sure it is writable.

Do not use for temporary and cache files - see make_temp_directory() and make_cache_directory().

Parameters
string$directorythe full path of the directory to be created under $CFG->dataroot
bool$exceptiononerrorthrow exception if error encountered
Return values
string|falseReturns full path to directory if successful, false if not; may throw exception

◆ mark_context_dirty()

mark_context_dirty ( )
Deprecated
since 2.2, use $context->mark_dirty() instead

◆ markdown_to_html()

markdown_to_html ( $text)

Given Markdown formatted text, make it into XHTML using external function.

Parameters
string$textThe markdown formatted text to be converted.
Return values
stringConverted text

◆ match_grade_options()

match_grade_options ( $gradeoptionsfull,
$grade,
$matchgrades = 'error' )

Check whether a given grade is one of a list of allowed options.

If not, depending on $matchgrades, either return the nearest match, or return false to signal an error.

Parameters
array$gradeoptionsfulllist of valid options
int$gradegrade to be tested
string$matchgrades'error' or 'nearest'
Return values
false|int|stringeither 'fixed' value or false if error.

◆ matching_page_type_patterns()

matching_page_type_patterns ( $pagetype)

Given a specific page type, return all the page type patterns that might match it.

Parameters
string$pagetypefor example 'course-view-weeks' or 'mod-quiz-view'.
Return values
arrayan array of all the page type patterns that might match this page type.

◆ matching_page_type_patterns_from_pattern()

matching_page_type_patterns_from_pattern ( $pattern)

Give an specific pattern, return all the page type patterns that would also match it.

Parameters
string$patternthe pattern, e.g. 'mod-forum-*' or 'mod-quiz-view'.
Return values
arrayof all the page type patterns matching.

◆ mb_internal_encoding()

Html2Text\mb_internal_encoding ( $encoding = null)

Set the encoding to be used by our monkey patched mb_ functions.

When called with $encoding !== null, we set the static $intenalencoding variable, which is used for subsequent calls.

When called with no value for $encoding, we return the previously defined $internalencoding.

This is necessary as we need to maintain the state of mb_internal_encoding across calls to other mb_* functions. Check how it is used in the other mb_* functions defined here - if no encoding is provided we fallback to what was set here, otherwise we used the given encoding.

@staticvar string $internalencoding The encoding to be used across mb_* calls.

Parameters
string$encodingWhen given, sets $internalencoding
Return values
mixed

◆ mb_strlen()

Html2Text\mb_strlen ( $str,
$encoding = null )

Gets the length of a string.

Parameters
string$strThe string being checked for length.
string$encodingThe encoding parameter is the character encoding. If it is omitted, the internal character encoding value will be used.
Return values
intThe number of characters in str having character encoding $encoding. A multibyte character is counted as 1.

◆ mb_strtolower()

Html2Text\mb_strtolower ( $str,
$encoding = null )

Returns $str with all alphabetic chatacters converted to lowercase.

Parameters
string$strThe string being lowercased.
string$encodingThe encoding parameter is the character encoding. If it is omitted, the internal character encoding value will be used.
Return values
stringThe string with all alphabetic characters converted to lowercase.

◆ mb_strtoupper()

Html2Text\mb_strtoupper ( $str,
$encoding = null )
Parameters
stringThe string being uppercased
string$encodingThe encoding parameter is the character encoding. If it is omitted, the internal character encoding value will be used.
Return values
stringThe string with all alphabetic characters converted to uppercase.

◆ mb_substr()

Html2Text\mb_substr ( $str,
$start,
$length = null,
$encoding = null )

Performs a multi-byte safe substr() operation based on number of characters.

Position is counted from the beginning of str. First character's position is 0. Second character position is 1, and so on.

Parameters
string$strThe string to extract the substring from.
int$startIf start is non-negative, the returned string will start at the start'th position in string, counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so forth.
int$lengthMaximum number of characters to use from str. If omitted or NULL is passed, extract all characters to the end of the string.
string$encodingThe encoding parameter is the character encoding. If it is omitted, the internal character encoding value will be used.
Return values
stringThe portion of str specified by the start and length parameters.

◆ mdie()

mdie ( $msg = '',
$errorcode = 1 )

Print an error to STDOUT and exit with a non-zero code.

For commandline scripts.

Default errorcode is 1.

Very useful for perl-like error-handling: do_somethting() or mdie("Something went wrong");

Parameters
string$msgError message
integer$errorcodeError code to emit

◆ me()

me ( )

Returns the name of the current script, WITH the querystring portion.

This function is necessary because PHP_SELF and REQUEST_URI and SCRIPT_NAME return different things depending on a lot of things like your OS, Web server, and the way PHP is compiled (ie. as a CGI, module, ISAPI, etc.) NOTE: This function returns false if the global variables needed are not set.

Return values
mixedString or false if the global variables needed are not set.

◆ merge_query_params()

merge_query_params ( array & $target,
array $values )

Merge parsed POST chunks.

NOTE: this is not perfect, but it should work in most cases hopefully.

Parameters
array$target
array$values

◆ message_add_contact()

message_add_contact ( )
Deprecated
since Moodle 3.6

◆ message_block_contact()

message_block_contact ( )
Deprecated
since Moodle 3.6

◆ message_can_delete_message()

message_can_delete_message ( )
Deprecated
since Moodle 3.5

◆ message_can_post_message()

message_can_post_message ( )
Deprecated
since Moodle 3.2

◆ message_contact_link()

message_contact_link ( )
Deprecated
since Moodle 3.2

◆ message_count_blocked_users()

message_count_blocked_users ( )
Deprecated
since Moodle 3.2

◆ message_count_messages()

message_count_messages ( )
Deprecated
since Moodle 3.2

◆ message_count_unread_messages()

message_count_unread_messages ( )
Deprecated
since 3.10

◆ message_current_user_is_involved()

message_current_user_is_involved ( )
Deprecated
since Moodle 2.9 MDL-49371 - please do not use this function any more.

◆ message_delete_message()

message_delete_message ( )
Deprecated
since Moodle 3.5

◆ message_get_blocked_users()

message_get_blocked_users ( )
Deprecated
since Moodle 3.5

◆ message_get_contact()

message_get_contact ( )
Deprecated
since Moodle 3.6

◆ message_get_contact_add_remove_link()

message_get_contact_add_remove_link ( )
Deprecated
since Moodle 3.2

◆ message_get_contact_block_link()

message_get_contact_block_link ( )
Deprecated
since Moodle 3.2

◆ message_get_contacts()

message_get_contacts ( )
Deprecated
since Moodle 3.5

◆ message_get_course_contexts()

message_get_course_contexts ( )
Deprecated
since Moodle 3.2

◆ message_get_fragment()

message_get_fragment ( )
Deprecated
since Moodle 3.2

◆ message_get_history()

message_get_history ( )
Deprecated
since Moodle 3.2

◆ message_get_recent_conversations()

message_get_recent_conversations ( $userorid,
$limitfrom = 0,
$limitto = 100 )

◆ message_get_recent_notifications()

message_get_recent_notifications ( )
Deprecated
since Moodle 3.2

◆ message_history_link()

message_history_link ( )
Deprecated
since Moodle 3.2

◆ message_is_user_blocked()

message_is_user_blocked ( )
Deprecated
since Moodle 3.2

◆ message_is_user_non_contact_blocked()

message_is_user_non_contact_blocked ( )
Deprecated
since Moodle 3.2

◆ message_mark_message_read()

message_mark_message_read ( )
Deprecated
since Moodle 3.5

◆ message_mark_messages_read()

message_mark_messages_read ( )
Deprecated
since Moodle 3.2

◆ message_move_userfrom_unread2read()

message_move_userfrom_unread2read ( )
Deprecated
since Moodle 3.5

◆ message_remove_contact()

message_remove_contact ( )
Deprecated
since Moodle 3.6

◆ message_remove_url_params()

message_remove_url_params ( )
Deprecated
since Moodle 3.2

◆ message_search()

message_search ( )
Deprecated
since Moodle 3.2

◆ message_shorten_message()

message_shorten_message ( )
Deprecated
since Moodle 3.2

◆ message_unblock_contact()

message_unblock_contact ( )
Deprecated
since Moodle 3.6

◆ microtime_diff()

microtime_diff ( $a,
$b )

Calculate the difference between two microtimes.

Parameters
string$aThe first Microtime
string$bThe second Microtime
Return values
string

◆ min_clean_param()

min_clean_param ( $value,
$type )

Minimalistic parameter cleaning function.

Note: Can not use optional param because moodlelib.php is not loaded yet.

Parameters
string$value
string$type
Return values
mixed

◆ min_enable_zlib_compression()

min_enable_zlib_compression ( )

This method tries to enable output compression if possible.

This function must be called before any output or headers.

(IE6 is not supported at all.)

Return values
boolean,trueif compression enabled

◆ min_fix_utf8()

min_fix_utf8 ( $value)

Minimalistic UTF-8 sanitisation.

Note: This duplicates fix_utf8() intentionally for now.

Parameters
string$value
Return values
string

◆ min_get_maximum_revision()

min_get_maximum_revision ( )

Get the highest possible currently valid revision number.

This is based on the current time, allowing for a small amount of clock skew between servers.

Future values beyond the clock skew are not allowed to avoid the possibility of cache poisoning.

Return values
int

◆ min_get_minimum_revision()

min_get_minimum_revision ( )

Get the lowest possible currently valid revision number.

This is based on the current Moodle version.

Return values
intUnix timestamp

◆ min_get_slash_argument()

min_get_slash_argument ( $clean = true)

Returns the slashargument part of the URL.

Note: ".php" is NOT allowed in slasharguments, it is intended for ASCII characters only.

Parameters
boolean$clean- Should we do cleaning on this path argument. If you set this to false you MUST be very careful and do the cleaning manually.
Return values
string

◆ min_is_revision_valid_and_current()

min_is_revision_valid_and_current ( int $revision)

Helper function to determine if the given revision number is valid.

Parameters
int$revisionA numeric revision to check for validity
Return values
boolWhether the revision is valid

◆ min_optional_param()

min_optional_param ( $name,
$default,
$type )

Minimalistic parameter validation function.

Can not use optional param because moodlelib.php is not loaded yet

Parameters
string$name
mixed$default
string$type
Return values
mixed

◆ mnet_get_idp_jump_url()

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

Parameters
stdclass$userthe user to get the idp url for

◆ mod_page_type_list()

mod_page_type_list ( $pagetype,
$parentcontext = null,
$currentcontext = null )

Generates the page type list for a module by either locating and using the modules callback or by generating a default list.

Parameters
string$pagetype
stdClass$parentcontext
stdClass$currentcontext
Return values
array

◆ moodle_getlocale()

moodle_getlocale ( )

Gets the system locale.

Return values
stringRetuns the current locale.

◆ moodle_major_version()

moodle_major_version ( $fromdisk = false)

Returns the major version of this site.

Moodle version numbers consist of three numbers separated by a dot, for example 1.9.11 or 2.0.2. The first two numbers, like 1.9 or 2.0, represent so called major version. This function extracts the major version from either $CFG->release (default) or eventually from the $release variable defined in the main version.php.

Parameters
bool$fromdiskshould the version if source code files be used
Return values
string|falsethe major version like '2.3', false if could not be determined

◆ moodle_minimum_php_version_is_met()

moodle_minimum_php_version_is_met ( $haltexecution = false)

Tests the current PHP version against Moodle's minimum requirement.

When requirement is not met returns false or halts execution depending $haltexecution param.

Parameters
bool$haltexecutionShould execution be halted when requirement not met? Defaults to false.
Return values
boolreturns true if requirement is met (false if not)

◆ moodle_needs_upgrading()

moodle_needs_upgrading ( $checkupgradeflag = true)

Determine if moodle installation requires update.

Checks version numbers of main code and all plugins to see if there are any mismatches.

Parameters
bool$checkupgradeflagcheck the outagelessupgrade flag to see if an upgrade is running.
Return values
bool

◆ moodle_process_email()

moodle_process_email ( $modargs,
$body )

?

Todo
Finish documenting this function
Parameters
string$modargs
string$bodyCurrently unused

◆ moodle_require_minimum_php_version()

moodle_require_minimum_php_version ( )

Require our minimum php version or halt execution if requirement not met.

Return values
voidExecution is halted if version is not met.

◆ moodle_setlocale()

moodle_setlocale ( $locale = '')

Sets the system locale.

Parameters
string$localeCan be used to force a locale

◆ move_category()

move_category ( )
Deprecated
since 2.5

◆ move_question_set_references()

move_question_set_references ( int $oldcategoryid,
int $newcatgoryid,
int $oldcontextid,
int $newcontextid,
bool $delete = false )

Update the questioncontextid field for all question_set_references records given a new context id.

Parameters
int$oldcategoryidOld category to be moved.
int$newcatgoryidNew category that will receive the questions.
int$oldcontextidOld context to be moved.
int$newcontextidNew context that will receive the questions.
bool$deleteIf the action is delete.
Exceptions
dml_exception

◆ mtrace()

mtrace ( $string,
$eol = "\n",
$sleep = 0 )

For outputting debugging info.

Parameters
string$stringThe string to write
string$eolThe end of line char(s) to use
string$sleepPeriod to make the application sleep This ensures any messages have time to display before redirect

◆ mtrace_exception()

mtrace_exception ( Throwable $e)

Helper to {.

See also
mtrace()} an exception or throwable, including all relevant information.
Parameters
Throwable$ethe error to ouptput.

◆ my_page_type_list()

my_page_type_list ( $pagetype,
$parentcontext = null,
$currentcontext = null )

Generates the page type list for the my moodle page.

Parameters
string$pagetype
stdClass$parentcontext
stdClass$currentcontext
Return values
array

◆ mygroupid()

mygroupid ( )

◆ navmenu()

navmenu ( )
Deprecated
not relevant with global navigation in Moodle 2.x+

◆ navmenulist()

navmenulist ( $course,
$sections,
$modinfo,
$strsection,
$strjumpto,
$width = 50,
$cmid = 0 )

Returns a popup menu with course activity modules.

Given a course this function returns a small popup menu with all the course activity modules in it, as a navigation menu outputs a simple list structure in XHTML. The data is taken from the serialised array stored in the course record.

Parameters
stdClass$courseA course object.
array$sections
course_modinfo$modinfo
string$strsection
string$strjumpto
int$width
string$cmid
Return values
stringThe HTML block

◆ normalize_component()

normalize_component ( $component)
static

Normalize the component name using the "frankenstyle" rules.

Normalize the component name using the "frankenstyle" names.

Note: this does not verify the validity of plugin or type names.

Parameters
string$component
Return values
arraytwo-items list of [(string)type, (string|null)name]
Deprecated
since 2.6, use core_component\normalize_component()
Parameters
string$component
Return values
arraytwo-items list of [(string)type, (string|null)name]

◆ normalize_componentname()

static normalize_componentname ( $componentname)
static

Normalize the component name.

Note: this does not verify the validity of the plugin or component.

Parameters
string$component
Return values
string

◆ normalize_version()

normalize_version ( $version)

This function will normalize any version to just a serie of numbers separated by dots.

Everything else will be removed.

Parameters
string$versionthe original version
Return values
stringthe normalized version

◆ notice()

notice ( $message,
$link = '',
$course = null )

Print a message and exit.

Parameters
string$messageThe message to print in the notice
moodle_url | string$linkThe link to use for the continue button
object$courseA course object. Unused.
Return values
voidThis function simply exits

◆ notify()

notify ( )
Deprecated
since Moodle 2.0 MDL-19077 - use $OUTPUT->notification instead.

◆ obfuscate_email()

obfuscate_email ( $email)

Given an email address, this function will return an obfuscated version of it.

Parameters
string$emailThe email address to obfuscate
Return values
stringThe obfuscated email address

◆ obfuscate_mailto()

obfuscate_mailto ( $email,
$label = '',
$dimmed = false,
$subject = '',
$body = '' )

This function uses the obfuscate_email() and obfuscate_text() to generate a fully obfuscated email link, ready to use.

Parameters
string$emailThe email address to display
string$labelThe text to displayed as hyperlink to $email
boolean$dimmedIf true then use css class 'dimmed' for hyperlink
string$subjectThe subject of the email in the mailto link
string$bodyThe content of the email in the mailto link
Return values
stringThe obfuscated mailto link

◆ obfuscate_text()

obfuscate_text ( $plaintext)

This function takes some text and replaces about half of the characters with HTML entity equivalents.

Return string is obviously longer.

Parameters
string$plaintextThe text to be obfuscated
Return values
stringThe obfuscated text

◆ object_array_unique()

object_array_unique ( $array,
$keepkeyassoc = true )

Returns an array without repeated objects.

This function is similar to array_unique, but for arrays that have objects as values

Parameters
array$array
bool$keepkeyassoc
Return values
array

◆ object_property_exists()

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.

Parameters
mixed$objName of class or real object to test
string$propertyname of property to find
Return values
booltrue if property exists

◆ optional_param()

optional_param ( $parname,
$default,
$type )

Returns a particular value for the named variable, taken from POST or GET, otherwise returning a given default.

This function should be used to initialise all optional values in a script that are based on parameters. Usually it will be used like this: $name = optional_param('name', 'Fred', PARAM_TEXT);

Please note the $type parameter is now required and the value can not be array.

Parameters
string$parnamethe name of the page parameter we want
mixed$defaultthe default value to return if nothing is found
string$typeexpected type of parameter
Return values
mixed
Exceptions
coding_exception

◆ optional_param_array()

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.

This function should be used to initialise all optional values in a script that are based on parameters. Usually it will be used like this: $ids = optional_param('id', array(), PARAM_INT);

Note: arrays of arrays are not supported, only alphanumeric keys with _ and - are supported

Parameters
string$parnamethe name of the page parameter we want
mixed$defaultthe default value to return if nothing is found
string$typeexpected type of parameter
Return values
array
Exceptions
coding_exception

◆ order_in_string()

order_in_string ( $values,
$stringformat )

Returns an array of values in order of occurance in a provided string.

The key in the result is the character postion in the string.

Parameters
array$valuesValues to be found in the string format
string$stringformatThe string which may contain values being searched for.
Return values
arrayAn array of values in order according to placement in the string format.

◆ over_bounce_threshold()

over_bounce_threshold ( $user)

Check whether the user has exceeded the bounce threshold.

Parameters
stdClass$userA $USER object
Return values
booltrue => User has exceeded bounce threshold

◆ p()

p ( $var)

Add quotes to HTML characters.

Prints $var with HTML characters (like "<", ">", etc.) properly quoted. This function simply calls & displays s().

See also
s()
Parameters
string$varthe string potentially containing HTML characters

◆ page_doc_link()

page_doc_link ( $text = '')

Returns a string containing a link to the user documentation for the current page.

Also contains an icon by default. Shown to teachers and admin only.

Parameters
string$textThe text to be displayed for the link
Return values
stringThe link to user documentation for this current page

◆ page_get_doc_link_path()

page_get_doc_link_path ( moodle_page $page)

Returns the path to use when constructing a link to the docs.

Since
Moodle 2.5.1 2.6
Parameters
moodle_page$page
Return values
string

◆ partial()

partial ( )

Helper function to do partial function binding.

so we can use it for preg_replace_callback, for example this works with php functions, user functions, static methods and class methods it returns you a callback that you can pass on like so:

$callback = partial('somefunction', $arg1, $arg2); or $callback = partial(array('someclass', 'somestaticmethod'), $arg1, $arg2); or even $obj = new someclass(); $callback = partial(array($obj, 'somemethod'), $arg1, $arg2);

and then the arguments that are passed through at calltime are appended to the argument list.

Parameters
mixed$functiona php callback
mixed$arg1,...$argv arguments to partially bind with
Return values
arrayArray callback

◆ password_compat_not_supported()

password_compat_not_supported ( )
Deprecated
since 2.7 PHP 5.4.x should be always compatible.

◆ password_is_legacy_hash()

password_is_legacy_hash ( # string $password[\SensitiveParameter])

Check a password hash to see if it was hashed using the legacy hash algorithm (bcrypt).

Parameters
string$passwordString to check.
Return values
boolTrue if the $password matches the format of a bcrypt hash.

◆ perf_get_reads_slave()

perf_get_reads_slave ( )

Returns the number of reads done by the read only database.

Return values
intNumber of reads.

◆ phpunit_bootstrap_error()

phpunit_bootstrap_error ( $errorcode,
$text = '' )

Print error and stop execution.

Parameters
int$errorcodeThe exit error code
string$textAn error message to display
Return values
voidstops code execution with error code

◆ plagiarism_get_file_results()

plagiarism_get_file_results ( $cmid,
$userid,
$file )

returns array of plagiarism details about specified file

Deprecated
Since Moodle 4.0. - this function was a placeholder and not used in core.
Todo
MDL-71326 This is to be moved from here to deprecatedlib.php in Moodle 4.4
Parameters
int$cmid
int$userid
object$filemoodle file object
Return values
array- sets of details about specified file, one array of details per plagiarism plugin
  • each set contains at least 'analyzed', 'score', 'reporturl'

◆ plagiarism_get_form_elements_module()

plagiarism_get_form_elements_module ( )

◆ plagiarism_get_links()

if(!defined('MOODLE_INTERNAL')) plagiarism_get_links ( $linkarray)

displays the similarity score and provides a link to the full report if allowed.

Parameters
object$linkarraycontains all relevant information for the plugin to generate a link
Return values
string- url to allow login/viewing of a similarity report

◆ plagiarism_load_available_plugins()

plagiarism_load_available_plugins ( )

Helper function - also loads lib file of plagiarism plugin.

Return values
arrayof available plugins

◆ plagiarism_print_disclosure()

plagiarism_print_disclosure ( $cmid)

Function that prints the student disclosure notifying that the files will be checked for plagiarism.

Parameters
integer$cmid- the cmid of this module
Return values
string

◆ plagiarism_save_form_elements()

plagiarism_save_form_elements ( )

◆ plagiarism_update_status()

plagiarism_update_status ( $course,
$cm )

Allows a plagiarism plugin to print a button/link at the top of activity overview report pages.

Deprecated
Since Moodle 4.0 - Please use {plugin name}_before_standard_top_of_body_html instead.
Todo
MDL-71326 Remove this method.
Parameters
object$course- full Course object
object$cm- full cm object
Return values
string

◆ plugin_callback()

plugin_callback ( $type,
$name,
$feature,
$action,
$params = null,
$default = null,
bool $migratedtohook = false )

Invoke plugin's callback functions.

Parameters
string$typeplugin type e.g. 'mod'
string$nameplugin name
string$featurefeature name
string$actionfeature's action
array$paramsparameters of callback function, should be an array
mixed$defaultdefault value if callback function hasn't been defined, or if it retursn null.
bool$migratedtohookif true this is a deprecated callback, if hook callback is present then do nothing
Return values
mixed
Todo
Decide about to deprecate and drop plugin_callback() - MDL-30743

◆ plugin_supports()

plugin_supports ( $type,
$name,
$feature,
$default = null )

Checks whether a plugin supports a specified feature.

Parameters
string$typePlugin type e.g. 'mod'
string$namePlugin name e.g. 'forum'
string$featureFeature code (FEATURE_xx constant)
mixed$defaultdefault value if feature support unknown
Return values
mixedFeature result (false if not supported, null if feature is unknown, otherwise usually true but may have other feature-specific value such as array)
Exceptions
coding_exception

◆ preload_course_contexts()

preload_course_contexts ( )
Deprecated
since Moodle 2.2

◆ prevent_form_autofill_password()

prevent_form_autofill_password ( )
Deprecated
since Moodle 3.2

◆ print_arrow()

object print_arrow ( $direction = 'up',
$strsort = null,
$return = false )

Returns an image of an up or down arrow, used for column sorting.

To avoid unnecessary DB accesses, please provide this function with the language strings for sortasc and sortdesc.

Deprecated
use $OUTPUT->arrow() instead.
Todo
final deprecation of this function once MDL-45448 is resolved

If no sort string is associated with the direction, an arrow with no alt text will be printed/returned.

Parameters
string$direction'up' or 'down'
string$strsortThe language string used for the alt attribute of this image
bool$returnWhether to print directly or return the html string
Return values
string|voiddepending on $return

◆ print_badge_image()

print_badge_image ( badge $badge,
stdClass $context,
$size = 'small' )

Print badge image.

Parameters
badge$badgeBadge object
stdClass$context
string$size

◆ print_category_info()

print_category_info ( )
Deprecated
since 2.5

◆ print_checkbox()

print_checkbox ( )
Deprecated
use html_writer\checkbox() instead.

◆ print_collapsible_region()

print_collapsible_region ( $contents,
$classes,
$id,
$caption,
$userpref = '',
$default = false,
$return = false )

Print (or return) a collapsible region, that has a caption that can be clicked to expand or collapse the region.

If JavaScript is off, then the region will always be expanded.

Parameters
string$contentsthe contents of the box.
string$classesclass names added to the div that is output.
string$idid added to the div that is output. Must not be blank.
string$captiontext displayed at the top. Clicking on this will cause the region to expand or contract.
string$userprefthe name of the user preference that stores the user's preferred default state. (May be blank if you do not wish the state to be persisted.
boolean$defaultInitial collapsed state to use if the user_preference it not set.
boolean$returnif true, return the HTML as a string, rather than printing it.
Return values
string|voidIf $return is false, returns nothing, otherwise returns a string of HTML.

◆ print_collapsible_region_end()

print_collapsible_region_end ( $return = false)

Close a region started with print_collapsible_region_start.

Parameters
boolean$returnif true, return the HTML as a string, rather than printing it.
Return values
string|voidif $return is false, returns nothing, otherwise returns a string of HTML.

◆ print_collapsible_region_start()

print_collapsible_region_start ( $classes,
$id,
$caption,
$userpref = '',
$default = false,
$return = false,
$extracontent = null )

Print (or return) the start of a collapsible region.

The collapsibleregion has a caption that can be clicked to expand or collapse the region. If JavaScript is off, then the region will always be expanded.

Parameters
string$classesclass names added to the div that is output.
string$idid added to the div that is output. Must not be blank.
string$captiontext displayed at the top. Clicking on this will cause the region to expand or contract.
string$userprefthe name of the user preference that stores the user's preferred default state. (May be blank if you do not wish the state to be persisted.
boolean$defaultInitial collapsed state to use if the user_preference it not set.
boolean$returnif true, return the HTML as a string, rather than printing it.
string$extracontentthe extra content will show next to caption, eg.Help icon.
Return values
string|voidif $return is false, returns nothing, otherwise returns a string of HTML.

◆ print_container()

print_container ( )
Deprecated
use $OUTPUT->container() instead.

◆ print_container_end()

print_container_end ( )
Deprecated
use $OUTPUT->container_end() instead.

◆ print_container_start()

print_container_start ( )
Deprecated
use $OUTPUT->container_start() instead.

◆ print_context_name()

print_context_name ( )
Deprecated
since 2.2

◆ print_continue()

print_continue ( )
Deprecated
use $OUTPUT->continue_button() instead.

◆ print_course()

print_course ( )
Deprecated
since 2.5

◆ print_course_search()

print_course_search ( )
Deprecated
since 2.5

◆ print_courses()

print_courses ( )
Deprecated
since 2.5

◆ print_error()

print_error ( $errorcode,
$module = 'error',
$link = '',
$a = null,
$debuginfo = null )

Abort execution by throwing of a general exception, default exception handler displays the error message in most cases.

Deprecated
since Moodle 4.1
Todo
MDL-74484 Final deprecation in Moodle 4.5.
Parameters
string$errorcodeThe name of the language string containing the error message. Normally this should be in the error.php lang file.
string$moduleThe language file to get the error message from.
string$linkThe url where the user will be prompted to continue. If no url is provided the user will be directed to the site index page.
object$aExtra words and phrases that might be required in the error string
string$debuginfooptional debugging information
Return values
void,alwaysthrows exception!

◆ print_grade_menu()

print_grade_menu ( $courseid,
$name,
$current,
$includenograde = true,
$return = false )

Prints a grade menu (as part of an existing form) with help showing all possible numerical grades and scales.

Todo

Finish documenting this function

Deprecate: this is only used in a few contrib modules

Parameters
int$courseidThe course ID
string$name
string$current
boolean$includenogradeInclude those with no grades
boolean$returnIf set to true returns rather than echo's
Return values
string|boolDepending on value of $return

◆ print_grade_plugin_selector()

print_grade_plugin_selector ( $plugin_info,
$active_type,
$active_plugin,
$return = false )

Print grading plugin selection popup form.

Deprecated
since Moodle 4.0. Dropdown box navigation has been replaced with tertiary navigation.
Parameters
array$plugin_infoAn array of plugins containing information for the selector
boolean$returnreturn as string
Return values
nothingor string if $return true

◆ print_group_picture()

print_group_picture ( $group,
$courseid,
$large = false,
$return = false,
$link = true,
$includetoken = false )

Print a specified group's avatar.

Parameters
array | stdClass$groupA single group object OR array of groups.
int$courseidThe course ID.
boolean$largeDefault small picture, or large.
boolean$returnIf false print picture, otherwise return the output as string
boolean$linkEnclose image in a link to view specified course?
boolean$includetokenWhether to use a user token when displaying this group image. True indicates to generate a token for current user, and integer value indicates to generate a token for the user whose id is the value indicated. If the group picture is included in an e-mail or some other location where the audience is a specific user who will not be logged in when viewing, then we use a token to authenticate the user.
Return values
string|voidDepending on the setting of $return

◆ print_header()

print_header ( )
Deprecated
use $PAGE methods instead.

◆ print_header_simple()

print_header_simple ( )
Deprecated
use $PAGE methods instead.

◆ print_location_comment()

print_location_comment ( $file,
$line,
$return = false )

Outputs a HTML comment to the browser.

This is used for those hard-to-debug pages that use bits from many different files in very confusing ways (e.g. blocks).

print_location_comment(FILE, LINE);

Parameters
string$file
integer$line
boolean$returnWhether to return or print the comment
Return values
string|voidVoid unless true given as third parameter

◆ print_log()

print_log ( )
Deprecated
since Moodle 3.2

◆ print_log_csv()

print_log_csv ( )
Deprecated
since Moodle 3.2

◆ print_log_ods()

print_log_ods ( )
Deprecated
since Moodle 3.2

◆ print_log_xls()

print_log_xls ( )
Deprecated
since Moodle 3.2

◆ print_mnet_log()

print_mnet_log ( )
Deprecated
since Moodle 3.2

◆ print_my_moodle()

print_my_moodle ( )
Deprecated
since 2.5

◆ print_navigation()

print_navigation ( )
Deprecated
use $OUTPUT->navbar() instead

◆ print_object()

print_object ( $item,
array $expandclasses = ['/./'],
bool $textonly = false,
bool $return = false,
int $depth = 0,
array $done = [] )

GENERAL HELPFUL THINGS ///////////////////////////////////.

Dumps a given object's information for debugging purposes. (You can actually use this function to print any type of value such as arrays or simple strings, not just objects.)

When used in a web script, the object is dumped in a fancy-formatted div.

When used in a CLI script, the object's information is written to the standard error output stream.

When used in an AJAX script, the object's information is dumped to the server error log.

In text mode, private fields are shown with * and protected with +.

In web view, formatting is done with Bootstrap classes. You can hover over some items to see more information, such as value types or access controls, or full field names if the names get cut off.

By default, this will recurse to child objects, except where that would result in infinite recursion. To change that, set $expandclasses to an empty array (= do not recurse) or to a list of the class names that you would like to expand. You can also set values in this array to a regular expression beginning with / if you want to match a range of classes.

Parameters
mixed$itemObject, array, or other item to display
string[]$expandclassesOptional list of class patterns to recurse to
bool$textonlyIf true, outputs text-only (automatically set for CLI and AJAX)
bool$returnFor internal use - if true, returns value instead of echoing it
int$depthFor internal use - depth of recursion within print_object call
stdClass[]$doneFor internal use - array listing already-printed objects
Return values
stringHTML code (or text if CLI) to display, if $return is true, otherwise empty string

◆ print_overview()

print_overview ( )
Deprecated
since 2.5

◆ print_password_policy()

print_password_policy ( )

Returns a localized sentence in the current language summarizing the current password policy.

Todo
this should be handled by a function/method in the language pack library once we have a support for it @uses $CFG
Return values
string

◆ print_question_icon()

print_question_icon ( $question)

Print the icon for the question type.

Parameters
object$questionThe question object for which the icon is required. Only $question->qtype is used.
Return values
stringthe HTML for the img tag.

◆ print_recent_activity()

print_recent_activity ( )
Deprecated
since 2.5

◆ print_recent_activity_note()

print_recent_activity_note ( $time,
$user,
$text,
$link,
$return = false,
$viewfullnames = null )

Display a recent activity note.

@staticvar string $strftimerecent

Parameters
int$timeA timestamp int.
stdClass$userA user object from the database.
string$textText for display for the note
string$linkThe link to wrap around the text
bool$returnIf set to true the HTML is returned rather than echo'd
string$viewfullnames
Return values
stringIf $retrun was true returns HTML for a recent activity notice.

◆ print_remote_course()

print_remote_course ( )
Deprecated
since 2.5

◆ print_remote_host()

print_remote_host ( )
Deprecated
since 2.5

◆ print_scale_menu_helpbutton()

print_scale_menu_helpbutton ( )
Deprecated
use $OUTPUT->help_icon_scale($courseid, $scale) instead.

◆ print_section()

print_section ( )
Deprecated
since 2.5

◆ print_section_add_menus()

print_section_add_menus ( )
Deprecated
since 2.5

◆ print_side_block()

print_side_block ( )
Deprecated
use $OUTPUT->block() instead.

◆ print_string()

print_string ( $identifier,
$component = '',
$a = null )

Prints out a translated string.

Prints out a translated string using the return value from the get_string() function.

Example usage of this function when the string is in the moodle.php file:
echo ''; print_string('course'); echo '';

Example usage of this function when the string is not in the moodle.php file:
echo '

'; print_string('typecourse', 'calendar'); echo '

';

Parameters
string$identifierThe key identifier for the localized string
string$componentThe module where the key identifier is stored. If none is specified then moodle.php is used.
string | object | array$aAn object, string or number that can be used within translation strings

◆ print_tabs()

print_tabs ( $tabrows,
$selected = null,
$inactive = null,
$activated = null,
$return = false )

Returns a string containing a nested list, suitable for formatting into tabs with CSS.

It is not recommended to use this function in Moodle 2.5 but it is left for backward compartibility.

Example how to print a single line tabs: $rows = array( new tabobject(...), new tabobject(...) ); echo $OUTPUT->tabtree($rows, $selectedid);

Multiple row tabs may not look good on some devices but if you want to use them you can specify ->subtree for the active tabobject.

Parameters
array$tabrowsAn array of rows where each row is an array of tab objects
string$selectedThe id of the selected tab (whatever row it's on)
array$inactiveAn array of ids of inactive tabs that are not selectable.
array$activatedAn array of ids of other tabs that are currently activated
bool$returnIf true output is returned rather then echo'd
Return values
stringHTML output if $return was set to true.

◆ print_textarea()

print_textarea ( )
Deprecated
since Moodle 3.6

◆ print_upgrade_part_end()

print_upgrade_part_end ( $plugin,
$installation,
$verbose )

Default end upgrade callback.

Parameters
string$plugin
bool$installationtrue if installation, false means upgrade

◆ print_upgrade_part_start()

print_upgrade_part_start ( $plugin,
$installation,
$verbose )

Default start upgrade callback.

Parameters
string$plugin
bool$installationtrue if installation, false means upgrade

◆ print_whole_category_list()

print_whole_category_list ( )
Deprecated
since 2.5

◆ process_environment_bypass()

process_environment_bypass ( $xml,
& $result )

This function will post-process the result record by executing the specified function, modifying it as necessary, also a custom message will be added to the result object to be printed by the display layer.

Every bypass function must be defined in this file and it'll return true/false to decide if the original test is bypassed or no. Also such bypass functions are able to directly handling the result object although it should be only under exceptional conditions.

Parameters
stringxmldata containing the bypass data
objectresult object to be updated
Return values
void

◆ process_environment_messages()

process_environment_messages ( $xml,
& $result )

This function will detect if there is some message available to be added to the result in order to clarify enviromental details.

@uses INCORRECT_FEEDBACK_FOR_REQUIRED @uses INCORRECT_FEEDBACK_FOR_OPTIONAL

Parameters
stringxmldata containing the feedback data
objectreult object to be updated

◆ process_environment_restrict()

process_environment_restrict ( $xml,
& $result )

This function will post-process the result record by executing the specified function, modifying it as necessary, also a custom message will be added to the result object to be printed by the display layer.

Every restrict function must be defined in this file and it'll return true/false to decide if the original test is restricted or no. Also such restrict functions are able to directly handling the result object although it should be only under exceptional conditions.

Parameters
stringxmldata containing the restrict data
objectresult object to be updated
Return values
void

◆ process_environment_result()

process_environment_result ( $element,
& $result )

Once the result has been determined, look in the XML for any messages, or other things that should be done depending on the outcome.

Parameters
array$elementthe element from the environment.xml file which may have children defining what should be done with the outcome.
object$resultthe result of the test, which may be modified by this function as specified in the XML.

◆ process_manual_revoke()

process_manual_revoke ( $recipientid,
$issuerid,
$issuerrole,
$badgeid )

Manually revoke awarded badges.

Parameters
int$recipientid
int$issuerid
int$issuerrole
int$badgeid
Return values
bool

◆ process_new_icon()

process_new_icon ( $context,
$component,
$filearea,
$itemid,
$originalfile,
$preferpng = false )

Stores optimised icon images in icon file area.

Since 2.9 this function will generate an icon in the same format as the original file when possible. To counter that behaviour, you can use the argument $preferpng to generate a PNG icon.

Parameters
context$context
string$component
stringfilearea
int$itemid
string$originalfile
boolean$preferpngWhen true, it will try to generate a PNG file regardless of the original file.
Return values
mixednew unique revision number or false if not saved

◆ profile_display_badges()

profile_display_badges ( )
Deprecated
since Moodle 2.9 MDL-45898 - please do not use this function any more.

◆ profile_display_fields()

profile_display_fields ( )

◆ profile_edit_category()

profile_edit_category ( )

◆ profile_edit_field()

profile_edit_field ( )

◆ profiling_available()

profiling_available ( )

Whether PHP profiling is available.

This check ensures that one of the available PHP Profiling extensions is available.

Return values
bool

◆ profiling_export_generate()

profiling_export_generate ( array $runids,
$tmpdir )

Generate the mpr contents (xml files) in the temporal directory.

Parameters
array$runidslist of runids to be generated.
string$tmpdirfilesystem fullpath of tmp generation.
Return values
booleanthe mpr contents have been generated (true) or no (false).

◆ profiling_export_package()

profiling_export_package ( $file,
$tmpdir )

Package (zip) the mpr contents (xml files) in the final location.

Parameters
string$filefilesystem fullpath to destination .mpr file.
string$tmpdirfilesystem fullpath of tmp generation.
Return values
booleanthe mpr contents have been generated (true) or no (false).

◆ profiling_export_runs()

profiling_export_runs ( array $runids,
$file )

Export profiling runs to a .mpr (moodle profile runs) file.

This function gets an array of profiling runs (array of runids) and saves a .mpr file into destination for ulterior handling.

Format of .mpr files: mpr files are simple zip packages containing these files:

  • moodle_profiling_runs.xml: Metadata about the information exported. Contains some header information (version and release of moodle, database, git hash - if available, date of export...) and a list of all the runids included in the export.

runid.xml: One file per each run detailed in the main file, containing the raw dump of the given runid in the profiling table.

Possible improvement: Start storing some extra information in the profiling table for each run (moodle version, database, git hash...).

Parameters
array$runidslist of runids to be exported.
string$filefilesystem fullpath to destination .mpr file.
Return values
booleanthe mpr file has been successfully exported (true) or no (false).

◆ profiling_get_flag()

profiling_get_flag ( $flag)

Check for profiling flags in all possible places.

Parameters
string$flagname
Return values
boolean

◆ profiling_get_import_main_schema()

profiling_get_import_main_schema ( )

Return the xml schema for the main import file.

Return values
string

◆ profiling_get_import_run_schema()

profiling_get_import_run_schema ( )

Return the xml schema for each individual run import file.

Return values
string

◆ profiling_get_script()

profiling_get_script ( )

Returns the path to the php script being requested.

Note this function is a partial copy of initialise_fullme() and setup_get_remote_url(), in charge of setting $FULLME, $SCRIPT and friends. To be used by early profiling runs in situations where $SCRIPT isn't defined yet

Return values
stringabsolute path (wwwroot based) of the script being executed

◆ profiling_import_runs()

profiling_import_runs ( $file,
$commentprefix = '' )

Import a .mpr (moodle profile runs) file into moodle.

See profiling_export_runs() for more details about the implementation of .mpr files.

Parameters
string$filefilesystem fullpath to target .mpr file.
string$commentprefixprefix to add to the comments of all the imported runs.
Return values
booleanthe mpr file has been successfully imported (true) or no (false).

◆ profiling_print_run()

profiling_print_run ( $run,
$prevreferences = null )

Generate the output to print a profiling run including further actions you can then take.

Parameters
object$runThe profiling run object we are going to display.
array$prevreferencesA list of run objects to list as comparison targets.
Return values
stringThe output to display on the screen for this run.

◆ proxy_log_callback()

proxy_log_callback ( $code)

Add http stream instrumentation.

This detects which any reads or writes to a php stream which uses the 'http' handler. Ideally 100% of traffic uses the Moodle curl libraries which do not use php streams.

Parameters
array$codestream callback code

◆ purge_all_caches()

purge_all_caches ( )

Invalidates browser caches and cached data in temp.

Return values
void

◆ purge_caches()

purge_caches ( $options = [])

Selectively invalidate different types of cache.

Purges the cache areas specified. By default, this will purge all caches but can selectively purge specific areas alone or in combination.

Parameters
bool[]$optionsSpecific parts of the cache to purge. Valid options are: 'muc' Purge MUC caches? 'theme' Purge theme cache? 'lang' Purge language string cache? 'js' Purge javascript cache? 'filter' Purge text filter cache? 'other' Purge all other caches?

◆ purge_other_caches()

purge_other_caches ( )

Purge all non-MUC caches not otherwise purged in purge_caches.

IMPORTANT - If you are adding anything here to do with the cache directory you should also have a look at phpunit_util::reset_dataroot()

◆ purify_html()

purify_html ( $text,
$options = array() )

KSES replacement cleaning function - uses HTML Purifier.

Parameters
string$textThe (X)HTML string to purify
array$optionsArray of options; currently only option supported is 'allowid' (if set, does not remove id attributes when cleaning)
Return values
string

◆ put_records_csv()

put_records_csv ( )
Deprecated
since Moodle 3.2
See also
download_as_dataformat (lib/dataformatlib.php)

◆ qualified_me()

qualified_me ( )

Guesses the full URL of the current script.

This function is using $PAGE->url, but may fall back to $FULLME which is constructed from PHP_SELF and REQUEST_URI or SCRIPT_NAME

Return values
mixedfull page URL string or false if unknown

◆ query_end()

query_end ( $result)
protected

This should be called immediately after each db query.

It does a clean up of resources.

Parameters
mixed$resultThe db specific result obtained from running a query.
Return values
void

◆ query_start()

query_start ( $sql,
?array $params,
$type,
$extrainfo = null )
protected

Called before each db query.

Parameters
string$sql
array | null$paramsAn array of parameters.
int$typetype of query
mixed$extrainfodriver specific extra information
Return values
void

◆ question_add_context_in_key()

question_add_context_in_key ( $categories)

Add context in categories key.

Parameters
array$categoriesThe list of categories.
Return values
array
Deprecated
since Moodle 4.0 MDL-71585
See also
qbank_managecategories\helper
Todo
Final deprecation on Moodle 4.4 MDL-72438

◆ question_add_tops()

question_add_tops ( )

◆ question_category_delete_safe()

question_category_delete_safe ( $category)

Category is about to be deleted, 1/ All questions are deleted for this question category.

2/ Any questions that can't be deleted are moved to a new category NOTE: this function is called from lib/db/upgrade.php

Parameters
object | core_course_category$categorycourse category object

◆ question_category_in_use()

question_category_in_use ( $categoryid,
$recursive = false )

Tests whether any question in a category is used by any part of Moodle.

Parameters
integer$categoryida question category id.
boolean$recursivewhether to check child categories too.
Return values
booleanwhether any question in this category is in use.

◆ question_category_options()

question_category_options ( $contexts,
$top = false,
$currentcat = 0,
$popupform = false,
$nochildrenof = -1,
$escapecontextnames = true )

Output an array of question categories.

Parameters
array$contextsThe list of contexts.
bool$topWhether to return the top categories or not.
int$currentcat
bool$popupform
int$nochildrenof
boolean$escapecontextnamesWhether the returned name of the thing is to be HTML escaped or not.
Return values
array
Deprecated
since Moodle 4.0 MDL-71585
See also
qbank_managecategories\helper
Todo
Final deprecation on Moodle 4.4 MDL-72438

◆ question_category_select_menu()

question_category_select_menu ( $contexts,
$top = false,
$currentcat = 0,
$selected = "",
$nochildrenof = -1 )

Output a select menu of question categories.

Categories from this course and (optionally) published categories from other courses are included. Optionally, only categories the current user may edit can be included.

Parameters
array$contexts
bool$top
int$currentcat
integer$selectedoptionally, the id of a category to be selected by default in the dropdown.
int$nochildrenof
Deprecated
since Moodle 4.0 MDL-71585
See also
qbank_managecategories\helper
Todo
Final deprecation on Moodle 4.4 MDL-72438

◆ question_categorylist()

question_categorylist ( $categoryid)

Get the list of categories.

Parameters
int$categoryid
Return values
arrayof question category ids of the category and all subcategories.

◆ question_categorylist_parents()

question_categorylist_parents ( int $categoryid)

Get all parent categories of a given question category in descending order.

Parameters
int$categoryidfor which you want to find the parents.
Return values
arrayof question category ids of all parents categories.

◆ question_context_has_any_questions()

question_context_has_any_questions ( $context)

Determine whether there are any questions belonging to this context, that is whether any of its question categories contain any questions.

This will return true even if all the questions are hidden.

Parameters
mixed$contexteither a context object, or a context id.
Return values
booleanwhether any of the question categories beloning to this context have any questions in them.

◆ question_default_export_filename()

question_default_export_filename ( $course,
$category )

Create a reasonable default file name for exporting questions from a particular category.

Parameters
object$coursethe course the questions are in.
object$categorythe question category.
Return values
stringthe filename.

◆ question_delete_activity()

question_delete_activity ( $cm,
$notused = false )

All question categories and their questions are deleted for this activity.

Parameters
object$cmthe course module object representing the activity
bool$notusedthe argument is not used any more. Kept for backwards compatibility.
Return values
boolean

◆ question_delete_context()

question_delete_context ( $contextid)

All question categories and their questions are deleted for this context id.

Parameters
int$contextidThe contextid to delete question categories from
Return values
arrayonly returns an empty array for backwards compatibility.

◆ question_delete_course()

question_delete_course ( $course,
$notused = false )

All question categories and their questions are deleted for this course.

Parameters
stdClass$coursean object representing the activity
bool$notusedthis argument is not used any more. Kept for backwards compatibility.
Return values
boolalways true.

◆ question_delete_course_category()

question_delete_course_category ( $category,
$newcategory,
$notused = false )

Category is about to be deleted, 1/ All question categories and their questions are deleted for this course category.

2/ All questions are moved to new category

Parameters
stdClass | core_course_category$categorycourse category object
stdClass | core_course_category$newcategoryempty means everything deleted, otherwise id of category where content moved
bool$notusedthis argument is no longer used. Kept for backwards compatibility.
Return values
boolean

◆ question_delete_question()

question_delete_question ( $questionid)

Deletes question and all associated data from the database.

It will not delete a question if it is used somewhere, instead it will just delete the reference.

Parameters
int$questionidThe id of the question being deleted

◆ question_edit_url()

question_edit_url ( $context)

Gets the question edit url.

Parameters
object$contexta context
Return values
string|boolA URL for editing questions in this context.

◆ question_extend_settings_navigation()

question_extend_settings_navigation ( navigation_node $navigationnode,
$context,
$baseurl = '/question/edit.php' )

Adds question bank setting links to the given navigation node if caps are met and loads the navigation from the plugins.

Qbank plugins can extend the navigation_plugin_base and add their own navigation node, this method will help to autoload those nodes in the question bank navigation.

Parameters
navigation_node$navigationnodeThe navigation node to add the question branch to
object$context
string$baseurlthe url of the base where the api is implemented from
Return values
navigation_nodeReturns the question branch that was added

◆ question_fix_top_names()

question_fix_top_names ( $categories,
$escape = true )

Finds top categories in the given categories hierarchy and replace their name with a proper localised string.

Parameters
array$categoriesAn array of question categories.
boolean$escapeWhether the returned name of the thing is to be HTML escaped or not.
Return values
arrayThe same question category list given to the function, with the top category names being translated.
Deprecated
since Moodle 4.0 MDL-71585
See also
qbank_managecategories\helper
Todo
Final deprecation on Moodle 4.4 MDL-72438

◆ question_get_all_capabilities()

question_get_all_capabilities ( )

Get the question bank caps.

Return values
arrayall the question bank capabilities.

◆ question_get_default_category()

question_get_default_category ( $contextid)

Get the default category for the context.

Parameters
integer$contextida context id.
Return values
object|boolthe default question category for that context, or false if none.

◆ question_get_export_single_question_url()

question_get_export_single_question_url ( $question)

Get the URL to export a single question (exportone.php).

Parameters
stdClass | question_definition$questionthe question definition as obtained from question_bank\load_question_data() or question_bank\make_question(). (Only ->id and ->contextid are used.)
Return values
moodle_urlthe requested URL.
Deprecated
since Moodle 4.0
See also
qbank_exporttoxml\helper\question_get_export_single_question_url()
Todo
Final deprecation on Moodle 4.4 MDL-72438

◆ question_get_question_capabilities()

question_get_question_capabilities ( )

Get the array of capabilities for question.

Return values
arrayall the capabilities that relate to accessing particular questions.

◆ question_get_top_categories_for_contexts()

question_get_top_categories_for_contexts ( $contextids)

Gets the list of top categories in the given contexts in the array("categoryid,categorycontextid") format.

Parameters
array$contextidsList of context ids
Return values
array

◆ question_get_top_category()

question_get_top_category ( $contextid,
$create = false )

Gets the top category in the given context.

This function can optionally create the top category if it doesn't exist.

Parameters
int$contextidA context id.
bool$createWhether create a top category if it doesn't exist.
Return values
bool|stdClassThe top question category for that context, or false if none.

◆ question_has_capability_on()

question_has_capability_on ( $questionorid,
$cap,
$notused = -1 )

Check capability on category.

Parameters
int | stdClass | question_definition$questionoridobject or id. If an object is passed, it should include ->contextid and ->createdby.
string$cap'add', 'edit', 'view', 'use', 'move' or 'tag'.
int$notusedno longer used.
Return values
boolthis user has the capability $cap for this question $question?

◆ question_hash()

question_hash ( $question)

Creates a stamp that uniquely identifies this version of the question.

In future we want this to use a hash of the question data to guarantee that identical versions have the same version stamp.

Parameters
object$question
Return values
stringA unique version stamp
Deprecated
since Moodle 4.0
Todo
Final deprecation on Moodle 4.4 MDL-72438

◆ question_is_only_toplevel_category_in_context()

question_is_only_toplevel_category_in_context ( )

◆ question_load_questions()

question_load_questions ( $questionids,
$extrafields = '',
$join = '' )

Load a set of questions, given a list of ids.

The $join and $extrafields arguments can be used together to pull in extra data. See, for example, the usage in mod/quiz/attempt.php, and read the code below to see how the SQL is assembled. Throws exceptions on error.

Parameters
array$questionidsarray of question ids.
string$extrafieldsextra SQL code to be added to the query.
string$joinextra SQL code to be added to the query.
Return values
array|stringquestion objects.

◆ question_make_default_categories()

question_make_default_categories ( $contexts)

Gets the default category in the most specific context.

If no categories exist yet then default ones are created in all contexts.

Parameters
array$contextsThe context objects for this context and all parent contexts.
Return values
objectThe default category - the category in the course context

◆ question_make_export_url()

question_make_export_url ( $contextid,
$categoryid,
$format,
$withcategories,
$withcontexts,
$filename )

Create url for question export.

Parameters
int$contextid
int$categoryid
string$format
string$withcategories
string$withcontexts
string$filename
Return values
moodle_urlexport file url
Deprecated
since Moodle 4.0 MDL-71573
See also
qbank_exportquestions\exportquestions_helper
Todo
Final deprecation on Moodle 4.4 MDL-72438

◆ question_module_uses_questions()

question_module_uses_questions ( $modname)

Does an activity module use the question bank?

Parameters
string$modnameThe name of the module (without mod_ prefix).
Return values
booltrue if the module uses questions.

◆ question_move_category_to_context()

question_move_category_to_context ( $categoryid,
$oldcontextid,
$newcontextid )

This function helps move a question cateogry to a new context by moving all the files belonging to all the questions to the new context.

Also moves subcategories.

Parameters
integer$categoryidthe id of the category being moved.
integer$oldcontextidthe old context id.
integer$newcontextidthe new context id.

◆ question_move_question_tags_to_new_context()

question_move_question_tags_to_new_context ( array $questions,
context $newcontext )

This function will handle moving all tag instances to a new context for a given list of questions.

Questions can be tagged in up to two contexts: 1.) The context the question exists in. 2.) The course context (if the question context is a higher context. E.g. course category context or system context.

This means a question that exists in a higher context (e.g. course cat or system context) may have multiple groups of tags in any number of child course contexts.

Questions in the course category context can be move "down" a context level into one of their child course contexts or activity contexts which affects the availability of that question in other courses / activities.

In this case it makes the questions no longer available in the other course or activity contexts so we need to make sure that the tag instances in those other contexts are removed.

Parameters
stdClass[]$questionsThe list of question being moved (must include the id and contextid)
context$newcontextThe Moodle context the questions are being moved to

◆ question_move_questions_to_category()

question_move_questions_to_category ( $questionids,
$newcategoryid )

This function should be considered private to the question bank, it is called from question/editlib.php question/contextmoveq.php and a few similar places to to the work of actually moving questions and associated data.

However, callers of this function also have to do other work, which is why you should not call this method directly from outside the questionbank.

Parameters
array$questionidsof question ids.
integer$newcategoryidthe id of the category to move to.
Return values
bool

◆ question_page_type_list()

question_page_type_list ( $pagetype,
$parentcontext,
$currentcontext )

Return a list of page types.

Parameters
string$pagetypecurrent page type
stdClass$parentcontextBlock's parent context
stdClass$currentcontextCurrent context of block
Return values
array

◆ question_pluginfile()

question_pluginfile ( $course,
$context,
$component,
$filearea,
$args,
$forcedownload,
$options = [] )

Called by pluginfile.php to serve files related to the 'question' core component and for files belonging to qtypes.

For files that relate to questions in a question_attempt, then we delegate to a function in the component that owns the attempt (for example in the quiz, or in core question preview) to get necessary inforation.

(Note that, at the moment, all question file areas relate to questions in attempts, so the If at the start of the last paragraph is always true.)

Does not return, either calls send_file_not_found(); or serves the file.

Parameters
stdClass$coursecourse settings object
stdClass$contextcontext object
string$componentthe name of the component we are serving files for.
string$fileareathe name of the file area.
array$argsthe remaining bits of the file path.
bool$forcedownloadwhether the user must be forced to download the file.
array$optionsadditional options affecting the file serving
Return values
array|bool

◆ question_preload_questions()

question_preload_questions ( $questionids = null,
$extrafields = '',
$join = '',
$extraparams = [],
$orderby = '' )

Given a list of ids, load the basic information about a set of questions from the questions table.

The $join and $extrafields arguments can be used together to pull in extra data. See, for example, the usage in {

See also
mod_quiz\quiz_attempt}, and read the code below to see how the SQL is assembled. Throws exceptions on error.
Parameters
array$questionidsarray of question ids to load. If null, then all questions matched by $join will be loaded.
string$extrafieldsextra SQL code to be added to the query.
string$joinextra SQL code to be added to the query.
array$extraparamsvalues for any placeholders in $join. You must use named placeholders.
string$orderbywhat to order the results by. Optional, default is unspecified order.
Return values
arraypartially complete question objects. You need to call get_question_options on them before they can be properly used.

◆ question_preview_popup_params()

question_preview_popup_params ( )

Popup params for the question preview.

Return values
arraythat can be passed as $params to the {
See also
popup_action()} constructor.
Deprecated
since Moodle 4.0
See also
qbank_previewquestion\previewquestion_helper\question_preview_popup_params()
Todo
Final deprecation on Moodle 4.4 MDL-72438

◆ question_preview_url()

question_preview_url ( $questionid,
$preferredbehaviour = null,
$maxmark = null,
$displayoptions = null,
$variant = null,
$context = null )

Generate the URL for starting a new preview of a given question with the given options.

Parameters
integer$questionidthe question to preview.
string$preferredbehaviourthe behaviour to use for the preview.
float$maxmarkthe maximum to mark the question out of.
question_display_options$displayoptionsthe display options to use.
int$variantthe variant of the question to preview. If null, one will be picked randomly.
object$contextcontext to run the preview in (affects things like filter settings, theme, lang, etc.) Defaults to $PAGE->context.
Return values
moodle_urlthe URL.
Deprecated
since Moodle 4.0
See also
qbank_previewquestion\helper\question_preview_url()
Todo
Final deprecation on Moodle 4.4 MDL-72438

◆ question_remove_stale_questions_from_category()

question_remove_stale_questions_from_category ( $categoryid)

Remove stale questions from a category.

While questions should not be left behind when they are not used any more, it does happen, maybe via restore, or old logic, or uncovered scenarios. When this happens, the users are unable to delete the question category unless they move those stale questions to another one category, but to them the category is empty as it does not contain anything. The purpose of this function is to detect the questions that may have gone stale and remove them.

You will typically use this prior to checking if the category contains questions.

The stale questions (unused and hidden to the user) handled are:

  • hidden questions
  • random questions
Parameters
int$categoryidThe category ID.
Deprecated
since Moodle 4.0 MDL-71585
See also
qbank_managecategories\helper
Todo
Final deprecation on Moodle 4.4 MDL-72438

◆ question_reorder_qtypes()

question_reorder_qtypes ( $sortedqtypes,
$tomove,
$direction )

Move one question type in a list of question types.

If you try to move one element off of the end, nothing will change.

Parameters
array$sortedqtypesAn array $qtype => anything.
string$tomoveone of the keys from $sortedqtypes
integer$direction+1 or -1
Return values
arrayan array $index => $qtype, with $index from 0 to n in order, and the $qtypes in the same order as $sortedqtypes, except that $tomove will have been moved one place.

◆ question_require_capability_on()

question_require_capability_on ( $question,
$cap )

Require capability on question.

Parameters
int | stdClass | question_definition$questionobject or id. If an object is passed, it should include ->contextid and ->createdby.
string$cap'add', 'edit', 'view', 'use', 'move' or 'tag'.
Return values
booltrue if the user has the capability. Throws exception if not.

◆ question_rewrite_question_preview_urls()

question_rewrite_question_preview_urls ( $text,
$questionid,
$filecontextid,
$filecomponent,
$filearea,
$itemid,
$previewcontextid,
$previewcomponent,
$options = null )

Rewrite the PLUGINFILE urls in part of the content of a question, for use when viewing the question outside an attempt (for example, in the question bank listing or in the quiz statistics report).

Parameters
string$textthe question text.
int$questionidthe question id.
int$filecontextidthe context id of the question being displayed.
string$filecomponentthe component that owns the file area.
string$fileareathe file area name.
int | null$itemidthe file's itemid
int$previewcontextidthe context id where the preview is being displayed.
string$previewcomponentcomponent responsible for displaying the preview.
array$optionstext and file options ('forcehttps'=>false)
Return values
string\$questiontextwith URLs rewritten.

◆ question_save_from_deletion()

question_save_from_deletion ( $questionids,
$newcontextid,
$oldplace,
$newcategory = null )

Creates a new category to save the questions in use.

Parameters
array$questionidsof question ids
object$newcontextidthe context to create the saved category in.
string$oldplacea textual description of the think being deleted, e.g. from get_context_name
object$newcategory
Return values
mixedfalse on

◆ question_save_qtype_order()

question_save_qtype_order ( $neworder,
$config = null )

Save a new question type order to the config_plugins table.

Parameters
array$neworderAn arra $index => $qtype. Indices should start at 0 and be in order.
object$configget_config('question'), if you happen to have it around, to save one DB query.

◆ question_sort_tags()

question_sort_tags ( $tagobjects,
$categorycontext,
$filtercourses = null )

Sort question tags by course or normal tags.

This function also search tag instances that may have a context id that don't match either a course or question context and fix the data setting the correct context id.

Parameters
core_tag_tag[]$tagobjectsThe tags for the given $question.
stdClass$categorycontextThe question categories context.
stdClass[] | null$filtercoursesThe courses to filter the course tags by.
Return values
stdClass\$sortedtagobjectsSorted tag objects.

◆ questions_in_use()

questions_in_use ( $questionids)

Check if the question is used.

Parameters
array$questionidsof question ids.
Return values
booleanwhether any of these questions are being used by any part of Moodle.

◆ raise_memory_limit()

raise_memory_limit ( $newlimit)

Function to raise the memory limit to a new value.

Will respect the memory limit if it is higher, thus allowing settings in php.ini, apache conf or command line switches to override it.

The memory limit should be expressed with a constant MEMORY_STANDARD, MEMORY_EXTRA or MEMORY_HUGE. It is possible to use strings or integers too (eg:'128M').

Parameters
mixed$newlimitthe new memory limit
Return values
boolsuccess

◆ random_bytes_emulate()

random_bytes_emulate ( $length)

Try to generate cryptographically secure pseudo-random bytes.

Note this is achieved by fallbacking between:

  • PHP 7 random_bytes().
  • OpenSSL openssl_random_pseudo_bytes().
  • In house random generator getting its entropy from various, hard to guess, pseudo-random sources.
Parameters
int$lengthrequested length in bytes
Deprecated
since 4.3.
Return values
stringbinary data

◆ random_string()

random_string ( $length = 15)

Generate and return a random string of the specified length.

Parameters
int$lengthThe length of the string to be created.
Return values
string

◆ raw_connect()

raw_connect ( string $dbhost,
string $dbuser,
string $dbpass,
string $dbname,
$prefix,
array $dboptions = null )
abstractprotected

Connect to db The real connection establisment, called from connect() and set_dbhwrite()

Parameters
string$dbhostThe database host.
string$dbuserThe database username.
string$dbpassThe database username's password.
string$dbnameThe name of the database being connected to.
mixed$prefixstring means moodle db prefix, false used for external databases where prefix not used
array$dboptionsdriver specific options
Return values
booltrue
Exceptions
dml_connection_exceptionif error

◆ rc4decrypt()

rc4decrypt ( $data)

rc4decrypt

Parameters
string$dataData to decrypt.
Return values
stringThe now decrypted data.

◆ rc4encrypt()

rc4encrypt ( $data)

rc4encrypt

Parameters
string$dataData to encrypt.
Return values
stringThe now encrypted data.

◆ rebuild_contexts()

rebuild_contexts ( )
Deprecated
since 2.2

◆ rebuild_course_cache()

moodle_database rebuild_course_cache ( int $courseid = 0,
bool $clearonly = false,
bool $partialrebuild = false )

Rebuilds or resets the cached list of course activities stored in MUC.

rebuild_course_cache() must NEVER be called from lib/db/upgrade.php. At the same time course cache may ONLY be cleared using this function in upgrade scripts of plugins.

During the bulk operations if it is necessary to reset cache of multiple courses it is enough to call increment_revision_number() for the table 'course' and field 'cacherev' specifying affected courses in select.

Cached course information is stored in MUC core/coursemodinfo and is validated with the DB field {course}.cacherev

$DB

Parameters
int$courseidid of course to rebuild, empty means all
boolean$clearonlyonly clear the cache, gets rebuild automatically on the fly. Recommended to set to true to avoid unnecessary multiple rebuilding.
boolean$partialrebuildwill not delete the whole cache when it's true. use purge_module_cache() or purge_section_cache() must be called before when partialrebuild is true. use purge_module_cache() to invalidate mod cache. use purge_section_cache() to invalidate section cache.
Return values
void
Exceptions
coding_exception

◆ rebuildnolinktag()

rebuildnolinktag ( $text)

This function is used to rebuild the <nolink> tag because some formats (PLAIN and WIKI) will transform it to html entities.

Parameters
string$textText to search for nolink tag in
Return values
string

◆ recaptcha_check_response()

recaptcha_check_response ( $verifyurl,
$privkey,
$remoteip,
$response )

Calls an HTTP POST function to verify if the user's response was correct.

Parameters
string$verifyurlURL for reCAPTCHA verification
string$privkeyThe private key for reCAPTCHA
string$remoteipThe user's IP
string$responseThe response from reCAPTCHA
Return values
ReCaptchaResponse

◆ recaptcha_get_challenge_html()

recaptcha_get_challenge_html ( $apiurl,
$pubkey,
$lang = null,
bool $compactmode = false )

Gets the challenge HTML This is called from the browser, and the resulting reCAPTCHA HTML widget is embedded within the HTML form it was called from.

Parameters
string$apiurlURL for reCAPTCHA API
string$pubkeyThe public key for reCAPTCHA
string$langLanguage to use. If not provided, get current language.
bool$compactmodeIf true, use the compact widget.
Return values
string- The HTML to be embedded in the user's form.

◆ recaptcha_lang()

recaptcha_lang ( $lang = null)

Returns the language code the reCAPTCHA element should use.

Google reCAPTCHA uses different language codes than Moodle so we must convert. https://developers.google.com/recaptcha/docs/language

Parameters
string$langLanguage to use. If not provided, get current language.
Return values
stringA language code

◆ redirect()

redirect ( $url,
$message = '',
$delay = null,
$messagetype = core\output\notification::NOTIFY_INFO )

Redirects the user to another page, after printing a notice.

This function calls the OUTPUT redirect method, echo's the output and then dies to ensure nothing else happens.

Good practice: You should call this method before starting page output by using any of the OUTPUT methods.

Parameters
moodle_url | string$urlA moodle_url to redirect to. Strings are not to be trusted!
string$messageThe message to display to the user
int$delayThe delay before redirecting
string$messagetypeThe type of notification to show the message in. See constants on core\output\notification.
Exceptions
moodle_exception

◆ reduce_memory_limit()

reduce_memory_limit ( $newlimit)

Function to reduce the memory limit to a new value.

Will respect the memory limit if it is lower, thus allowing settings in php.ini, apache conf or command line switches to override it

The memory limit should be expressed with a string (eg:'64M')

Parameters
string$newlimitthe new memory limit
Return values
bool

◆ remoteip_in_list()

remoteip_in_list ( $list)

Is the current ip in a given list?

Parameters
string$list
Return values
bool

◆ remove_course_contents()

remove_course_contents ( $courseid,
$showfeedback = true,
array $options = null )

Clear a course out completely, deleting all content but don't delete the course itself.

This function does not verify any permissions.

Please note this function also deletes all user enrolments, enrolment instances and role assignments by default.

$options:

  • 'keep_roles_and_enrolments' - false by default
  • 'keep_groups_and_groupings' - false by default
Parameters
int$courseidThe id of the course that is being deleted
bool$showfeedbackWhether to display notifications of each action the function performs.
array$optionsextra options
Return values
booltrue if all the removals succeeded. false if there were any failures. If this method returns false, some of the removals will probably have succeeded, and others failed, but you have no way of knowing which.

◆ remove_dir()

remove_dir ( $dir,
$contentonly = false )

Delete directory or only its content.

Parameters
string$dirdirectory path
bool$contentonly
Return values
boolsuccess, true also if dir does not exist

◆ rename_to_unused_name()

rename_to_unused_name ( string $filepath,
string $prefix = '_temp_' )

Renames a file or directory to a unique name within the same directory.

This function is designed to avoid any potential race conditions, and select an unused name.

Parameters
string$filepathOriginal filepath
string$prefixPrefix to use for the temporary name
Return values
string|boolNew file path or false if failed
Since
Moodle 3.10

◆ replace_ampersands_not_followed_by_entity()

replace_ampersands_not_followed_by_entity ( $string)

Given a string, performs a negative lookahead looking for any ampersand character that is not followed by a proper HTML entity.

If any is found, it is replaced by &. The string is then returned.

Parameters
string$string
Return values
string

◆ report_insights_context_insights()

report_insights_context_insights ( \context $context)
Deprecated
since Moodle 3.8

◆ require_admin()

require_admin ( )

A convenience function for where we must be logged in as admin.

Return values
void

◆ require_phpunit_isolation()

require_phpunit_isolation ( )

A helper function for deprecated files to use to ensure that, when they are included for unit tests, they are run in an isolated process.

Exceptions
coding_exceptionThe exception thrown when the process is not isolated.

◆ require_user_key_login()

require_user_key_login ( $script,
$instance = null,
$keyvalue = null )

Require key login.

Function terminates with error if key not found or incorrect.

@uses NO_MOODLE_COOKIES @uses PARAM_ALPHANUM

Parameters
string$scriptunique script identifier
int$instanceoptional instance id
string$keyvalueThe key. If not supplied, this will be fetched from the current session.
Return values
intInstance ID

◆ required_param()

required_param ( $parname,
$type )

Returns a particular value for the named variable, taken from POST or GET.

If the parameter doesn't exist then an error is thrown because we require this variable.

This function should be used to initialise all required values in a script that are based on parameters. Usually it will be used like this: $id = required_param('id', PARAM_INT);

Please note the $type parameter is now required and the value can not be array.

Parameters
string$parnamethe name of the page parameter we want
string$typeexpected type of parameter
Return values
mixed
Exceptions
coding_exception

◆ required_param_array()

required_param_array ( $parname,
$type )

Returns a particular array value for the named variable, taken from POST or GET.

If the parameter doesn't exist then an error is thrown because we require this variable.

This function should be used to initialise all required values in a script that are based on parameters. Usually it will be used like this: $ids = required_param_array('ids', PARAM_INT);

Note: arrays of arrays are not supported, only alphanumeric keys with _ and - are supported

Parameters
string$parnamethe name of the page parameter we want
string$typeexpected type of parameter
Return values
array
Exceptions
coding_exception

◆ reset_course_userdata()

reset_course_userdata ( $data)

This function will empty a course of user data.

It will retain the activities and the structure of the course.

Parameters
object$dataan object containing all the settings including courseid (without magic quotes)
Return values
arraystatus array of array component, item, error

◆ reset_login_count()

reset_login_count ( )

◆ reset_password_and_mail()

reset_password_and_mail ( $user)

Resets specified user's password and send the new password to the user via email.

Parameters
stdClass$userA $USER object
Return values
boolReturns true if mail was sent OK and false if there was an error.

◆ reset_text_filters_cache()

reset_text_filters_cache ( $phpunitreset = false)

Resets some data related to filters, called during upgrade or when general filter settings change.

Parameters
bool$phpunitresettrue means called from our PHPUnit integration test reset
Return values
void

◆ resize_image()

resize_image ( $filepath,
$width,
$height,
$forcecanvas = false )

Resize an image from an image path.

This maintains the aspect ratio of the image. This will not enlarge the image.

Parameters
string$filepathThe full path to the original image file.
int | null$widthThe max width of the resized image, or null to only use the height.
int | null$heightThe max height of the resized image, or null to only use the width.
bool$forcecanvasWhether the final dimensions should be set to $width and $height.
Return values
string|boolFalse if a problem occurs, else the resized image data.

◆ resize_image_from_image()

resize_image_from_image ( $original,
$imageinfo,
$width,
$height,
$forcecanvas = false )

Resize an image from an image object.

Parameters
resource | GdImage$originalThe image to work on.
array$imageinfoContains [0] => originalwidth, [1] => originalheight.
int | null$widthThe max width of the resized image, or null to only use the height.
int | null$heightThe max height of the resized image, or null to only use the width.
bool$forcecanvasWhether the final dimensions should be set to $width and $height.
Return values
string|boolFalse if a problem occurs, else the resized image data.

◆ resourcelib_embed_general()

resourcelib_embed_general ( $fullurl,
$title,
$clicktoopen,
$mimetype )

Returns general link or file embedding html.

Parameters
string$fullurl
string$title
string$clicktoopen
string$mimetype
Return values
stringhtml

◆ resourcelib_embed_image()

resourcelib_embed_image ( $fullurl,
$title )

Returns image embedding html.

Parameters
string$fullurl
string$title
Return values
stringhtml

◆ resourcelib_embed_pdf()

resourcelib_embed_pdf ( $fullurl,
$title,
$clicktoopen )

Returns general link or pdf embedding html.

Parameters
string$fullurl
string$title
string$clicktoopen
Return values
stringhtml

◆ resourcelib_get_displayoptions()

resourcelib_get_displayoptions ( array $enabled,
$current = null )

Returns list of available display options.

Parameters
array$enabledlist of options enabled in module configuration
int$currentcurrent display options for existing instances
Return values
arrayof key=>name pairs

◆ resourcelib_get_extension()

resourcelib_get_extension ( $fullurl)

Looks for the extension.

Parameters
string$fullurl
Return values
stringfile extension

◆ resourcelib_guess_url_mimetype()

resourcelib_guess_url_mimetype ( $fullurl)

Tries to guess correct mimetype for arbitrary URL.

Parameters
string$fullurl
Return values
stringmimetype

◆ resourcelib_try_file_migration()

resourcelib_try_file_migration ( $filepath,
$cmid,
$courseid,
$component,
$filearea,
$itemid )

Try on demand migration of file from old course files.

Parameters
string$filepathold file path
int$cmidmigrated course module if
int$courseid
string$component
string$fileareanew file area
int$itemidmigrated file item id
Return values
mixed,falseif not found, stored_file instance if migrated to new area

◆ restrict_php_version()

restrict_php_version ( & $result,
$version )

Check if the current PHP version is greater than or equal to an unsupported version.

Parameters
object$resultan environment_results instance
string$versionthe version of PHP that can't be used
Return values
boolresult of version check

◆ restrict_php_version_7()

restrict_php_version_7 ( & $result)

Check if the current PHP version is greater than or equal to PHP version 7.

Parameters
object$resultan environment_results instance
Return values
boolresult of version check

◆ restrict_php_version_71()

restrict_php_version_71 ( & $result)

Check if the current PHP version is greater than or equal to PHP version 7.1.

Parameters
object$resultan environment_results instance
Return values
boolresult of version check

◆ restrict_php_version_72()

restrict_php_version_72 ( & $result)

Check if the current PHP version is greater than or equal to PHP version 7.2.

Parameters
object$resultan environment_results instance
Return values
boolresult of version check

◆ restrict_php_version_73()

restrict_php_version_73 ( & $result)

Check if the current PHP version is greater than or equal to PHP version 7.3.

Parameters
object$resultan environment_results instance
Return values
boolresult of version check

◆ restrict_php_version_74()

restrict_php_version_74 ( & $result)

Check if the current PHP version is greater than or equal to PHP version 7.4.

Parameters
object$resultan environment_results instance
Return values
boolresult of version check

◆ restrict_php_version_80()

restrict_php_version_80 ( $result)

Check if the current PHP version is greater than or equal to PHP version 8.0.

Parameters
object$resultan environment_results instance
Return values
boolresult of version check

◆ restrict_php_version_81()

restrict_php_version_81 ( $result)

Check if the current PHP version is greater than or equal to PHP version 8.1.

Parameters
object$resultan environment_results instance
Return values
boolresult of version check

◆ restrict_php_version_82()

restrict_php_version_82 ( $result)

Check if the current PHP version is greater than or equal to PHP version 8.2.

Parameters
object$resultan environment_results instance
Return values
boolresult of version check

◆ restrict_php_version_83()

restrict_php_version_83 ( $result)

Check if the current PHP version is greater than or equal to PHP version 8.3.

Parameters
object$resultan environment_results instance
Return values
boolresult of version check

◆ right_to_left()

right_to_left ( )

Returns true if the user is using a right-to-left language.

Return values
booleantrue if the current language is right-to-left (Hebrew, Arabic etc)

◆ s()

s ( $var)

Add quotes to HTML characters.

Returns $var with HTML characters (like "<", ">", etc.) properly quoted. Related function p() simply prints the output of this function.

Parameters
string$varthe string potentially containing HTML characters
Return values
string

◆ search_generate_SQL()

object search_generate_SQL ( $parsetree,
$datafield,
$metafield,
$mainidfield,
$useridfield,
$userfirstnamefield,
$userlastnamefield,
$timefield,
$instancefield,
$tagfields = [] )

Primitive function to generate a SQL string from a parse tree.

Parameters:

$parsetree should be a parse tree generated by a search_lexer/search_parser combination. Other fields are database table names to search.

@global object

◆ search_generate_text_SQL()

search_generate_text_SQL ( $parsetree,
$datafield,
$metafield,
$mainidfield,
$useridfield,
$userfirstnamefield,
$userlastnamefield,
$timefield,
$instancefield )

Primitive function to generate a SQL string from a parse tree using TEXT indexes.

If searches aren't suitable to use TEXT this function calls the default search_generate_SQL() one.

Deprecated
since Moodle 2.9 MDL-48939
Todo
MDL-48940 This will be deleted in Moodle 3.2
See also
search_generate_SQL()

◆ search_users()

object search_users ( $courseid,
$groupid,
$searchtext,
$sort = '',
array $exceptions = null )

Search through course users.

If $coursid specifies the site course then this function searches through all undeleted and confirmed users

@uses SITEID @uses SQL_PARAMS_NAMED @uses CONTEXT_COURSE

Parameters
int$courseidThe course in question.
int$groupidThe group in question.
string$searchtextThe string to search for
string$sortA field to sort by
array$exceptionsA list of IDs to ignore, eg 2,4,5,8,9,10
Return values
array

◆ select_db_handle()

select_db_handle ( int $type,
string $sql )
protected

Select appropriate db handle - readwrite or readonly.

Parameters
int$typetype of query
string$sql
Return values
void

◆ send_confirmation_email()

send_confirmation_email ( $user,
$confirmationurl = null )

Send email to specified user with confirmation text and activation link.

Parameters
stdClass$userA $USER object
string$confirmationurluser confirmation URL
Return values
boolReturns true if mail was sent OK and false if there was an error.

◆ send_headers()

send_headers ( $contenttype,
$cacheable = true )

Send the HTTP headers that Moodle requires.

There is a backwards compatibility hack for legacy code that needs to add custom IE compatibility directive.

Example: if (!isset($CFG->additionalhtmlhead)) { $CFG->additionalhtmlhead = ''; } $CFG->additionalhtmlhead .= '<meta http-equiv="X-UA-Compatible" content="IE=8" >'; header('X-UA-Compatible: IE=8'); echo $OUTPUT->header();

Please note the $CFG->additionalhtmlhead alone might not work, you should send the IE compatibility header() too.

Parameters
string$contenttype
bool$cacheableCan this page be cached on back?
Return values
void,sendsHTTP headers

◆ send_password_change_confirmation_email()

send_password_change_confirmation_email ( $user,
$resetrecord )

Sends a password change confirmation email.

Parameters
stdClass$userA $USER object
stdClass$resetrecordAn object tracking metadata regarding password reset request
Return values
boolReturns true if mail was sent OK and false if there was an error.

◆ send_password_change_info()

send_password_change_info ( $user)

Sends an email containing information on how to change your password.

Parameters
stdClass$userA $USER object
Return values
boolReturns true if mail was sent OK and false if there was an error.

◆ serialise_tool_proxy()

serialise_tool_proxy ( )
Deprecated
since 3.10

◆ session_get_instance()

session_get_instance ( )
Deprecated
since 2.6

◆ session_get_realuser()

session_get_realuser ( )
Deprecated
since 2.6

◆ session_is_legacy()

session_is_legacy ( )
Deprecated
since 2.6

◆ session_is_loggedinas()

session_is_loggedinas ( )
Deprecated
since 2.6

◆ session_kill()

session_kill ( )
Deprecated
since 2.6

◆ session_kill_all()

session_kill_all ( )
Deprecated
since 2.6

◆ session_kill_user()

session_kill_user ( )
Deprecated
since 2.6

◆ session_loginas()

session_loginas ( )
Deprecated
since 2.6

◆ session_set_user()

session_set_user ( )
Deprecated
since 2.6

◆ session_touch()

session_touch ( )
Deprecated
since 2.6

◆ sesskey()

sesskey ( )

Makes sure that $USER->sesskey exists, if $USER itself exists.

It sets a new sesskey if one does not already exist, but does not overwrite existing sesskeys. Returns the sesskey string if $USER exists, or boolean false if not.

@uses $USER

Return values
string

◆ set_bounce_count()

set_bounce_count ( $user,
$reset = false )

Increment or reset user's email bounce count.

Parameters
stdClass$userobject containing an id
bool$resetwill reset the count to 0

◆ set_cache_flag()

set_cache_flag ( $type,
$name,
$value,
$expiry = null )

Set a volatile flag.

Parameters
string$typethe "type" namespace for the key
string$namethe key to set
string$valuethe value to set (without magic quotes) - null will remove the flag
int$expiry(optional) epoch indicating expiry - defaults to now()+ 24hs
Return values
boolAlways returns true

◆ set_config()

set_config ( $name,
$value,
$plugin = null )

Set a key in global configuration.

Set a key/value pair in both this session's $CFG global variable and in the 'config' database table for future sessions.

Can also be used to update keys for plugin-scoped configs in config_plugin table. In that case it doesn't affect $CFG.

A NULL value will delete the entry.

NOTE: this function is called from lib/db/upgrade.php

Parameters
string$namethe key to set
string$valuethe value to set (without magic quotes)
string$plugin(optional) the plugin scope, default null
Return values
booltrue or exception

◆ set_cron_lock()

set_cron_lock ( $name,
$until,
$ignorecurrent = false )

Try to obtain or release the cron lock.

Parameters
string$namename of lock
int$untiltimestamp when this lock considered stale, null means remove lock unconditionally
bool$ignorecurrentignore current lock state, usually extend previous lock, defaults to false
Return values
booltrue if lock obtained

◆ set_current_group()

set_current_group ( )
Deprecated
Since year 2006 - please do not use this function any more.

◆ set_db_handle()

set_db_handle ( $dbh)
abstractprotected

Sets db handle to be used with subsequent queries.

Parameters
resource$dbh
Return values
void

◆ set_debugging()

set_debugging ( $level,
$debugdisplay = null )

Alter debugging level for the current request, the change is not saved in database.

Parameters
int$levelone of the DEBUG_* constants
bool$debugdisplay

◆ set_mnet_remote_client()

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

Parameters
mnet_remote_client$clientthe client to set up
Exceptions
moodle_exception

◆ set_moodle_cookie()

set_moodle_cookie ( $username)

Sets a moodle cookie with a weakly encrypted username.

Parameters
string$usernameto encrypt and place in a cookie, '' means delete current cookie
Return values
void

◆ set_send_count()

set_send_count ( $user,
$reset = false )

Used to increment or reset email sent count.

Parameters
stdClass$userobject containing an id
bool$resetwill reset the count to 0
Return values
void

◆ set_user_device_type()

set_user_device_type ( )
Deprecated
since 2.6

◆ set_user_preference()

set_user_preference ( $name,
$value,
$user = null )

Sets a preference for the specified user.

If a $user object is submitted it's 'preference' property is used for the preferences cache.

When additional validation/permission check is needed it is better to use {

See also
useredit_update_user_preference()}
Parameters
string$nameThe key to set as preference for the specified user
string$valueThe value to set for the $name key in the specified user's record, null means delete current value.
stdClass | int | null$userA moodle user object or id, null means current user
Exceptions
coding_exception
Return values
boolAlways true or exception

◆ set_user_preferences()

set_user_preferences ( array $prefarray,
$user = null )

Sets a whole array of preferences for the current user.

If a $user object is submitted it's 'preference' property is used for the preferences cache.

Parameters
array$prefarrayAn array of key/value pairs to be set
stdClass | int | null$userA moodle user object or id, null means current user
Return values
boolAlways true or exception

◆ setnew_password_and_mail()

setnew_password_and_mail ( $user,
$fasthash = false )

Sets specified user's password and send the new password to the user via email.

Parameters
stdClass$userA $USER object
bool$fasthashIf true, use a low cost factor when generating the hash for speed.
Return values
bool|stringReturns "true" if mail was sent OK and "false" if there was an error

◆ setup()

moodle_text_filter::setup ( $page,
$context )

Setup page with filter requirements and other prepare stuff.

Override this method if the filter needs to setup page requirements or needs other stuff to be executed.

Note this method is invoked from {

See also
setup_page_for_filters()} for each piece of text being filtered, so it is responsible for controlling its own execution cardinality.
Parameters
moodle_page$pagethe page we are going to add requirements to.
context$contextthe context which contents are going to be filtered.
Since
Moodle 2.3

Reimplemented in filter_glossary, filter_mathjaxloader, and filter_mediaplugin.

◆ setup_DB()

stdClass setup_DB ( )

Sets up global $DB moodle_database instance.

$CFG The global configuration instance.

See also
config.php
config-dist.php @global stdClass $DB The global moodle_database instance.
Return values
void|boolReturns true when finished setting up $DB. Returns void when $DB has already been set.

◆ setup_get_remote_url()

setup_get_remote_url ( )

Get the URL that PHP/the web server thinks it is serving.

Private function used by initialise_fullme. In your code, use $PAGE->url, $SCRIPT, etc.

Return values
arrayin the same format that parse_url returns, with the addition of a 'fullpath' element, which includes any slasharguments path.

◆ setup_page_for_filters()

filter_manager::setup_page_for_filters ( $page,
$context )

Setup page with filters requirements and other prepare stuff.

This method is used by {

See also
format_text()} and {
format_string()} in order to allow filters to setup any page requirement (js, css...) or perform any action needed to get them prepared before filtering itself happens by calling to each every active setup() method.

Note it's executed for each piece of text filtered, so filter implementations are responsible of controlling the cardinality of the executions that may be different depending of the stuff to prepare.

Parameters
moodle_page$pagethe page we are going to add requirements to.
context$contextthe context which contents are going to be filtered.
Since
Moodle 2.3

◆ setup_page_for_globally_available_filters()

filter_manager::setup_page_for_globally_available_filters ( $page)

Setup the page for globally available filters.

This helps setting up the page for filters which may be applied to the page, even if they do not belong to the current context, or are not yet visible because the content is lazily added (ajax). This method always uses to the system context which determines the globally available filters.

This should only ever be called once per request.

Parameters
moodle_page$pageThe page.
Since
Moodle 3.2

◆ shift_course_mod_dates()

shift_course_mod_dates ( $modname,
$fields,
$timeshift,
$courseid,
$modid = 0 )

Change dates in module - used from course reset.

Parameters
string$modnameforum, assignment, etc
array$fieldsarray of date fields from mod table
int$timeshifttime difference
int$courseid
int$modid(Optional) passed if specific mod instance in course needs to be updated.
Return values
boolsuccess

◆ shorten_filename()

shorten_filename ( $filename,
$length = MAX_FILENAME_SIZE,
$includehash = false )

Shortens a given filename by removing characters positioned after the ideal string length.

When the filename is too long, the file cannot be created on the filesystem due to exceeding max byte size. Limiting the filename to a certain size (considering multibyte characters) will prevent this.

Parameters
string$filenamefile name
int$lengthideal string length
bool$includehashWhether to include a file hash in the shortened version. This ensures uniqueness.
Return values
string\$shortenedshortened file name

◆ shorten_filenames()

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.

Parameters
array$pathThe paths to reduce the length.
int$lengthIdeal string length
bool$includehashWhether to include a file hash in the shortened version. This ensures uniqueness.
Return values
array\$resultShortened paths in array.

◆ shorten_text()

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.

Parameters
string$texttext to be shortened
int$idealideal string length
boolean$exactif false, $text will not be cut mid-word
string$endingThe string to append if the passed string is truncated
Return values
string\$truncateshortened string

◆ show_event()

show_event ( )
Deprecated
please use calendar_event->toggle_visibility(true) instead.

◆ signup_captcha_enabled()

signup_captcha_enabled ( )

Returns whether or not the captcha element is enabled, and the admin settings fulfil its requirements.

Return values
bool

◆ signup_get_user_confirmation_authplugin()

signup_get_user_confirmation_authplugin ( )

Check if user confirmation is enabled on this site and return the auth plugin handling registration if enabled.

Return values
stdClassthe current auth plugin handling user registration or false if registration not enabled
Since
Moodle 3.2

◆ signup_is_enabled()

signup_is_enabled ( )

Check if sign-up is enabled in the site.

If is enabled, the function will return the authplugin instance.

Return values
mixedfalse if sign-up is not enabled, the authplugin instance otherwise.
Since
Moodle 3.2

◆ signup_setup_new_user()

signup_setup_new_user ( $user)

Add the missing fields to a user that is going to be created.

Parameters
stdClass$userthe new user object
Return values
stdClassthe user filled
Since
Moodle 3.2

◆ signup_validate_data()

signup_validate_data ( $data,
$files )

Validates the standard sign-up data (except recaptcha that is validated by the form element).

Parameters
array$datathe sign-up data
array$filesfiles among the data
Return values
arraylist of errors, being the key the data element name and the value the error itself
Since
Moodle 3.2

◆ site_is_public()

site_is_public ( )

Tries to guess if $CFG->wwwroot is publicly accessible or not.

Never put your faith on this function and rely on its accuracy as there might be false positives. It just performs some simple checks, and mainly is used for places where we want to hide some options such as site registration when $CFG->wwwroot is not publicly accessible. Good thing is there is no false negative. Note that it's possible to force the result of this check by specifying $CFG->site_is_public in config.php

Return values
bool

◆ site_scale_used()

site_scale_used ( )
Deprecated
since Moodle 3.1

◆ skip_main_destination()

skip_main_destination ( )
Deprecated
use $OUTPUT->skip_link_target() in instead.

◆ soap_call()

soap_call ( $connection,
$call,
$params )

Make a call to a SoapClient.

Parameters
SoapClient$connectionThe SoapClient to call
string$callOperation to be performed by client
array$paramsParameters for the call
Return values
mixedThe return parameters of the operation or a SoapFault If the operation returned several parameters then these are returned as an object rather than an array

◆ soap_connect()

soap_connect ( $wsdl,
$trace = false )

Create a new SoapClient object.

Parameters
string$wsdlURI of the WSDL file
boolean$traceindicates if the soap messages should be saved (i.e. if get_soap_messages is used) and should be used only for debugging
Return values
mixedReturns either a SoapClient object or, if the connection failed, a SoapFault object.

◆ sort_categories_by_tree()

sort_categories_by_tree ( & $categories,
$id = 0,
$level = 1 )

Returns the categories with their names ordered following parent-child relationships.

finally it tries to return pending categories (those being orphaned, whose parent is incorrect) to avoid missing any category from original array.

Parameters
array$categories
int$id
int$level
Return values
array

◆ start_delegated_transaction()

start_delegated_transaction ( )

On DBs that support it, switch to transaction mode and begin a transaction.

Return values
moodle_transaction

◆ stats_cron_daily()

stats_cron_daily ( $maxdays = 1)

Execute daily statistics gathering.

Parameters
int$maxdaysmaximum number of days to be processed
Return values
booleansuccess

◆ stats_cron_monthly()

stats_cron_monthly ( )

Execute monthly statistics gathering.

Return values
booleansuccess

◆ stats_cron_weekly()

stats_cron_weekly ( )

Execute weekly statistics gathering.

Return values
booleansuccess

◆ stats_fix_zeros()

stats_fix_zeros ( $stats,
$timeafter,
$timestr,
$line2 = true,
$line3 = false )

Fix missing entries in the statistics.

This creates a dummy stat when nothing happened during a day/week/month.

Parameters
array$statsarray of statistics.
int$timeafterunused.
string$timestrtype of statistics to generate (dayly, weekly, monthly).
boolean$line2
boolean$line3
Return values
arrayof fixed statistics.

◆ stats_get_base_daily()

stats_get_base_daily ( $time = 0)

Start of day.

Parameters
int$timetimestamp
Return values
intstart of day

◆ stats_get_base_monthly()

stats_get_base_monthly ( $time = 0)

Start of month.

Parameters
int$timetimestamp
Return values
intstart of month

◆ stats_get_base_weekly()

stats_get_base_weekly ( $time = 0)

Start of week.

Parameters
int$timetimestamp
Return values
intstart of week

◆ stats_get_next_day_start()

stats_get_next_day_start ( $time)

Start of next day.

Parameters
int$timetimestamp
Return values
startof next day

◆ stats_get_next_month_start()

stats_get_next_month_start ( $time)

Start of next month.

Parameters
int$timetimestamp
Return values
startof next month

◆ stats_get_next_week_start()

stats_get_next_week_start ( $time)

Start of next week.

Parameters
int$timetimestamp
Return values
startof next week

◆ stats_get_start_from()

stats_get_start_from ( $str)

Return starting date of stats processing.

Parameters
string$strname of table - daily, weekly or monthly
Return values
inttimestamp

◆ stats_progress()

stats_progress ( $ident)

Print daily cron progress.

Parameters
string$ident

◆ stats_run_query()

stats_run_query ( $sql,
$parameters = array() )

Execute individual daily statistics queries.

Parameters
string$sqlThe query to run
Return values
booleansuccess

◆ stats_temp_table_clean()

stats_temp_table_clean ( )

Deletes summary logs table for stats calculation.

Return values
boolsuccess (true) or failure(false)

◆ stats_temp_table_fill()

stats_temp_table_fill ( $timestart,
$timeend )

Fills the temporary stats tables with new data.

This function is meant to be called to get a new day of data

Parameters
inttimestamp of the start time of logs view
inttimestamp of the end time of logs view
Return values
boolsuccess (true) or failure(false)

◆ stats_temp_table_setup()

stats_temp_table_setup ( )

Fills the temporary stats tables with new data.

This function is meant to be called once at the start of stats generation

Parameters
inttimestart timestamp of the start time of logs view
inttimeend timestamp of the end time of logs view
Return values
boolsuccess (true) or failure(false)

◆ strip_links()

strip_links ( $string)

Given a string, replaces all .

* by .* and returns the string.

Parameters
string$string
Return values
string

◆ strip_pluginfile_content()

strip_pluginfile_content ( $source)

Removes the usage of Moodle files from a text.

In some rare cases we need to re-use a text that already has embedded links to some files hosted within Moodle. But the new area in which we will push this content does not support files... therefore we need to remove those files.

Parameters
string$sourceThe text
Return values
stringThe stripped text

◆ strip_querystring()

strip_querystring ( $url)

Remove query string from url.

Takes in a URL and returns it without the querystring portion.

Parameters
string$urlthe url which may have a query string attached.
Return values
stringThe remaining URL.

◆ swapshuffle()

swapshuffle ( $array)

Given a simple array, this shuffles it up just like shuffle() Unlike PHP's shuffle() this function works on any machine.

Parameters
array$arrayThe array to be rearranged
Return values
array

◆ swapshuffle_assoc()

swapshuffle_assoc ( $array)

Like swapshuffle(), but works on associative arrays.

Parameters
array$arrayThe associative array to be rearranged
Return values
array

◆ table_names()

table_names ( string $sql)
protected

Parse table names from query.

Parameters
string$sql
Return values
array

◆ tag_add()

tag_add ( )
Deprecated
since 3.1

◆ tag_assign()

tag_assign ( )
Deprecated
since 3.1. Use core_tag_tag\set_item_tags() or core_tag_tag\add_item_tag() instead

◆ tag_autocomplete()

tag_autocomplete ( )
Deprecated
since 3.0

◆ tag_bulk_delete_instances()

tag_bulk_delete_instances ( )
Deprecated
since 3.1

◆ tag_cleanup()

tag_cleanup ( )
Deprecated
since 3.1

◆ tag_cloud_sort()

tag_cloud_sort ( )
Deprecated
since 3.1

◆ tag_compute_correlations()

tag_compute_correlations ( )
Deprecated
since 3.1

◆ tag_cron()

tag_cron ( )
Deprecated
since 3.1

◆ tag_delete()

tag_delete ( )
Deprecated
since 3.1

◆ tag_delete_instance()

tag_delete_instance ( )
Deprecated
since 3.1. Use core_tag_tag\remove_item_tag() instead

◆ tag_delete_instances()

tag_delete_instances ( )
Deprecated
since 3.1

◆ tag_description_set()

tag_description_set ( )
Deprecated
since 3.1. Use core_tag_tag\get($tagid)->update() instead

◆ tag_display_name()

tag_display_name ( )
Deprecated
since 3.1

◆ tag_find_records()

tag_find_records ( )
Deprecated
since 3.1. Use core_tag_tag\get_by_name()->get_tagged_items() instead

◆ tag_find_tags()

tag_find_tags ( )
Deprecated
since 3.1

◆ tag_get()

tag_get ( )
Deprecated
since 3.1

◆ tag_get_correlated()

tag_get_correlated ( )
Deprecated
since 3.1

◆ tag_get_id()

tag_get_id ( )
Deprecated
since 3.1. Use core_tag_tag\get_by_name() or core_tag_tag\get_by_name_bulk()

◆ tag_get_name()

tag_get_name ( )
Deprecated
since 3.1

◆ tag_get_related_tags()

tag_get_related_tags ( )
Deprecated
since 3.1

◆ tag_get_related_tags_csv()

tag_get_related_tags_csv ( )
Deprecated
since 3.1

◆ tag_get_tags()

tag_get_tags ( )
Deprecated
since 3.1. Use core_tag_tag\get_item_tags() instead

◆ tag_get_tags_array()

tag_get_tags_array ( )
Deprecated
since 3.1

◆ tag_get_tags_csv()

tag_get_tags_csv ( )
Deprecated
since 3.1. Use core_tag_tag\get_item_tags_array() or $OUTPUT->tag_list(core_tag_tag\get_item_tags())

◆ tag_get_tags_ids()

tag_get_tags_ids ( )
Deprecated
since 3.1. Use core_tag_tag\get_item_tags() instead

◆ tag_normalize()

tag_normalize ( )
Deprecated
since 3.1

◆ tag_print_cloud()

tag_print_cloud ( )
Deprecated
since 3.1

◆ tag_print_description_box()

tag_print_description_box ( )
Deprecated
since 3.1

◆ tag_print_management_box()

tag_print_management_box ( )
Deprecated
since 3.1

◆ tag_print_search_box()

tag_print_search_box ( )
Deprecated
since 3.1

◆ tag_print_search_results()

tag_print_search_results ( )
Deprecated
since 3.1

◆ tag_print_tagged_users_table()

tag_print_tagged_users_table ( )
Deprecated
since 3.1

◆ tag_print_user_box()

tag_print_user_box ( )
Deprecated
since 3.1

◆ tag_print_user_list()

tag_print_user_list ( )
Deprecated
since 3.1

◆ tag_process_computed_correlation()

tag_process_computed_correlation ( )
Deprecated
since 3.1

◆ tag_record_count()

tag_record_count ( )
Deprecated
since 3.1. Use core_tag_tag\get($tagid)->count_tagged_items() instead

◆ tag_record_tagged_with()

tag_record_tagged_with ( )
Deprecated
since 3.1. Use core_tag_tag\get($tagid)->is_item_tagged_with() instead

◆ tag_rename()

tag_rename ( )
Deprecated
since 3.1. Use core_tag_tag\get($tagid)->update() instead

◆ tag_set()

tag_set ( )
Deprecated
since 3.1

◆ tag_set_add()

tag_set_add ( )
Deprecated
since 3.1

◆ tag_set_delete()

tag_set_delete ( )
Deprecated
since 3.1

◆ tag_set_flag()

tag_set_flag ( )
Deprecated
since 3.1. Use core_tag_tag\get($tagid)->flag() instead

◆ tag_type_set()

tag_type_set ( )
Deprecated
since 3.1. Use core_tag_tag\get($tagid)->update() instead

◆ tag_unset_flag()

tag_unset_flag ( )
Deprecated
since 3.1. Use core_tag_tag\get($tagid)->reset_flag() instead

◆ testing_cli_argument_path()

testing_cli_argument_path ( $moodlepath)

Returns relative path against current working directory, to be used for shell execution hints.

Parameters
string$moodlepathstarting with "/", ex: "/admin/tool/cli/init.php"
Return values
stringpath relative to current directory or absolute path

◆ testing_cli_fix_directory_separator()

testing_cli_fix_directory_separator ( $path)

Fix DIRECTORY_SEPARATOR for windows.

In PHP on Windows, DIRECTORY_SEPARATOR is set to the backslash (::) character. However, if you're running a Cygwin/Msys/Git shell exec() calls will return paths using the forward slash (/) character.

NOTE: Because PHP on Windows will accept either forward or backslashes, paths should be built using ONLY forward slashes, regardless of OS. MOODLE_DIRECTORY_SEPARATOR should only be used when parsing paths returned by the shell.

Parameters
string$path
Return values
string

◆ testing_error()

testing_error ( $errorcode,
$text = '' )

Prints an error and stops execution.

Parameters
integer$errorcode
string$text
Return values
voidexits

◆ testing_fix_file_permissions()

testing_fix_file_permissions ( $file)

Try to change permissions to $CFG->dirroot or $CFG->dataroot if possible.

Parameters
string$file
Return values
boolsuccess

◆ testing_initdataroot()

testing_initdataroot ( $dataroot,
$framework )

Mark empty dataroot to be used for testing.

Parameters
string$datarootThe dataroot directory
string$frameworkThe test framework
Return values
void

◆ testing_is_cygwin()

testing_is_cygwin ( )

Find out if running under Cygwin on Windows.

Return values
bool

◆ testing_is_mingw()

testing_is_mingw ( )

Returns whether a mingw CLI is running.

MinGW sets $_SERVER['TERM'] to cygwin, but it can not run .bat files; this function may be useful when we need to output proposed commands to users using Windows CLI interfaces.

@externalurl http://sourceforge.net/p/mingw/bugs/1902

Return values
bool

◆ testing_update_composer_dependencies()

testing_update_composer_dependencies ( bool $selfupdate = true,
bool $updatedependencies = true )

Perform necessary steps to install and/or upgrade composer and its dependencies.

Installation is mandatory, but upgrade is optional.

Note: This function does not return, but will call exit() on error.

Parameters
bool$selfupdatePerform a composer self-update to update the composer.phar utility
bool$updatedependenciesUpgrade dependencies

◆ text_filtering_hash() [1/2]

filter_manager::text_filtering_hash ( )
Deprecated
Since Moodle 3.0 MDL-50491. This was used by the old text filtering system, but no more.

◆ text_filtering_hash() [2/2]

null_filter_manager::text_filtering_hash ( )

As for the equivalent filter_manager method.

Deprecated
Since Moodle 3.0 MDL-50491.

◆ text_to_html()

text_to_html ( $text,
$smileyignored = null,
$para = true,
$newlines = true )

Given plain text, makes it into HTML as nicely as possible.

May contain HTML tags already.

Do not abuse this function. It is intended as lower level formatting feature used by format_text() to convert FORMAT_MOODLE to HTML. You are supposed to call format_text() in most of cases.

Parameters
string$textThe string to convert.
boolean$smileyignoredWas used to determine if smiley characters should convert to smiley images, ignored now
boolean$paraIf true then the returned string will be wrapped in div tags
boolean$newlinesIf true then lines newline breaks will be converted to HTML newline breaks.
Return values
string

◆ textlib_get_instance()

textlib_get_instance ( )
Deprecated
since Moodle 2.2 use core_text\xxxx() instead.

◆ theme_build_css_for_themes()

theme_build_css_for_themes ( $themeconfigs = [],
$directions = ['rtl', 'ltr'],
$cache = true,
$mtraceprogress = false )

Generates and saves the CSS files for the given theme configs.

Parameters
theme_config[]$themeconfigsAn array of theme_config instances.
array$directionsMust be a subset of ['rtl', 'ltr'].
bool$cacheShould the generated files be stored in local cache.
Return values
arrayThe built theme content in a multi-dimensional array of name => direction => content

◆ theme_get_config_file_path()

theme_get_config_file_path ( $themename)

Get the path to a theme config.php file.

Parameters
string$themenameThe non-frankenstyle name of the theme to check

◆ theme_get_css_filename()

theme_get_css_filename ( $themename,
$globalrevision,
$themerevision,
$direction )

Get the path to the local cached CSS file.

Parameters
string$themenameThe non-frankenstyle theme name.
int$globalrevisionThe global theme revision.
int$themerevisionThe theme specific revision.
string$directionEither 'ltr' or 'rtl' (case sensitive).

◆ theme_get_locked_theme_for_device()

theme_get_locked_theme_for_device ( $device)

Returns the theme named defined in config.php for the given device.

Parameters
string$deviceThe device
Deprecated
since 4.3.
Return values
stringor null

◆ theme_get_next_revision()

theme_get_next_revision ( )

Calculates and returns the next theme revision number.

Return values
int

◆ theme_get_next_sub_revision_for_theme()

theme_get_next_sub_revision_for_theme ( $themename)

Calculates and returns the next theme revision number.

Parameters
string$themenameThe non-frankenstyle name of the theme
Return values
int

◆ theme_get_revision()

theme_get_revision ( )

Returns current theme revision number.

Return values
int

◆ theme_get_sub_revision_for_theme()

theme_get_sub_revision_for_theme ( $themename)

Returns current theme sub revision number.

This is the revision for this theme exclusively, not the global theme revision.

Parameters
string$themenameThe non-frankenstyle name of the theme
Return values
int

◆ theme_is_device_locked()

theme_is_device_locked ( $device)

Checks if the given device has a theme defined in config.php.

Parameters
string$deviceThe device
Deprecated
since 4.3.
Return values
bool

◆ theme_reset_all_caches()

theme_reset_all_caches ( )

Invalidate all server and client side caches.

This method deletes the physical directory that is used to cache the theme files used for serving. Because it deletes the main theme cache directory all themes are reset by this function.

◆ theme_reset_static_caches()

theme_reset_static_caches ( )

Reset static caches.

This method indicates that all running cron processes should exit at the next opportunity.

◆ theme_set_designer_mod()

theme_set_designer_mod ( $state)

Enable or disable theme designer mode.

Parameters
bool$state

◆ theme_set_revision()

theme_set_revision ( $revision)

Sets the current theme revision number.

Parameters
int$revisionThe new theme revision number

◆ theme_set_sub_revision_for_theme()

theme_set_sub_revision_for_theme ( $themename,
$revision )

Sets the current theme revision number for a specific theme.

This does not affect the global themerev value.

Parameters
string$themenameThe non-frankenstyle name of the theme
int$revisionThe new theme revision number

◆ truncate_userinfo()

truncate_userinfo ( array $info)

Will truncate userinfo as it comes from auth_get_userinfo (from external auth) which may have large fields.

Parameters
array$infoArray of user properties to truncate if needed
Return values
arrayThe now truncated information that was passed in

◆ trusttext_active()

trusttext_active ( )

Is trusttext feature active?

Return values
bool

◆ trusttext_pre_edit()

trusttext_pre_edit ( $object,
$field,
$context )

Must be called before editing of all texts with trust flag.

Removes all XSS nasties from texts stored in database if needed.

Parameters
stdClass$objectdata object with xxx, xxxformat and xxxtrust fields
string$fieldname of text field
context$contextactive context
Return values
stdClassupdated $object

◆ trusttext_trusted()

trusttext_trusted ( $context)

Is current user trusted to enter no dangerous XSS in this context?

Please note the user must be in fact trusted everywhere on this server!!

Parameters
context$context
Return values
booltrue if user trusted

◆ unformat_float()

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!

Parameters
string$localefloatlocale aware float representation
bool$strictIf true, then check the input and return false if it is not a valid number.
Return values
mixedfloat|bool - false or the parsed float.

◆ uninstall_plugin()

uninstall_plugin ( $type,
$name )

Automatically clean-up all plugin data and remove the plugin DB tables.

NOTE: do not call directly, use new /admin/plugins.php?uninstall=component instead!

Parameters
string$typeThe plugin type, eg. 'mod', 'qtype', 'workshopgrading' etc.
string$nameThe plugin name, eg. 'forum', 'multichoice', 'accumulative' etc. @uses global $OUTPUT to produce notices and other messages
Return values
void

◆ unload_all_filters() [1/2]

filter_manager::unload_all_filters ( )
protected

Unloads all filters and other cached information.

Reimplemented in performance_measuring_filter_manager.

◆ unload_all_filters() [2/2]

performance_measuring_filter_manager::unload_all_filters ( )
protected

Unloads all filters and other cached information.

Reimplemented from filter_manager.

◆ unserialize_array()

unserialize_array ( $expression)

Safe analogue of unserialize() that can only parse arrays.

Arrays may contain only integers or strings as both keys and values. Nested arrays are allowed.

Parameters
string$expression
Return values
array|booleither parsed array or false if parsing was impossible.

◆ unserialize_object()

unserialize_object ( string $input)

Safe method for unserializing given input that is expected to contain only a serialized instance of an stdClass object.

If any class type other than stdClass is included in the input string, it will not be instantiated and will be cast to an stdClass object. The initial cast to array, then back to object is to ensure we are always returning the correct type, otherwise we would return an instances of {

See also
__PHP_Incomplete_class} for malformed strings
Parameters
string$input
Return values
stdClass

◆ unset_all_config_for_plugin()

unset_all_config_for_plugin ( $plugin)

Remove all the config variables for a given plugin.

NOTE: this function is called from lib/db/upgrade.php

Parameters
string$plugina plugin, for example 'quiz' or 'qtype_multichoice';
Return values
booleanwhether the operation succeeded.

◆ unset_cache_flag()

unset_cache_flag ( $type,
$name )

Removes a single volatile flag.

Parameters
string$typethe "type" namespace for the key
string$namethe key to set
Return values
bool

◆ unset_config()

unset_config ( $name,
$plugin = null )

Removes a key from global configuration.

NOTE: this function is called from lib/db/upgrade.php

Parameters
string$namethe key to set
string$plugin(optional) the plugin scope
Return values
booleanwhether the operation succeeded.

◆ unset_user_preference()

unset_user_preference ( $name,
$user = null )

Unsets a preference completely by deleting it from the database.

If a $user object is submitted it's 'preference' property is used for the preferences cache.

Parameters
string$nameThe key to unset as preference for the specified user
stdClass | int | null$userA moodle user object or id, null means current user
Exceptions
coding_exception
Return values
boolAlways true or exception

◆ unzip_file()

unzip_file ( )

◆ update_category_button()

update_category_button ( )
Deprecated
since 2.5

◆ update_event()

update_event ( )
Deprecated
please calendar_event->update() instead.

◆ update_field_with_unique_index()

update_field_with_unique_index ( $table,
$field,
array $newvalues,
array $otherconditions,
$unusedvalue = -1 )

This method can update the values in mulitple database rows for a colum with a unique index, without violating that constraint.

Suppose we have a table with a unique index on (otherid, sortorder), and for a particular value of otherid, we want to change all the sort orders. You have to do this carefully or you will violate the unique index at some time. This method takes care of the details for you.

Note that, it is the responsibility of the caller to make sure that the requested rename is legal. For example, if you ask for [1 => 2, 2 => 2] then you will get a unique key violation error from the database.

Parameters
string$tableThe database table to modify.
string$fieldthe field that contains the values we are going to change.
array$newvaluesoldvalue => newvalue how to change the values. E.g. [1 => 4, 2 => 1, 3 => 3, 4 => 2].
array$otherconditionsarray fieldname => requestedvalue extra WHERE clause conditions to restrict which rows are affected. E.g. array('otherid' => 123).
int$unusedvalue(defaults to -1) a value that is never used in $ordercol.

◆ update_internal_user_password()

update_internal_user_password ( stdClass $user,
# string $password[\SensitiveParameter],
bool $fasthash = false )

Update password hash in user object (if necessary).

The password is updated if:

  1. The password has changed (the hash of $user->password is different to the hash of $password).
  2. The existing hash is using an out-of-date algorithm (or the legacy md5 algorithm).

The password is peppered with the latest pepper before hashing, if peppers are available. Updating the password will modify the $user object and the database record to use the current hashing algorithm. It will remove Web Services user tokens too.

Parameters
stdClass$userUser object (password property may be updated).
string$passwordPlain text password.
bool$fasthashIf true, use a low cost factor when generating the hash This is much faster to generate but makes the hash less secure. It is used when lots of hashes need to be generated quickly.
Return values
boolAlways returns true.

◆ update_log_display_entry()

update_log_display_entry ( )

◆ update_login_count()

update_login_count ( )

◆ update_module_button()

update_module_button ( )
Deprecated
since Moodle 3.2

◆ update_timezone_records()

update_timezone_records ( )
Deprecated
since Moodle 2.9

◆ update_user_login_times()

update_user_login_times ( )

Modify the user table by setting the currently logged in user's last login to now.

Return values
boolAlways returns true

◆ update_user_record()

update_user_record ( $username)

Will update a local user record from an external source (MNET users can not be updated using this method!).

Parameters
string$usernameuser's username to update the record
Return values
stdClassA complete user object

◆ update_user_record_by_id()

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!).

Parameters
int$iduser id
Return values
stdClassA complete user object

◆ upgrade_block_savepoint()

upgrade_block_savepoint ( $result,
$version,
$blockname,
$allowabort = true )

Blocks upgrade savepoint, marks end of blocks upgrade blocks It stores block version, resets upgrade timeout and abort upgrade if user cancels page loading.

Parameters
bool$resultfalse if upgrade step failed, true if completed
string | float$versionmain version
string$blocknamename of block
bool$allowabortallow user to abort script execution here

◆ upgrade_component_updated()

upgrade_component_updated ( string $component,
string $messageplug = '',
bool $coreinstall = false )

After upgrading a module, block, or generic plugin, various parts of the system need to be informed.

Parameters
string$componentFrankenstyle component or 'moodle' for core
string$messageplugSet to the name of a message plugin if this is one
bool$coreinstallSet to true if this is the core install

◆ upgrade_core()

upgrade_core ( $version,
$verbose )

Upgrade moodle core.

Parameters
float$versiontarget version
bool$verbose
Return values
void,maythrow exception

◆ upgrade_ensure_not_running()

upgrade_ensure_not_running ( $warningonly = false)

Makes sure that upgrade process is not running.

To be inserted in the core functions that can not be called by pluigns during upgrade. Core upgrade should not use any API functions at all. See

Exceptions
moodle_exceptionif executed from inside of upgrade script and $warningonly is false
Parameters
bool$warningonlyif true displays a warning instead of throwing an exception
Return values
booltrue if executed from outside of upgrade process, false if from inside upgrade process and function is used for warning only

◆ upgrade_finished()

object upgrade_finished ( $continueurl = null)

Indicates upgrade is finished.

This function may be called repeatedly.

@global object

◆ upgrade_install_plugins()

upgrade_install_plugins ( array $installable,
$confirmed,
$heading = '',
$continue = null,
$return = null )

Helper procedure/macro for installing remote plugins at admin/index.php.

Does not return, always redirects or exits.

Parameters
array$installablelist of core\update\remote_info
bool$confirmedfalse: display the validation screen, true: proceed installation
string$headingvalidation screen heading
moodle_url | string | null$continueURL to proceed with installation at the validation screen
moodle_url | string | null$returnURL to go back on cancelling at the validation screen

◆ upgrade_language_pack()

upgrade_language_pack ( $lang = null)

Try to upgrade the given language pack (or current language)

Parameters
string$langthe code of the language to update, defaults to the current language

◆ upgrade_log()

upgrade_log ( $type,
$plugin,
$info,
$details = null,
$backtrace = null )

Adds log entry into upgrade_log table.

Parameters
int$typeUPGRADE_LOG_NORMAL, UPGRADE_LOG_NOTICE or UPGRADE_LOG_ERROR
string$pluginfrankenstyle component name
string$infoshort description text of log entry
string$detailslong problem description
string$backtracestring used for errors only
Return values
void

◆ upgrade_main_savepoint()

upgrade_main_savepoint ( $result,
$version,
$allowabort = true )

Upgrade savepoint, marks end of each upgrade block.

It stores new main version, resets upgrade timeout and abort upgrade if user cancels page loading.

Please do not make large upgrade blocks with lots of operations, for example when adding tables keep only one table operation per block.

Parameters
bool$resultfalse if upgrade step failed, true if completed
stringor float $version main version
bool$allowabortallow user to abort script execution here
Return values
void

◆ upgrade_mod_savepoint()

upgrade_mod_savepoint ( $result,
$version,
$modname,
$allowabort = true )

Module upgrade savepoint, marks end of module upgrade blocks It stores module version, resets upgrade timeout and abort upgrade if user cancels page loading.

Parameters
bool$resultfalse if upgrade step failed, true if completed
string | float$versionmain version
string$modnamename of module
bool$allowabortallow user to abort script execution here

◆ upgrade_noncore()

upgrade_noncore ( $verbose)

Upgrade/install other parts of moodle.

Parameters
bool$verbose
Return values
void,maythrow exception

◆ upgrade_plugin_mnet_functions()

upgrade_plugin_mnet_functions ( $component)

upgrades the mnet rpc definitions for the given component.

this method doesn't return status, an exception will be thrown in the case of an error

Parameters
string$componentthe plugin to upgrade, eg auth_mnet

◆ upgrade_plugin_savepoint()

upgrade_plugin_savepoint ( $result,
$version,
$type,
$plugin,
$allowabort = true )

Plugins upgrade savepoint, marks end of plugin upgrade blocks It stores plugin version, resets upgrade timeout and abort upgrade if user cancels page loading.

Parameters
bool$resultfalse if upgrade step failed, true if completed
string | float$versionmain version
string$typeThe type of the plugin.
string$pluginThe name of the plugin.
bool$allowabortallow user to abort script execution here

◆ upgrade_plugins()

upgrade_plugins ( $type,
$startcallback,
$endcallback,
$verbose )

Upgrade plugins.

Parameters
string$typeThe type of plugins that should be updated (e.g. 'enrol', 'qtype') return void

◆ upgrade_plugins_blocks()

object upgrade_plugins_blocks ( $startcallback,
$endcallback,
$verbose )

This function finds all available blocks and install them into blocks table or do all the upgrade process if newer.

@global object

◆ upgrade_plugins_modules()

object upgrade_plugins_modules ( $startcallback,
$endcallback,
$verbose )

Find and check all modules and load them up or upgrade them if necessary.

@global object

◆ upgrade_set_timeout()

upgrade_set_timeout ( $max_execution_time = 300)

Sets maximum expected time needed for upgrade task.

Please always make sure that upgrade will not run longer!

The script may be automatically aborted if upgrade times out.

Parameters
int$max_execution_timein seconds (can not be less than 60 s)

◆ upgrade_stale_php_files_present()

upgrade_stale_php_files_present ( )

Detect if there are leftovers in PHP source files.

During main version upgrades administrators MUST move away old PHP source files and start from scratch (or better use git).

Return values
booltrue means borked upgrade, false means previous PHP files were properly removed

◆ upgrade_started()

object upgrade_started ( $preinstall = false)

Marks start of upgrade, blocks any other access to site.

The upgrade is finished at the end of script or after timeout.

@global object @global object

◆ user_accesstime_log()

stdClass user_accesstime_log ( $courseid = 0)

Store user last access times - called when use enters a course or site.

$USER @global stdClass $CFG @global moodle_database $DB @uses LASTACCESS_UPDATE_SECS @uses SITEID

Parameters
int$courseidempty courseid means site
Return values
void

◆ user_can_create_courses()

object user_can_create_courses ( )

@uses CONTEXT_COURSECAT

Return values
booleanWhether the user can create courses in any category in the system.

◆ user_get_participants()

user_get_participants ( )
Deprecated
since Moodle 3.9 MDL-68612 - See core_user\table\participants_search for an improved way to fetch participants.

◆ user_get_participants_sql()

user_get_participants_sql ( )
Deprecated
since Moodle 3.9 MDL-68612 - See core_user\table\participants_search for an improved way to fetch participants.

◆ user_get_total_participants()

user_get_total_participants ( )
Deprecated
since Moodle 3.9 MDL-68612 - See core_user\table\participants_search for an improved way to fetch participants.

◆ user_not_fully_set_up()

user_not_fully_set_up ( $user,
$strict = true )

Determines if a user has completed setting up their account.

The lax mode (with $strict = false) has been introduced for special cases only where we want to skip certain checks intentionally. This is valid in certain mnet or ajax scenarios when the user cannot / should not be redirected to edit their profile. In most cases, you should perform the strict check.

Parameters
stdClass$userA $USER object to test for the existence of a valid name and email
bool$strictBe more strict and assert id and custom profile fields set, too
Return values
bool

◆ user_preference_allow_ajax_update()

user_preference_allow_ajax_update ( $name,
$paramtype )

You need to call this function if you wish to use the set_user_preference method in javascript_static.php, to white-list the preference you want to update from JavaScript, and to specify the type of cleaning you expect to be done on values.

Parameters
string$namethe name of the user_perference we should allow to be updated by remote calls.
integer$paramtypeone of the PARAM_{TYPE} constants, user to clean submitted values before set_user_preference is called.
Return values
null
Deprecated
since Moodle 4.3

◆ userdate()

userdate ( $date,
$format = '',
$timezone = 99,
$fixday = true,
$fixhour = true )

Returns a formatted string that represents a date in user time.

Parameters
int$datethe timestamp in UTC, as obtained from the database.
string$formatstrftime format. You should probably get this using get_string('strftime...', 'langconfig');
int | float | string$timezoneby default, uses the user's time zone. if numeric and not 99 then daylight saving will not be added.
bool$fixdayIf true (default) then the leading zero from d is removed. If false then the leading zero is maintained.
bool$fixhourIf true (default) then the leading zero from I is removed.
Return values
stringthe formatted date/time.

◆ userdate_htmltime()

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.

Parameters
int$datethe timestamp in UTC, as obtained from the database.
string$formatstrftime format. You should probably get this using get_string('strftime...', 'langconfig');
int | float | string$timezoneby default, uses the user's time zone. if numeric and not 99 then daylight saving will not be added.
bool$fixdayIf true (default) then the leading zero from d is removed. If false then the leading zero is maintained.
bool$fixhourIf true (default) then the leading zero from I is removed.
Return values
stringthe formatted date/time.

◆ useredit_shared_definition_preferences()

useredit_shared_definition_preferences ( )
Deprecated
since Moodle 2.9 MDL-45774 - Please do not use this function any more.

◆ usergetdate()

usergetdate ( $time,
$timezone = 99 )

Given a $time timestamp in GMT (seconds since epoch), returns an array that represents the Gregorian date in user time.

Parameters
int$timeTimestamp in GMT
float | int | string$timezoneuser timezone
Return values
arrayAn array that represents the date in user time

◆ usergetmidnight()

usergetmidnight ( $date,
$timezone = 99 )

Given a time, return the GMT timestamp of the most recent midnight for the current user.

Parameters
int$dateTimestamp in GMT
float | int | string$timezoneuser timezone
Return values
intReturns a GMT timestamp

◆ username_load_fields_from_object()

username_load_fields_from_object ( $addtoobject,
$secondobject,
$prefix = null,
$additionalfields = null )

Reduces lines of duplicated code for getting user name fields.

See also user_picture::unalias()

Parameters
object$addtoobjectObject to add user name fields to.
object$secondobjectObject that contains user name field information.
string$prefixprefix to be added to all fields (including $additionalfields) e.g. authorfirstname.
array$additionalfieldsAdditional fields to be matched with data in the second object. The key can be set to the user table field name.
Return values
objectUser name fields.

◆ users_order_by_sql()

users_order_by_sql ( string $usertablealias = '',
string $search = null,
context $context = null,
array $customfieldmappings = [] )

This function generates the standard ORDER BY clause for use when generating lists of users.

If you don't have a reason to use a different order, then you should use this method to generate the order when displaying lists of users.

If the optional $search parameter is passed, then exact matches to the search will be sorted first. For example, suppose you have two users 'Al Zebra' and 'Alan Aardvark'. The default sort is Alan, then Al. If, however, you search for 'Al', then Al will be listed first. (With two users, this is not a big deal, but with thousands of users, it is essential.)

The list of fields scanned for exact matches are:

If named parameters are used (which is the default, and highly recommended), then the parameter names are like :usersortexactN, where N is an int.

The simplest possible example use is: list($sort, $params) = users_order_by_sql(); $sql = 'SELECT * FROM {users} ORDER BY ' . $sort;

A more complex example, showing that this sort can be combined with other sorts: list($sort, $sortparams) = users_order_by_sql('u'); $sql = "SELECT g.id AS groupid, gg.groupingid, u.id AS userid, u.firstname, u.lastname, u.idnumber, u.username FROM {groups} g LEFT JOIN {groupings_groups} gg ON g.id = gg.groupid LEFT JOIN {groups_members} gm ON g.id = gm.groupid LEFT JOIN {user} u ON gm.userid = u.id WHERE g.courseid = :courseid $groupwhere $groupingwhere ORDER BY g.name, $sort"; $params += $sortparams;

An example showing the use of $search: list($sort, $sortparams) = users_order_by_sql('u', $search, $this->get_context()); $order = ' ORDER BY ' . $sort; $params += $sortparams; $availableusers = $DB->get_records_sql($fields . $sql . $order, $params, $page*$perpage, $perpage);

Parameters
string$usertablealias(optional) any table prefix for the {users} table. E.g. 'u'.
string$search(optional) a current search string. If given, any exact matches to this string will be sorted first.
context | null$contextthe context we are in. Used by core_user\fields\get_identity_fields. Defaults to $PAGE->context.
array$customfieldmappingsassociative array of mappings for custom fields returned by core_user\fields\get_sql.
Return values
arraywith two elements: string SQL fragment to use in the ORDER BY clause. For example, "firstname, lastname". array of parameters used in the SQL fragment. If $search is not given, this is guaranteed to be an empty array.

◆ users_search_sql()

users_search_sql ( string $search,
string $u = 'u',
int $searchtype = USER_SEARCH_STARTS_WITH,
array $extrafields = [],
array $exclude = null,
array $includeonly = null )

Returns SQL used to search through user table to find users (in a query which may also join and apply other conditions).

You can combine this SQL with an existing query by adding 'AND $sql' to the WHERE clause of your query (where $sql is the first element in the array returned by this function), and merging in the $params array to the parameters of your query (where $params is the second element). Your query should use named parameters such as :param, rather than the question mark style.

There are examples of basic usage in the unit test for this function.

Parameters
string$searchthe text to search for (empty string = find all)
string$uthe table alias for the user table in the query being built. May be ''.
int$searchtypeIf 0(default): searches at start, 1: searches in the middle of names 2: search exact match.
array$extrafieldsArray of extra user fields to include in search, must be prefixed with table alias if they are not in the user table.
array$excludeArray of user ids to exclude (empty = don't exclude)
array$includeonlyIf specified, only returns users that have ids incldued in this array (empty = don't restrict)
Return values
arrayan array with two elements, a fragment of SQL to go in the where clause the query, and an associative array containing any required parameters (using named placeholders).

◆ usertime()

usertime ( $date,
$timezone = 99 )

Given a GMT timestamp (seconds since epoch), offsets it by the timezone.

eg 3pm in India is 3pm GMT - 7 * 3600 seconds

NOTE: this function does not include DST properly, you should use the PHP date stuff instead!

Parameters
int$dateTimestamp in GMT
float | int | string$timezoneuser timezone
Return values
int

◆ usertimezone()

usertimezone ( $timezone = 99)

Returns a string that prints the user's timezone.

Parameters
float | int | string$timezoneuser timezone
Return values
string

◆ valid_uploaded_file()

valid_uploaded_file ( $newfile)

Returns current name of file on disk if it exists.

Parameters
string$newfileFile to be verified
Return values
stringCurrent name of file on disk if true

◆ validate_email()

validate_email ( $address)

Validates an email to make sure it makes sense.

Parameters
string$addressThe email address to validate.
Return values
boolean

◆ validate_internal_user_password()

validate_internal_user_password ( stdClass $user,
# string $password[\SensitiveParameter] )

Compare password against hash stored in user object to determine if it is valid.

If necessary it also updates the stored hash to the current format.

Parameters
stdClass$user(Password property may be updated).
string$passwordPlain text password.
Return values
boolTrue if password is valid.

◆ validate_login_captcha()

validate_login_captcha ( string|bool $captcha)

Check the submitted captcha is valid or not.

Parameters
string | bool$captchaThe value submitted in the login form that we are validating. If false is passed for the captcha, this function will always return true.
Return values
booleanIf the submitted captcha is valid.

◆ validate_param()

validate_param ( $param,
$type,
$allownull = NULL_NOT_ALLOWED,
$debuginfo = '' )

Strict validation of parameter values, the values are only converted to requested PHP type.

Internally it is using clean_param, the values before and after cleaning must be equal - otherwise an invalid_parameter_exception is thrown. Objects and classes are not accepted.

Parameters
mixed$param
string$typePARAM_ constant
bool$allownullare nulls valid value?
string$debuginfooptional debug information
Return values
mixedthe $param value converted to PHP type
Exceptions
invalid_parameter_exceptionif $param is not of given type

◆ validate_user_key()

validate_user_key ( $keyvalue,
$script,
$instance )

Validates a user key, checking if the key exists, is not expired and the remote ip is correct.

Parameters
string$keyvaluethe key value
string$scriptunique script identifier
int$instanceinstance id
Return values
stdClassthe key entry in the user_private_key table
Since
Moodle 3.2
Exceptions
moodle_exception

◆ want_read_slave()

want_read_slave ( )

Returns whether we want to connect to slave database for read queries.

Return values
boolWant read only connection

◆ wikify_links()

wikify_links ( $string)

This expression turns links into something nice in a text format.

(Russell Jungwirth)

Parameters
string$string
Return values
string

◆ xmldb_debug()

xmldb_debug ( $message,
$object )

This function is the official hook inside XMLDB stuff to delegate its debug to one external function.

Any script can avoid calls to this function by defining XMLDB_SKIP_DEBUG_HOOK before using XMLDB classes. Obviously, also, if this function doesn't exist, it isn't invoked ;-)

@uses DEBUG_DEVELOPER

Parameters
string$messagestring contains the error message
object$objectobject XMLDB object that fired the debug

◆ xmlize()

xmlize ( $data,
$whitespace = 1,
$encoding = 'UTF-8',
$reporterrors = false )

XML parsing function calles into class.

Note: Used by xml element handler as callback.

Parameters
string$datathe XML source to parse.
int$whitespaceIf set to 1 allows the parser to skip "space" characters in xml document. Default is 1
string$encodingSpecify an OUTPUT encoding. If not specified, it defaults to UTF-8.
bool$reporterrorsif set to true, then a xml_format_exception exception will be thrown if the XML is not well-formed. Otherwise errors are ignored.
Return values
arrayrepresentation of the parsed XML.

◆ zip_files()

zip_files ( )

Variable Documentation

◆ $capabilities

$capabilities
Initial value:
= array(
'moodle/backup:backupcourse',
'moodle/category:manage',
'moodle/course:create',
'moodle/site:approvecourse',
'moodle/restore:restorecourse'
)

◆ $definitions

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

◆ $fullmatch

bool filterobject::$fullmatch

whether to match complete words.

If true, 'T' won't be matched in 'Tim'.

◆ $handlers

$handlers
Initial value:
= array(
)

◆ $plugins [1/2]

foreach($plugins as $plugin) if( $hassiteconfig) if($hassiteconfig) if( $hassiteconfig &&core_communication\api::is_available()) if($hassiteconfig) if ( $hassiteconfig $plugins) = core_plugin_manager::instance()->get_plugins_of_type('tool')

Add all admin tools.

Add all local plugins - must be always last!

◆ $plugins [2/2]

$plugins
Initial value:
= array(
'jquery' => array('files' => array('jquery-3.7.1.min.js')),
'ui' => array('files' => array('ui-1.13.2/jquery-ui.min.js')),
'ui-css' => array('files' => array('ui-1.13.2/theme/smoothness/jquery-ui.min.css')),
)

◆ $replacementphrase

null string filterobject::$replacementphrase

replacement text to go inside begin and end.

If not set, the body of the replacement will be the original phrase.

◆ $stringfilters

moodle_text_filter [][] filter_manager::$stringfilters = array()
protected

This list of active filters, by context, for filtering strings.

An array contextid => ordered array of filter name => filter objects.

◆ $tasks

$tasks
Initial value:
= array(
array(
'classname' => 'editor_atto\task\autosave_cleanup_task',
'blocking' => 0,
'minute' => 'R',
'hour' => 'R',
'day' => '*',
'dayofweek' => 'R',
'month' => '*'
)
)

◆ $textfilters

moodle_text_filter [][] filter_manager::$textfilters = array()
protected

This list of active filters, by context, for filtering content.

An array contextid => ordered array of filter name => filter objects.

◆ BEHAT_EXITCODE_CONFIG

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

◆ danger

alert danger
Initial value:
{
color: #6e211e

◆ defined

defined('HUB_STATSPUBLICKEY')||define('HUB_STATSPUBLICKEY' ( 'HUB_MOODLEORGHUBURL' )

URL of the Moodle sites registration portal.

URL of the statistic server public key.

◆ else [1/7]

if (isset( $mnet_peer->id) &&$mnet_peer->id > 0) else
Initial value:
{
$tabs[] = new tabobject('mnetdetails', '#', $strmnetedithost, $strmnetedithost, false)
Stores one tab.
Definition outputcomponents.php:3984

◆ else [2/7]

if (isset( $_REQUEST[ 'lang'])) else
Initial value:
{
$lang = 'en'

◆ else [3/7]

if (isset( $_REQUEST[ 'admin'])) else
Initial value:
{
$admin = 'admin'

◆ else [4/7]

if(!function_exists('iconv')) if (PHP_INT_SIZE > 4) else
Initial value:
{
$minrequiredmemory = '40M'

◆ else [5/7]

if (!empty( $_POST)) else
Initial value:
{
$config->stage = INSTALL_WELCOME
const INSTALL_WELCOME
INSTALL_WELCOME = 0.
Definition installlib.php:30

◆ else [6/7]

if (defined( 'COMPONENT_CLASSLOADER')) else
Initial value:
{
spl_autoload_register('core_component::classloader')

◆ else [7/7]

if ( $distro) else
Initial value:
{
install_print_header($config, get_string('language'),
get_string('chooselanguagehead', 'install'),
get_string('chooselanguagesub', 'install'))
object install_print_header($config, $stagename, $heading, $stagetext, $stageclass="alert-info")
Prints installation page header, we can not use weblib yet in installer.
Definition installlib.php:330

◆ ENROL_EXT_REMOVED_SUSPEND

const ENROL_EXT_REMOVED_SUSPEND 2

When user disappears from external source, user enrolment is suspended, roles are kept as is.

In some cases user needs a role with some capability to be visible in UI - suc has in gradebook, assignments, etc.

◆ ENROL_EXT_REMOVED_SUSPENDNOROLES

const ENROL_EXT_REMOVED_SUSPENDNOROLES 3

When user disappears from external source, the enrolment is suspended and roles assigned by enrol instance are removed.

Please note that user may "disappear" from gradebook and other areas.

◆ ENROL_INSTANCE_DISABLED

const ENROL_INSTANCE_DISABLED 1

Course enrol instance disabled, user may enter course if other enrol instance enabled.

(used in enrol->status)

◆ ENROL_INSTANCE_ENABLED

const ENROL_INSTANCE_ENABLED 0

Course enrol instance enabled.

(used in enrol->status)

◆ ENROL_REQUIRE_LOGIN_CACHE_PERIOD

const ENROL_REQUIRE_LOGIN_CACHE_PERIOD 1800
Deprecated
  • enrol caching was reworked, use ENROL_MAX_TIMESTAMP instead

◆ ENROL_RESTORE_TYPE

const ENROL_RESTORE_TYPE 'enrolrestore'
Deprecated
since 2.4 not used any more, migrate plugin to new restore methods

◆ ENV_SELECT_NEWER

const ENV_SELECT_NEWER 0

Define algorithm used to select the xml file.

To select the newer file available to perform checks

◆ EXTERNAL_TOKEN_EMBEDDED

const EXTERNAL_TOKEN_EMBEDDED 1

Security token used for allowing access of embedded applications, the code is executed in the active user session.

Token is invalidated after user logs out. Scripts are executed serially - normal session locking is used.

◆ EXTERNAL_TOKEN_PERMANENT

const EXTERNAL_TOKEN_PERMANENT 0

Security token used for allowing access from external application such as web services.

Scripts do not use any session, performance is relatively low because we need to load access info in each request. Scripts are executed in parallel.

◆ FEATURE_GROUPMEMBERSONLY

const FEATURE_GROUPMEMBERSONLY 'groupmembersonly'

True if module supports groupmembersonly (which no longer exists)

Deprecated
Since Moodle 2.8

◆ FORMAT_WIKI

const FORMAT_WIKI '3'

Wiki-formatted text.

Deprecated: left here just to note that '3' is not used (at the moment) and to catch any latent wiki-like text (which generates an error)

Deprecated
since 2005!

◆ h1

h1
Initial value:
{
font-size: 2.34rem

◆ LIST_NONE

const LIST_NONE 1

#-

#+ list defines

◆ logging_trait

trait core::task\logging_trait
Initial value:
{
protected progress_trace $trace = null
Progress trace class.
Definition weblib.php:3515

This trait includes functions to assist with logging in tasks.

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

◆ MEMORY_EXTRA

const MEMORY_EXTRA -3

Large memory limit for given platform - used in cron, upgrade, and other places that need a lot of memory.

Can be overridden with $CFG->extramemorylimit setting.

◆ moodle_read_slave_trait

trait moodle_read_slave_trait
Initial value:
{
protected resource $dbhwrite

Trait to wrap connect() method of database driver classes that gives ability to use read only slave instances for SELECT queries.

For the databases that support replication and read only connections to the slave. If the slave connection is configured there will be two database handles created, one for the master and another one for the slave. If there's no slave specified everything uses master handle.

Classes that use this trait need to rename existing connect() method to raw_connect(). In addition, they need to provide get_db_handle() and set_db_handle() methods, due to dbhandle attributes not being named consistently across the database driver classes.

Read only slave connection is configured in the $CFG->dboptions['readonly'] array.

  • It supports multiple 'instance' entries, in case one is not accessible, but only one (first connectable) instance is used.
  • 'latency' option: master -> slave sync latency in seconds (will probably be a fraction of a second). A table being written to is deemed fully synced after that period and suitable for slave read. Defaults to 1 sec.
  • 'exclude_tables' option: a list of tables that never go to the slave for querying. The feature is meant to be used in emergency only, so the readonly feature can still be used in case there is a rogue query that does not go through the standard dml interface or some other unaccounted situation. It should not be used under normal circumstances, and its use indicates a problem in the system that needs addressig.

Choice of the database handle is based on following:

  • SQL_QUERY_INSERT, UPDATE and STRUCTURE record table from the query in the $written array and microtime() the event. For those queries master write handle is used.
  • SQL_QUERY_AUX queries will always use the master write handle because they are used for transaction start/end, locking etc. In that respect, query_start() and query_end() must not be used during the connection phase.
  • SQL_QUERY_AUX_READONLY queries will use the master write handle if in a transaction.
  • SELECT queries will use the master write handle if: – any of the tables involved is a temp table – any of the tables involved is listed in the 'exclude_tables' option – any of the tables involved is in the $written array:
    • current microtime() is compared to the write microrime, and if more than latency time has passed the slave handle is used
    • otherwise (not enough time passed) we choose the master write handle If none of the above conditions are met the slave instance is used.

A 'latency' example:

  • we have set $CFG->dboptions['readonly']['latency'] to 0.2.
  • a SQL_QUERY_UPDATE to table tbl_x happens, and it is recorded in the $written array
  • 0.15 seconds later SQL_QUERY_SELECT with tbl_x is requested - the master connection is used
  • 0.10 seconds later (0.25 seconds after SQL_QUERY_UPDATE) another SQL_QUERY_SELECT with tbl_x is requested - this time more than 0.2 secs has gone and master -> slave sync is assumed, so the slave connection is used again

◆ NO_ERROR

const NO_ERROR 0

Add required files.

Include the necessary Define a bunch of XML processing errors XML Processing Error

◆ PAGE_COURSE_VIEW

const PAGE_COURSE_VIEW 'course-view'

PAGE_COURSE_VIEW is a definition of a page type.

For more information on the page class see moodle/lib/pagelib.php.

◆ PARAM_ACTION

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.

Deprecated
since 2.0

◆ PARAM_AREA

const PARAM_AREA 'area'

PARAM_AREA is a name of area used when addressing files, comments, ratings, etc.

It is usually used together with context id and component. Only lowercase ascii letters, numbers and underscores are allowed, it has to start with a letter.

◆ PARAM_CAPABILITY

const PARAM_CAPABILITY 'capability'

PARAM_CAPABILITY - A capability name, like 'moodle/role:manage'.

Actually checked against the list of capabilities in the database.

◆ PARAM_CLEAN

const PARAM_CLEAN 'clean'

PARAM_CLEAN - obsoleted, please use a more specific type of parameter.

It was one of the first types, that is why it is abused so much ;-)

Deprecated
since 2.0

◆ PARAM_CLEANHTML

const PARAM_CLEANHTML 'cleanhtml'

PARAM_CLEANHTML - cleans submitted HTML code.

Note that you almost never want to use this. The normal mode of operation is to use PARAM_RAW when receiving the input (required/optional_param or formslib) and then sanitise the HTML using format_text on output. This is for the rare cases when you want to sanitise the HTML on input. This cleaning may also fix xhtml strictness.

◆ PARAM_COMPONENT

const PARAM_COMPONENT 'component'

PARAM_COMPONENT is used for full component names (aka frankenstyle) such as 'mod_forum', 'core_rating', 'auth_ldap'.

Short legacy subsystem names and module names are accepted too ex: 'forum', 'rating', 'user'. Only lowercase ascii letters, numbers and underscores are allowed, it has to start with a letter. NOTE: numbers and underscores are strongly discouraged in plugin names!

◆ PARAM_FLOAT

const PARAM_FLOAT 'float'

PARAM_FLOAT - a real/floating point number.

Note that you should not use PARAM_FLOAT for numbers typed in by the user. It does not work for languages that use , as a decimal separator. Use PARAM_LOCALISEDFLOAT instead.

◆ PARAM_FORMAT

const PARAM_FORMAT 'alphanumext'

PARAM_FORMAT - deprecated alias for PARAM_ALPHANUMEXT, use for names of plugins, formats, etc.

NOTE: originally alias for PARAM_APLHA

Deprecated
since 2.0

◆ PARAM_INTEGER

const PARAM_INTEGER 'int'

PARAM_INTEGER - deprecated alias for PARAM_INT.

Deprecated
since 2.0

◆ PARAM_LOCALISEDFLOAT

const PARAM_LOCALISEDFLOAT 'localisedfloat'

PARAM_LOCALISEDFLOAT - a localised real/floating point number.

This is preferred over PARAM_FLOAT for numbers typed in by the user. Cleans localised numbers to computer readable numbers; false for invalid numbers.

◆ PARAM_LOCALURL

const PARAM_LOCALURL 'localurl'

PARAM_LOCALURL - expected properly formatted URL as well as one that refers to the local server itself.

(NOT orthogonal to the others! Implies PARAM_URL!)

◆ PARAM_MULTILANG

const PARAM_MULTILANG 'text'

PARAM_MULTILANG - deprecated alias of PARAM_TEXT.

Deprecated
since 2.0

◆ PARAM_NOTAGS

const PARAM_NOTAGS 'notags'

PARAM_NOTAGS - all html tags are stripped from the text.

Do not abuse this type.

◆ PARAM_NUMBER

const PARAM_NUMBER 'float'

PARAM_NUMBER - deprecated alias of PARAM_FLOAT.

Deprecated
since 2.0

◆ PARAM_PLUGIN

const PARAM_PLUGIN 'plugin'

PARAM_PLUGIN is used for plugin names such as 'forum', 'glossary', 'ldap', 'paypal', 'completionstatus'.

Only lowercase ascii letters, numbers and underscores are allowed, it has to start with a letter. NOTE: numbers and underscores are strongly discouraged in plugin names! Underscores are forbidden in module names.

◆ PARAM_SAFEPATH

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.

This is NOT intended to be used for absolute paths or any user uploaded files.

◆ PARAM_SEQUENCE

const PARAM_SEQUENCE 'sequence'

PARAM_SEQUENCE - expects a sequence of numbers like 8 to 1,5,6,4,6,8,9.

Numbers and comma only.

◆ PARAM_TEXT

const PARAM_TEXT 'text'

PARAM_TEXT - general plain text compatible with multilang filter, no other html tags.

Please note '<', or '>' are allowed here.

◆ PARAM_TIMEZONE

const PARAM_TIMEZONE 'timezone'

PARAM_TIMEZONE - expected timezone.

Timezone can be int +-(0-13) or float +-(0.5-12.5) or string separated by '/' and can have '-' &/ '_' (eg. America/North_Dakota/New_Salem America/Port-au-Prince)

◆ PARAM_URL

const PARAM_URL 'url'

PARAM_URL - expected properly formatted URL.

Please note that domain part is required, http://localhost/ is not accepted but http://localhost.localdomain/ is ok.

◆ PARAM_USERNAME

const PARAM_USERNAME 'username'

PARAM_USERNAME - Clean username to only contains allowed characters.

This is to be used ONLY when manually creating user accounts, do NOT use when syncing with external systems!!

◆ PHPUNIT_EXITCODE_PHPUNITMISSING

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

◆ stoppable_trait

trait core::hook\stoppable_trait
Initial value:
{
private bool $propagationstopped = false

◆ TABLE_P_TOP

const TABLE_P_TOP 1

#-

#+ Constants that indicate whether the paging bar for the table appears above or below the table.

◆ TABLE_SHOW_ALL_PAGE_SIZE

const TABLE_SHOW_ALL_PAGE_SIZE 5000

#-

Constant that defines the 'Show all' page size.

◆ TAG_MAX_LENGTH

const TAG_MAX_LENGTH 50

To prevent problems with multibytes strings,Flag updating in nav not working on the review page.

this should not exceed the length of "varchar(255) / 3 (bytes / utf-8 character) = 85". TODO: this is not correct, varchar(255) are 255 unicode chars ;-)

Todo
define(TAG_MAX_LENGTH) this is not correct, varchar(255) are 255 unicode chars ;-)

◆ TESTING_EXITCODE_COMPOSER

const TESTING_EXITCODE_COMPOSER 255

Composer error exit status.

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

◆ TEXTFILTER_EXCL_SEPARATOR

const TEXTFILTER_EXCL_SEPARATOR chr(0x1F) . '%' . chr(0x1F)

Define one exclusive separator that we'll use in the temp saved tags keys.

It must be something rare enough to avoid having matches with filterobjects. MDL-18165

◆ TOKEN_USER

const TOKEN_USER "0"

Constants for the various types of tokens.

See also
lexer.php

◆ USER_SEARCH_STARTS_WITH

const USER_SEARCH_STARTS_WITH(!defined( 'LASTACCESS_UPDATE_SECS')) ( ! defined 'LASTACCESS_UPDATE_SECS') 0

Number of seconds to wait before updating lastaccess information in DB.

We allow overwrites from config.php, useful to ensure coherence in performance tests results.

Note: For web service requests in the external_tokens field, we use a different constant webservice\TOKEN_LASTACCESS_UPDATE_SECS. The constant value when we use the search option.