本文整理汇总了PHP中file_get_typegroup函数的典型用法代码示例。如果您正苦于以下问题:PHP file_get_typegroup函数的具体用法?PHP file_get_typegroup怎么用?PHP file_get_typegroup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了file_get_typegroup函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: test_supported_extensions
/**
* Test method get_supported_extensions()
*/
public function test_supported_extensions()
{
$nativeextensions = file_get_typegroup('extension', 'html_video');
// Make sure that the list of extensions from the setting is exactly the same as html_video group.
$player = new media_html5video_plugin();
$this->assertEmpty(array_diff($player->get_supported_extensions(), $nativeextensions));
$this->assertEmpty(array_diff($nativeextensions, $player->get_supported_extensions()));
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:11,代码来源:player_test.php
示例2: test_supported_extensions
/**
* Test method get_supported_extensions()
*/
public function test_supported_extensions()
{
global $CFG;
require_once $CFG->libdir . '/filelib.php';
$nativeextensions = file_get_typegroup('extension', 'html_audio');
// Make sure that the list of extensions from the setting is exactly the same as html_audio group.
$player = new media_html5audio_plugin();
$this->assertEmpty(array_diff($player->get_supported_extensions(), $nativeextensions));
$this->assertEmpty(array_diff($nativeextensions, $player->get_supported_extensions()));
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:13,代码来源:player_test.php
示例3: test_supported_extensions
/**
* Test method get_supported_extensions()
*/
public function test_supported_extensions()
{
$nativeextensions = array_merge(file_get_typegroup('extension', 'html_video'), file_get_typegroup('extension', 'html_audio'));
set_config('useflash', 0, 'media_videojs');
// Make sure that the list of extensions from the setting is filtered to HTML5 natively supported extensions.
$player = new media_videojs_plugin();
$this->assertNotEmpty($player->get_supported_extensions());
$this->assertTrue(in_array('.mp3', $player->get_supported_extensions()));
$this->assertEmpty(array_diff($player->get_supported_extensions(), $nativeextensions));
// Try to set the audioextensions to something non-native (.ra) and make sure it is not returned as supported.
set_config('audioextensions', '.mp3,.wav,.ra', 'media_videojs');
$player = new media_videojs_plugin();
$this->assertNotEmpty($player->get_supported_extensions());
$this->assertTrue(in_array('.mp3', $player->get_supported_extensions()));
$this->assertFalse(in_array('.ra', $player->get_supported_extensions()));
$this->assertEmpty(array_diff($player->get_supported_extensions(), $nativeextensions));
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:20,代码来源:player_test.php
示例4: get_meta
/**
* Provide repository instance information for Ajax
*
* @return stdClass
*/
public final function get_meta()
{
global $CFG, $OUTPUT;
$meta = new stdClass();
$meta->id = $this->id;
$meta->name = format_string($this->get_name());
$meta->type = $this->get_typename();
$meta->icon = $OUTPUT->pix_url('icon', 'repository_' . $meta->type)->out(false);
$meta->supported_types = file_get_typegroup('extension', $this->supported_filetypes());
$meta->return_types = $this->supported_returntypes();
$meta->sortorder = $this->options['sortorder'];
return $meta;
}
开发者ID:isuruAb,项目名称:moodle,代码行数:18,代码来源:lib.php
示例5: file_mimetype_in_typegroup
/**
* Checks if mimetype $mimetype belongs to one of the groups $groups
*
* @see get_mimetypes_array()
* @param string $mimetype
* @param string|array $groups one group or array of groups to check
* @return bool
*/
function file_mimetype_in_typegroup($mimetype, $groups)
{
return !empty($mimetype) && in_array($mimetype, file_get_typegroup('type', $groups));
}
开发者ID:IFPBMoodle,项目名称:moodle,代码行数:12,代码来源:filelib.php
示例6: course_overviewfiles_options
/**
* Returns options to use in course overviewfiles filemanager
*
* @param null|stdClass|course_in_list|int $course either object that has 'id' property or just the course id;
* may be empty if course does not exist yet (course create form)
* @return array|null array of options such as maxfiles, maxbytes, accepted_types, etc.
* or null if overviewfiles are disabled
*/
function course_overviewfiles_options($course)
{
global $CFG;
if (empty($CFG->courseoverviewfileslimit)) {
return null;
}
$accepted_types = preg_split('/\\s*,\\s*/', trim($CFG->courseoverviewfilesext), -1, PREG_SPLIT_NO_EMPTY);
if (in_array('*', $accepted_types) || empty($accepted_types)) {
$accepted_types = '*';
} else {
// Since config for $CFG->courseoverviewfilesext is a text box, human factor must be considered.
// Make sure extensions are prefixed with dot unless they are valid typegroups
foreach ($accepted_types as $i => $type) {
if (substr($type, 0, 1) !== '.') {
require_once $CFG->libdir . '/filelib.php';
if (!count(file_get_typegroup('extension', $type))) {
// It does not start with dot and is not a valid typegroup, this is most likely extension.
$accepted_types[$i] = '.' . $type;
$corrected = true;
}
}
}
if (!empty($corrected)) {
set_config('courseoverviewfilesext', join(',', $accepted_types));
}
}
$options = array('maxfiles' => $CFG->courseoverviewfileslimit, 'maxbytes' => $CFG->maxbytes, 'subdirs' => 0, 'accepted_types' => $accepted_types);
if (!empty($course->id)) {
$options['context'] = context_course::instance($course->id);
} else {
if (is_int($course) && $course > 0) {
$options['context'] = context_course::instance($course);
}
}
return $options;
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:44,代码来源:lib.php
示例7: get_supported_extensions
public function get_supported_extensions()
{
global $CFG;
require_once $CFG->libdir . '/filelib.php';
return file_get_typegroup('extension', 'html_audio');
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:6,代码来源:plugin.php
示例8: label_dndupload_register
/**
* Register the ability to handle drag and drop file uploads
* @return array containing details of the files / types the mod can handle
*/
function label_dndupload_register()
{
$strdnd = get_string('dnduploadlabel', 'mod_label');
if (get_config('label', 'dndmedia')) {
$mediaextensions = file_get_typegroup('extension', 'web_image');
$files = array();
foreach ($mediaextensions as $extn) {
$extn = trim($extn, '.');
$files[] = array('extension' => $extn, 'message' => $strdnd);
}
$ret = array('files' => $files);
} else {
$ret = array();
}
$strdndtext = get_string('dnduploadlabeltext', 'mod_label');
return array_merge($ret, array('types' => array(array('identifier' => 'text/html', 'message' => $strdndtext, 'noname' => true), array('identifier' => 'text', 'message' => $strdndtext, 'noname' => true))));
}
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:21,代码来源:lib.php
示例9: definition
protected function definition()
{
global $CFG;
$mform = $this->_form;
$version = $this->_customdata['version'];
$format = $this->_customdata['format'];
if (empty($this->_customdata['contextid'])) {
// Hack alert
// This is being done ONLY to aid those who may have created there own wiki pages. It should be removed sometime
// after the release of 2.3 (not creating an issue because this whole thing should be reviewed)
debugging('You must always provide mod_wiki_edit_form with a contextid in its custom data', DEBUG_DEVELOPER);
global $PAGE;
$contextid = $PAGE->context->id;
} else {
$contextid = $this->_customdata['contextid'];
}
if (isset($this->_customdata['pagetitle'])) {
// Page title must be formatted properly here as this is output and not an element.
$pagetitle = get_string('editingpage', 'wiki', format_string($this->_customdata['pagetitle'], true, array('context' => get_context_instance_by_id($contextid, MUST_EXIST))));
} else {
$pagetitle = get_string('editing', 'wiki');
}
//editor
$mform->addElement('header', 'general', $pagetitle);
$fieldname = get_string('format' . $format, 'wiki');
if ($format != 'html') {
// Use wiki editor
$extensions = file_get_typegroup('extension', 'web_image');
$fs = get_file_storage();
$tree = $fs->get_area_tree($contextid, 'mod_wiki', $this->_customdata['filearea'], $this->_customdata['fileitemid']);
$files = array();
foreach ($tree['files'] as $file) {
$filename = $file->get_filename();
foreach ($extensions as $ext) {
if (preg_match('#' . $ext . '$#i', $filename)) {
$files[] = $filename;
}
}
}
$mform->addElement('wikieditor', 'newcontent', $fieldname, array('cols' => 100, 'rows' => 20, 'wiki_format' => $format, 'files' => $files));
$mform->addHelpButton('newcontent', 'format' . $format, 'wiki');
$mform->setType('newcontent', PARAM_RAW);
// processed by trust text or cleaned before the display
} else {
$mform->addElement('editor', 'newcontent_editor', $fieldname, null, page_wiki_edit::$attachmentoptions);
$mform->addHelpButton('newcontent_editor', 'formathtml', 'wiki');
$mform->setType('newcontent_editor', PARAM_RAW);
// processed by trust text or cleaned before the display
}
//hiddens
if ($version >= 0) {
$mform->addElement('hidden', 'version', $version);
$mform->setType('version', PARAM_FLOAT);
}
$mform->addElement('hidden', 'contentformat', $format);
$mform->setType('contentformat', PARAM_ALPHANUMEXT);
if (!empty($CFG->usetags)) {
$tags = !isset($this->_customdata['tags']) ? "" : $this->_customdata['tags'];
$mform->addElement('header', 'tagshdr', get_string('tags', 'tag'));
$mform->addElement('tags', 'tags', get_string('tags'));
$mform->setDefault('tags', $tags);
$mform->setType('tags', PARAM_TEXT);
}
$buttongroup = array();
$buttongroup[] = $mform->createElement('submit', 'editoption', get_string('save', 'wiki'), array('id' => 'save'));
$buttongroup[] = $mform->createElement('submit', 'editoption', get_string('preview'), array('id' => 'preview'));
$buttongroup[] = $mform->createElement('submit', 'editoption', get_string('cancel'), array('id' => 'cancel'));
$mform->addGroup($buttongroup, 'buttonar', '', array(' '), false);
$mform->closeHeaderBefore('buttonar');
}
开发者ID:nmicha,项目名称:moodle,代码行数:70,代码来源:edit_form.php
示例10: mimetypes
/**
* Return presentation documents mimetypes
*
* @return array presentation document mimetypes
*/
public static function mimetypes()
{
return file_get_typegroup('type', 'presentation');
}
开发者ID:evltuma,项目名称:moodle,代码行数:9,代码来源:formats.php
示例11: get_supported_extensions
public function get_supported_extensions()
{
global $CFG;
require_once $CFG->libdir . '/filelib.php';
if ($this->extensions === null) {
$filetypes = preg_split('/\\s*,\\s*/', strtolower(trim(get_config('media_videojs', 'videoextensions') . ',' . get_config('media_videojs', 'audioextensions'))));
$this->extensions = file_get_typegroup('extension', $filetypes);
if ($this->extensions && !get_config('media_videojs', 'useflash')) {
// If Flash is disabled only return extensions natively supported by browsers.
$nativeextensions = array_merge(file_get_typegroup('extension', 'html_video'), file_get_typegroup('extension', 'html_audio'));
$this->extensions = array_intersect($this->extensions, $nativeextensions);
}
}
return $this->extensions;
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:15,代码来源:plugin.php
示例12: label_dndupload_register
/**
* Register the ability to handle drag and drop file uploads
* @return array containing details of the files / types the mod can handle
*/
function label_dndupload_register() {
if (get_config('label', 'dndmedia')) {
$mediaextensions = file_get_typegroup('extension', 'web_image');
$strdnd = get_string('dnduploadlabel', 'mod_label');
$files = array();
foreach ($mediaextensions as $extn) {
$extn = trim($extn, '.');
$files[] = array('extension' => $extn, 'message' => $strdnd);
}
return array('files' => $files);
} else {
return array();
}
}
开发者ID:Burick,项目名称:moodle,代码行数:18,代码来源:lib.php
注:本文中的file_get_typegroup函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论