本文整理汇总了PHP中get_list_of_plugins函数的典型用法代码示例。如果您正苦于以下问题:PHP get_list_of_plugins函数的具体用法?PHP get_list_of_plugins怎么用?PHP get_list_of_plugins使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_list_of_plugins函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: definition
function definition()
{
global $USER, $CFG, $COURSE;
$mform =& $this->_form;
$this->set_upload_manager(new upload_manager('imagefile', false, false, null, false, 0, true, true, false));
//Accessibility: "Required" is bad legend text.
$strgeneral = get_string('general');
$strrequired = get_string('required');
/// Add some extra hidden fields
$mform->addElement('hidden', 'id');
$mform->addElement('hidden', 'course', $COURSE->id);
/// Print the required moodle fields first
$mform->addElement('header', 'moodle', $strgeneral);
$mform->addElement('text', 'username', get_string('username'), 'size="20"');
$mform->addRule('username', $strrequired, 'required', null, 'client');
$mform->setType('username', PARAM_RAW);
$modules = get_list_of_plugins('auth');
$auth_options = array();
foreach ($modules as $module) {
$auth_options[$module] = get_string("auth_{$module}" . "title", "auth");
}
$mform->addElement('select', 'auth', get_string('chooseauthmethod', 'auth'), $auth_options);
$mform->setHelpButton('auth', array('authchange', get_string('chooseauthmethod', 'auth')));
$mform->setAdvanced('auth');
$mform->addElement('passwordunmask', 'newpassword', get_string('newpassword'), 'size="20"');
$mform->setHelpButton('newpassword', array('newpassword', get_string('leavetokeep')));
$mform->setType('newpassword', PARAM_RAW);
$mform->addElement('advcheckbox', 'preference_auth_forcepasswordchange', get_string('forcepasswordchange'));
$mform->setHelpButton('preference_auth_forcepasswordchange', array('forcepasswordchange', get_string('forcepasswordchange')));
/// shared fields
useredit_shared_definition($mform);
/// Next the customisable profile fields
profile_definition($mform);
$this->add_action_buttons(false, get_string('updatemyprofile'));
}
示例2: available_converters
/**
* Returns the list of all available converters and loads their classes
*
* Converter must be installed as a directory in backup/converter/ and its
* method is_available() must return true to get to the list.
*
* @see base_converter::is_available()
* @return array of strings
*/
public static function available_converters() {
global $CFG;
$converters = array();
$plugins = get_list_of_plugins('backup/converter');
foreach ($plugins as $name) {
$classfile = "$CFG->dirroot/backup/converter/$name/lib.php";
$classname = "{$name}_converter";
if (!file_exists($classfile)) {
throw new convert_helper_exception('converter_classfile_not_found', $classfile);
}
require_once($classfile);
if (!class_exists($classname)) {
throw new convert_helper_exception('converter_classname_not_found', $classname);
}
if (call_user_func($classname .'::is_available')) {
$converters[] = $name;
}
}
return $converters;
}
示例3: process_glossary
protected function process_glossary($data)
{
global $DB;
$data = (object) $data;
$oldid = $data->id;
$data->course = $this->get_courseid();
$data->assesstimestart = $this->apply_date_offset($data->assesstimestart);
$data->assesstimefinish = $this->apply_date_offset($data->assesstimefinish);
if ($data->scale < 0) {
// scale found, get mapping
$data->scale = -$this->get_mappingid('scale', abs($data->scale));
}
$formats = get_list_of_plugins('mod/glossary/formats');
// Check format
if (!in_array($data->displayformat, $formats)) {
$data->displayformat = 'dictionary';
}
if (!empty($data->mainglossary) and $data->mainglossary == 1 and $DB->record_exists('glossary', array('mainglossary' => 1, 'course' => $this->get_courseid()))) {
// Only allow one main glossary in the course
$data->mainglossary = 0;
}
// insert the glossary record
$newitemid = $DB->insert_record('glossary', $data);
$this->apply_activity_instance($newitemid);
}
示例4: install_get_list_of_languages
/**
* This function returns a list of languages and their full names. The
* list of available languages is fetched from install/lang/xx/installer.php
* and it's used exclusively by the installation process
* @return array An associative array with contents in the form of LanguageCode => LanguageName
*/
function install_get_list_of_languages()
{
global $CFG;
$languages = array();
/// Get raw list of lang directories
$langdirs = get_list_of_plugins('install/lang');
asort($langdirs);
/// Get some info from each lang
foreach ($langdirs as $lang) {
if ($lang == 'en') {
continue;
}
if (file_exists($CFG->dirroot . '/install/lang/' . $lang . '/installer.php')) {
$string = array();
include $CFG->dirroot . '/install/lang/' . $lang . '/installer.php';
if (substr($lang, -5) === '_utf8') {
//Remove the _utf8 suffix from the lang to show
$shortlang = substr($lang, 0, -5);
} else {
$shortlang = $lang;
}
if (!empty($string['thislanguage'])) {
$languages[$lang] = $string['thislanguage'] . ' (' . $shortlang . ')';
}
}
}
/// Return array
return $languages;
}
示例5: referentiel_get_print_formats
/**
* Get list of available import or export prints
* @param string $type 'import' if import list, otherwise export list assumed
* @return array sorted list of import/export prints available
**/
function referentiel_get_print_formats($type, $classprefix = "")
{
global $CFG;
$fileprints = get_list_of_plugins("mod/referentiel/print");
$fileprintnames = array();
require_once "{$CFG->dirroot}/mod/referentiel/print.php";
foreach ($fileprints as $key => $fileprint) {
$print_file = $CFG->dirroot . "/mod/referentiel/print/{$fileprint}/print.php";
if (file_exists($print_file)) {
require_once $print_file;
} else {
continue;
}
if ($classprefix) {
$classname = $classprefix . "_" . $fileprint;
} else {
$classname = "pprint_{$fileprint}";
}
$print_class = new $classname();
$provided = $print_class->provide_print();
if ($provided) {
$printname = get_string($fileprint, "referentiel");
if ($printname == "[[{$fileprint}]]") {
$printname = $fileprint;
// Just use the raw folder name
}
$fileprintnames[$fileprint] = $printname;
}
}
natcasesort($fileprintnames);
return $fileprintnames;
}
示例6: test_plugins
public function test_plugins()
{
$plugins = get_list_of_plugins('repository');
foreach ($plugins as $plugin) {
// Instantiate a fake plugin instance
$plugin_class = "partialmock_{$plugin}";
$plugin = new $plugin_class($this);
// add common plugin tests here
}
}
示例7: lightboxgallery_edit_types
function lightboxgallery_edit_types($showall = false)
{
global $CFG;
$result = array();
$disabledplugins = explode(',', get_config('lightboxgallery', 'disabledplugins'));
$edittypes = get_list_of_plugins('mod/lightboxgallery/edit');
foreach ($edittypes as $edittype) {
if ($showall || !in_array($edittype, $disabledplugins)) {
$result[$edittype] = get_string('edit_' . $edittype, 'lightboxgallery');
}
}
return $result;
}
示例8: get_all
/**
* Returns a new object of each available type.
* @return array Array of forum_feature objects
*/
public static function get_all()
{
global $CFG;
// Get directory listing (excluding simpletest, CVS, etc)
$list = get_list_of_plugins('feature', '', $CFG->dirroot . '/mod/forumng');
// Create array and put one of each object in it
$results = array();
foreach ($list as $name) {
$results[] = self::get_new($name);
}
// Sort features into order and return
usort($results, array('forum_feature', 'compare'));
return $results;
}
示例9: definition
function definition()
{
global $CFG;
$mform =& $this->_form;
$syscontext = get_context_instance(CONTEXT_SYSTEM);
$actions = array(0 => get_string('choose') . '...');
$plugins = get_list_of_plugins($CFG->admin . '/user/actions', 'CVS');
foreach ($plugins as $dir) {
if (check_action_capabilities($dir)) {
$actions[$dir] = get_string('pluginname', 'bulkuseractions_' . $dir, NULL, $CFG->dirroot . '/admin/user/actions/' . $dir . '/lang/');
}
}
$objs = array();
$objs[] =& $mform->createElement('select', 'action', null, $actions);
$objs[] =& $mform->createElement('submit', 'doaction', get_string('go'));
$mform->addElement('group', 'actionsgrp', get_string('withselectedusers'), $objs, ' ', false);
}
示例10: definition
/**
* items in the form
*/
public function definition()
{
global $CURMAN, $CFG;
parent::definition();
$mform =& $this->_form;
$mform->addElement('hidden', 'id');
$mform->addElement('text', 'name', get_string('cluster_name', 'block_curr_admin') . ':');
$mform->addRule('name', get_string('required'), 'required', NULL, 'client');
$mform->setHelpButton('name', array('clusterform/name', get_string('cluster_name', 'block_curr_admin'), 'block_curr_admin'));
$mform->addElement('textarea', 'display', get_string('cluster_description', 'block_curr_admin') . ':', array('cols' => 40, 'rows' => 2));
$mform->setHelpButton('display', array('clusterform/display', get_string('cluster_description', 'block_curr_admin'), 'block_curr_admin'));
$current_cluster_id = isset($this->_customdata['obj']->id) ? $this->_customdata['obj']->id : '';
//obtain the non-child clusters that we could become the child of, with availability
//determined based on the edit capability
$contexts = clusterpage::get_contexts('block/curr_admin:cluster:edit');
$non_child_clusters = cluster_get_non_child_clusters($current_cluster_id, $contexts);
//parent dropdown
$mform->addElement('select', 'parent', get_string('cluster_parent', 'block_curr_admin') . ':', $non_child_clusters);
$mform->setHelpButton('parent', array('clusterform/parent', get_string('cluster_parent', 'block_curr_admin'), 'block_curr_admin'));
// allow plugins to add their own fields
$plugins = get_list_of_plugins('curriculum/cluster');
$mform->addElement('header', 'userassociationfieldset', get_string('userassociation', 'block_curr_admin'));
foreach ($plugins as $plugin) {
require_once CURMAN_DIRLOCATION . '/cluster/' . $plugin . '/lib.php';
call_user_func('cluster_' . $plugin . '_edit_form', $this);
}
// custom fields
$fields = field::get_for_context_level('cluster');
$fields = $fields ? $fields : array();
$lastcat = null;
$context = isset($this->_customdata['obj']) && isset($this->_customdata['obj']->id) ? get_context_instance(context_level_base::get_custom_context_level('cluster', 'block_curr_admin'), $this->_customdata['obj']->id) : get_context_instance(CONTEXT_SYSTEM);
require_once CURMAN_DIRLOCATION . '/plugins/manual/custom_fields.php';
foreach ($fields as $rec) {
$field = new field($rec);
if (!isset($field->owners['manual'])) {
continue;
}
if ($lastcat != $rec->categoryid) {
$lastcat = $rec->categoryid;
$mform->addElement('header', "category_{$lastcat}", htmlspecialchars($rec->categoryname));
}
manual_field_add_form_element($this, $context, $field);
}
$this->add_action_buttons();
}
示例11: AMB_update_modules
/**
* Check here for new modules to add to the database. This happens every time the block is upgraded.
* If you have added your own extension, increment the version number in block_ajax_marking.php
* to trigger this process. Also called after install.
*/
function AMB_update_modules()
{
global $CFG;
$modules = array();
echo "<br /><br />Scanning site for modules which have an AJAX Marking Block plugin... <br />";
// make a list of directories to check for module grading files
$installed_modules = get_list_of_plugins('mod');
$directories = array($CFG->dirroot . '/blocks/ajax_marking');
foreach ($installed_modules as $module) {
$directories[] = $CFG->dirroot . '/mod/' . $module;
}
// get module ids so that we can store these later
$comma_modules = $installed_modules;
foreach ($comma_modules as $key => $comma_module) {
$comma_modules[$key] = "'" . $comma_module . "'";
}
$comma_modules = implode(', ', $comma_modules);
$sql = "\n SELECT name, id FROM {$CFG->prefix}modules\n WHERE name IN (" . $comma_modules . ")\n ";
$module_ids = get_records_sql($sql);
// Get files in each directory and check if they fit the naming convention
foreach ($directories as $directory) {
$files = scandir($directory);
// check to see if they end in _grading.php
foreach ($files as $file) {
// this should lead to 'modulename' and 'grading.php'
$pieces = explode('_', $file);
if (isset($pieces[1]) && $pieces[1] == 'grading.php') {
if (in_array($pieces[0], $installed_modules)) {
$modname = $pieces[0];
// add the modulename part of the filename to the array
$modules[$modname] = new stdClass();
$modules[$modname]->name = $modname;
// do not store $CFG->dirroot so that any changes to it will not break the block
$modules[$modname]->dir = str_replace($CFG->dirroot, '', $directory);
//$modules[$modname]->dir = $directory;
$modules[$modname]->id = $module_ids[$modname]->id;
echo "Registered {$modname} module <br />";
}
}
}
}
echo '<br />For instructions on how to write extensions for this block, see the documentation on Moodle Docs<br /><br />';
set_config('modules', serialize($modules), 'block_ajax_marking');
}
示例12: available_converters
/**
* Returns the list of all available converters and loads their classes
*
* Converter must be installed as a directory in backup/converter/ and its
* method is_available() must return true to get to the list.
*
* @see base_converter::is_available()
* @return array of strings
*/
public static function available_converters($restore = true)
{
global $CFG;
$converters = array();
// Only apply for backup converters if the (experimental) setting enables it.
// This will be out once we get proper support of backup converters. MDL-29956
if (!$restore && empty($CFG->enablebackupconverters)) {
return $converters;
}
$plugins = get_list_of_plugins('backup/converter');
foreach ($plugins as $name) {
$filename = $restore ? 'lib.php' : 'backuplib.php';
$classuf = $restore ? '_converter' : '_export_converter';
$classfile = "{$CFG->dirroot}/backup/converter/{$name}/{$filename}";
$classname = "{$name}{$classuf}";
$zip_contents = "{$name}_zip_contents";
$store_backup_file = "{$name}_store_backup_file";
$convert = "{$name}_backup_convert";
if (!file_exists($classfile)) {
throw new convert_helper_exception('converter_classfile_not_found', $classfile);
}
require_once $classfile;
if (!class_exists($classname)) {
throw new convert_helper_exception('converter_classname_not_found', $classname);
}
if (call_user_func($classname . '::is_available')) {
if (!$restore) {
if (!class_exists($zip_contents)) {
throw new convert_helper_exception('converter_classname_not_found', $zip_contents);
}
if (!class_exists($store_backup_file)) {
throw new convert_helper_exception('converter_classname_not_found', $store_backup_file);
}
if (!class_exists($convert)) {
throw new convert_helper_exception('converter_classname_not_found', $convert);
}
}
$converters[] = $name;
}
}
return $converters;
}
示例13: cm_add_config_defaults
function cm_add_config_defaults()
{
global $CURMAN, $CFG;
$defaults = array('userdefinedtrack' => 0, 'time_format_12h' => 0, 'auto_assign_user_idnumber' => 1, 'restrict_to_elis_enrolment_plugin' => 0, 'cluster_groups' => 0, 'site_course_cluster_groups' => 0, 'cluster_groupings' => 0, 'default_instructor_role' => 0, 'catalog_collapse_count' => 4, 'disablecoursecatalog' => 0, 'disablecertificates' => 1, 'notify_classenrol_user' => 0, 'notify_classenrol_role' => 0, 'notify_classenrol_supervisor' => 0, 'notify_classenrol_message' => get_string('notifyclassenrolmessagedef', 'block_curr_admin'), 'notify_classcompleted_user' => 0, 'notify_classcompleted_role' => 0, 'notify_classcompleted_supervisor' => 0, 'notify_classcompleted_message' => get_string('notifyclasscompletedmessagedef', 'block_curr_admin'), 'notify_classnotstarted_user' => 0, 'notify_classnotstarted_role' => 0, 'notify_classnotstarted_supervisor' => 0, 'notify_classnotstarted_message' => get_string('notifyclassnotstartedmessagedef', 'block_curr_admin'), 'notify_classnotstarted_days' => 10, 'notify_classnotcompleted_user' => 0, 'notify_classnotcompleted_role' => 0, 'notify_classnotcompleted_supervisor' => 0, 'notify_classnotcompleted_message' => get_string('notifyclassnotcompletedmessagedef', 'block_curr_admin'), 'notify_classnotcompleted_days' => 10, 'notify_curriculumnotcompleted_user' => 0, 'notify_curriculumnotcompleted_role' => 0, 'notify_curriculumnotcompleted_supervisor' => 0, 'notify_curriculumnotcompleted_message' => get_string('notifycurriculumnotcompletedmessagedef', 'block_curr_admin'), 'notify_classnotstarted_days' => 10, 'notify_trackenrol_user' => 0, 'notify_trackenrol_role' => 0, 'notify_trackenrol_supervisor' => 0, 'notify_ttrackenrol_message' => get_string('notifytrackenrolmessagedef', 'block_curr_admin'), 'notify_courserecurrence_user' => 0, 'notify_courserecurrence_role' => 0, 'notify_courserecurrence_supervisor' => 0, 'notify_courserecurrence_message' => get_string('notifycourserecurrencemessagedef', 'block_curr_admin'), 'notify_courserecurrence_days' => 10, 'notify_curriculumrecurrence_user' => 0, 'notify_curriculumrecurrence_role' => 0, 'notify_curriculumrecurrence_supervisor' => 0, 'notify_curriculumrecurrence_message' => get_string('notifycurriculumrecurrencemessagedef', 'block_curr_admin'), 'notify_curriculumrecurrence_days' => 10, 'num_block_icons' => 5, 'display_clusters_at_top_level' => 1, 'display_curricula_at_top_level' => 0, 'default_cluster_role_id' => 0, 'default_curriculum_role_id' => 0, 'default_course_role_id' => 0, 'default_class_role_id' => 0, 'default_track_role_id' => 0, 'autocreated_unknown_is_yes' => 1, 'legacy_show_inactive_users' => 0);
// include defaults from plugins
$plugins = get_list_of_plugins('curriculum/plugins');
foreach ($plugins as $plugin) {
if (is_readable(CURMAN_DIRLOCATION . '/plugins/' . $plugin . '/config.php')) {
include_once CURMAN_DIRLOCATION . '/plugins/' . $plugin . '/config.php';
if (function_exists("{$plugin}_get_config_defaults")) {
$defaults += call_user_func("{$plugin}_get_config_defaults");
}
}
}
foreach ($defaults as $key => $value) {
if (!isset($CURMAN->config->{$key})) {
$CURMAN->config->{$key} = $value;
}
}
}
示例14: available_converters
/**
* Returns the list of all available converters and loads their classes
*
* Converter must be installed as a directory in backup/converter/ and its
* method is_available() must return true to get to the list.
*
* @see base_converter::is_available()
* @return array of strings
*/
public static function available_converters($restore = true)
{
global $CFG;
$converters = array();
$plugins = get_list_of_plugins('backup/converter');
foreach ($plugins as $name) {
$filename = $restore ? 'lib.php' : 'backuplib.php';
$classuf = $restore ? '_converter' : '_export_converter';
$classfile = "{$CFG->dirroot}/backup/converter/{$name}/{$filename}";
$classname = "{$name}{$classuf}";
$zip_contents = "{$name}_zip_contents";
$store_backup_file = "{$name}_store_backup_file";
$convert = "{$name}_backup_convert";
if (!file_exists($classfile)) {
throw new convert_helper_exception('converter_classfile_not_found', $classfile);
}
require_once $classfile;
if (!class_exists($classname)) {
throw new convert_helper_exception('converter_classname_not_found', $classname);
}
if (call_user_func($classname . '::is_available')) {
if (!$restore) {
if (!class_exists($zip_contents)) {
throw new convert_helper_exception('converter_classname_not_found', $zip_contents);
}
if (!class_exists($store_backup_file)) {
throw new convert_helper_exception('converter_classname_not_found', $store_backup_file);
}
if (!class_exists($convert)) {
throw new convert_helper_exception('converter_classname_not_found', $convert);
}
}
$converters[] = $name;
}
}
return $converters;
}
示例15: referentiel_get_import_export_formats
/**
* Get list of available import or export formats
* @param string $type 'import' if import list, otherwise export list assumed
* @return array sorted list of import/export formats available
**/
function referentiel_get_import_export_formats($type, $classprefix = "")
{
global $CFG;
$fileformats = get_list_of_plugins("blocks/referentiel/format");
$fileformatnames = array();
require_once "{$CFG->dirroot}/blocks/referentiel/format.php";
foreach ($fileformats as $key => $fileformat) {
$format_file = $CFG->dirroot . "/blocks/referentiel/format/{$fileformat}/format.php";
if (file_exists($format_file)) {
require_once $format_file;
} else {
continue;
}
if ($classprefix) {
$classname = $classprefix . "_" . $fileformat;
} else {
$classname = "rformat_{$fileformat}";
}
$format_class = new $classname();
if ($type == 'import') {
$provided = $format_class->provide_import();
} else {
$provided = $format_class->provide_export();
}
if ($provided) {
$formatname = get_string($fileformat, "referentiel");
if ($formatname == "[[{$fileformat}]]") {
$formatname = $fileformat;
// Just use the raw folder name
}
$fileformatnames[$fileformat] = $formatname;
}
}
natcasesort($fileformatnames);
return $fileformatnames;
}