Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
8dc3a580
Commit
8dc3a580
authored
Sep 29, 2009
by
Richard Mansfield
Browse files
Merge commit 'origin/master' into unzip
parents
cd4e3e19
fc4cbf62
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/file/lib.php
View file @
8dc3a580
...
...
@@ -216,6 +216,10 @@ class PluginArtefactFile extends PluginArtefact {
'profileicon'
=>
array
(
'image'
),
);
}
public
static
function
get_attachment_types
()
{
return
array
(
'file'
,
'image'
);
}
}
abstract
class
ArtefactTypeFileBase
extends
ArtefactType
{
...
...
htdocs/artefact/lib.php
View file @
8dc3a580
...
...
@@ -1056,6 +1056,20 @@ function rebuild_artefact_parent_cache_complete() {
db_commit
();
}
function
artefact_get_attachment_types
()
{
static
$artefacttypes
=
null
;
if
(
is_null
(
$artefacttypes
))
{
$artefacttypes
=
array
();
foreach
(
require_artefact_plugins
()
as
$plugin
)
{
$classname
=
generate_class_name
(
'artefact'
,
$plugin
->
name
);
if
(
!
is_callable
(
$classname
.
'::get_attachment_types'
))
{
continue
;
}
$artefacttypes
=
array_merge
(
$artefacttypes
,
call_static_method
(
$classname
,
'get_attachment_types'
));
}
}
return
$artefacttypes
;
}
function
artefact_get_parents_for_cache
(
$artefactid
,
&
$parentids
=
false
)
{
$current
=
$artefactid
;
...
...
@@ -1067,7 +1081,7 @@ function artefact_get_parents_for_cache($artefactid, &$parentids=false) {
break
;
}
// get any blog posts it may be attached to
if
((
$parent
->
artefacttype
==
'file'
||
$parent
->
artefacttype
==
'image'
)
if
(
in_array
(
$parent
->
artefacttype
,
artefact_get_attachment_types
()
)
&&
$associated
=
ArtefactType
::
attached_id_list
(
$parent
->
id
))
{
foreach
(
$associated
as
$a
)
{
$parentids
[
$a
]
=
1
;
...
...
@@ -1238,13 +1252,23 @@ function artefact_type_installed($type) {
return
isset
(
$types
[
$type
]);
}
function
require_artefact_plugins
()
{
static
$plugins
=
null
;
if
(
is_null
(
$plugins
))
{
$plugins
=
plugins_installed
(
'artefact'
);
foreach
(
$plugins
as
$plugin
)
{
safe_require
(
'artefact'
,
$plugin
->
name
);
}
}
return
$plugins
;
}
function
artefact_get_types_from_filter
(
$filter
)
{
static
$contenttype_artefacttype
=
null
;
if
(
is_null
(
$contenttype_artefacttype
))
{
$contenttype_artefacttype
=
array
();
foreach
(
plugins_installed
(
'artefact'
)
as
$plugin
)
{
safe_require
(
'artefact'
,
$plugin
->
name
);
foreach
(
require_artefact_plugins
()
as
$plugin
)
{
$classname
=
generate_class_name
(
'artefact'
,
$plugin
->
name
);
if
(
!
is_callable
(
$classname
.
'::get_artefact_type_content_types'
))
{
continue
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment