Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
229
Merge Requests
229
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
8d153441
Commit
8d153441
authored
Mar 10, 2012
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1089040
by Remon, mlncn: Added Cache rdf_get_namespaces() using drupal_static().
parent
27d3f295
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
+20
-17
core/modules/rdf/rdf.module
core/modules/rdf/rdf.module
+20
-17
No files found.
core/modules/rdf/rdf.module
View file @
8d153441
...
...
@@ -95,23 +95,26 @@ function rdf_rdf_namespaces() {
* hook_rdf_namespaces().
*/
function
rdf_get_namespaces
()
{
$rdf_namespaces
=
module_invoke_all
(
'rdf_namespaces'
);
// module_invoke_all() uses array_merge_recursive() which might return nested
// arrays if several modules redefine the same prefix multiple times. We need
// to ensure the array of namespaces is flat and only contains strings as
// URIs.
foreach
(
$rdf_namespaces
as
$prefix
=>
$uri
)
{
if
(
is_array
(
$uri
))
{
if
(
count
(
array_unique
(
$uri
))
==
1
)
{
// All namespaces declared for this prefix are the same, merge them all
// into a single namespace.
$rdf_namespaces
[
$prefix
]
=
$uri
[
0
];
}
else
{
// There are conflicting namespaces for this prefix, do not include
// duplicates in order to avoid asserting any inaccurate RDF
// statements.
unset
(
$rdf_namespaces
[
$prefix
]);
$rdf_namespaces
=
&
drupal_static
(
__FUNCTION__
);
if
(
!
isset
(
$rdf_namespaces
))
{
$rdf_namespaces
=
module_invoke_all
(
'rdf_namespaces'
);
// module_invoke_all() uses array_merge_recursive() which might return
// nested arrays if several modules redefine the same prefix multiple
// times. We need to ensure the array of namespaces is flat and only
// contains strings as URIs.
foreach
(
$rdf_namespaces
as
$prefix
=>
$uri
)
{
if
(
is_array
(
$uri
))
{
if
(
count
(
array_unique
(
$uri
))
==
1
)
{
// All namespaces declared for this prefix are the same, merge them
// all into a single namespace.
$rdf_namespaces
[
$prefix
]
=
$uri
[
0
];
}
else
{
// There are conflicting namespaces for this prefix, do not include
// duplicates in order to avoid asserting any inaccurate RDF
// statements.
unset
(
$rdf_namespaces
[
$prefix
]);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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