Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443915
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3443915
Commits
8d153441
Commit
8d153441
authored
13 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1089040
by Remon, mlncn: Added Cache rdf_get_namespaces() using drupal_static().
parent
27d3f295
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/rdf/rdf.module
+20
-17
20 additions, 17 deletions
core/modules/rdf/rdf.module
with
20 additions
and
17 deletions
core/modules/rdf/rdf.module
+
20
−
17
View file @
8d153441
...
@@ -95,23 +95,26 @@ function rdf_rdf_namespaces() {
...
@@ -95,23 +95,26 @@ function rdf_rdf_namespaces() {
* hook_rdf_namespaces().
* hook_rdf_namespaces().
*/
*/
function
rdf_get_namespaces
()
{
function
rdf_get_namespaces
()
{
$rdf_namespaces
=
module_invoke_all
(
'rdf_namespaces'
);
$rdf_namespaces
=
&
drupal_static
(
__FUNCTION__
);
// module_invoke_all() uses array_merge_recursive() which might return nested
if
(
!
isset
(
$rdf_namespaces
))
{
// arrays if several modules redefine the same prefix multiple times. We need
$rdf_namespaces
=
module_invoke_all
(
'rdf_namespaces'
);
// to ensure the array of namespaces is flat and only contains strings as
// module_invoke_all() uses array_merge_recursive() which might return
// URIs.
// nested arrays if several modules redefine the same prefix multiple
foreach
(
$rdf_namespaces
as
$prefix
=>
$uri
)
{
// times. We need to ensure the array of namespaces is flat and only
if
(
is_array
(
$uri
))
{
// contains strings as URIs.
if
(
count
(
array_unique
(
$uri
))
==
1
)
{
foreach
(
$rdf_namespaces
as
$prefix
=>
$uri
)
{
// All namespaces declared for this prefix are the same, merge them all
if
(
is_array
(
$uri
))
{
// into a single namespace.
if
(
count
(
array_unique
(
$uri
))
==
1
)
{
$rdf_namespaces
[
$prefix
]
=
$uri
[
0
];
// All namespaces declared for this prefix are the same, merge them
}
// all into a single namespace.
else
{
$rdf_namespaces
[
$prefix
]
=
$uri
[
0
];
// There are conflicting namespaces for this prefix, do not include
}
// duplicates in order to avoid asserting any inaccurate RDF
else
{
// statements.
// There are conflicting namespaces for this prefix, do not include
unset
(
$rdf_namespaces
[
$prefix
]);
// duplicates in order to avoid asserting any inaccurate RDF
// statements.
unset
(
$rdf_namespaces
[
$prefix
]);
}
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment