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
294
Merge Requests
294
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
9c29ac79
Commit
9c29ac79
authored
Dec 15, 2011
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Patch
#1059884
by bfroehle, sun, casey: Drop function_exists() for 'callback' functions.
parent
f2431f3d
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
31 additions
and
47 deletions
+31
-47
core/includes/common.inc
core/includes/common.inc
+10
-18
core/includes/form.inc
core/includes/form.inc
+2
-4
core/includes/menu.inc
core/includes/menu.inc
+3
-3
core/includes/token.inc
core/includes/token.inc
+1
-1
core/modules/book/book.module
core/modules/book/book.module
+1
-1
core/modules/entity/entity.module
core/modules/entity/entity.module
+2
-2
core/modules/field/field.module
core/modules/field/field.module
+1
-3
core/modules/field/modules/list/list.module
core/modules/field/modules/list/list.module
+1
-1
core/modules/field_ui/field_ui.module
core/modules/field_ui/field_ui.module
+1
-1
core/modules/filter/filter.admin.inc
core/modules/filter/filter.admin.inc
+1
-1
core/modules/filter/filter.module
core/modules/filter/filter.module
+3
-3
core/modules/image/image.admin.inc
core/modules/image/image.admin.inc
+2
-3
core/modules/image/image.module
core/modules/image/image.module
+1
-4
core/modules/rdf/rdf.module
core/modules/rdf/rdf.module
+1
-1
core/modules/search/search.pages.inc
core/modules/search/search.pages.inc
+1
-1
No files found.
core/includes/common.inc
View file @
9c29ac79
...
...
@@ -4489,10 +4489,8 @@ function drupal_process_attached($elements, $group = JS_DEFAULT, $dependency_che
// Libraries, JavaScript and CSS have been added already, as they require
// special handling.
foreach
(
$elements
[
'#attached'
]
as
$callback
=>
$options
)
{
if
(
function_exists
(
$callback
))
{
foreach
(
$elements
[
'#attached'
][
$callback
]
as
$args
)
{
call_user_func_array
(
$callback
,
$args
);
}
foreach
(
$elements
[
'#attached'
][
$callback
]
as
$args
)
{
call_user_func_array
(
$callback
,
$args
);
}
}
...
...
@@ -5784,9 +5782,7 @@ function drupal_render(&$elements) {
// element is rendered into the final text.
if
(
isset
(
$elements
[
'#pre_render'
]))
{
foreach
(
$elements
[
'#pre_render'
]
as
$function
)
{
if
(
function_exists
(
$function
))
{
$elements
=
$function
(
$elements
);
}
$elements
=
$function
(
$elements
);
}
}
...
...
@@ -5830,9 +5826,7 @@ function drupal_render(&$elements) {
// which allows the output'ed text to be filtered.
if
(
isset
(
$elements
[
'#post_render'
]))
{
foreach
(
$elements
[
'#post_render'
]
as
$function
)
{
if
(
function_exists
(
$function
))
{
$elements
[
'#children'
]
=
$function
(
$elements
[
'#children'
],
$elements
);
}
$elements
[
'#children'
]
=
$function
(
$elements
[
'#children'
],
$elements
);
}
}
...
...
@@ -7668,16 +7662,14 @@ function drupal_get_filetransfer_info() {
$info
=
array
();
foreach
(
module_implements
(
'filetransfer_info'
)
as
$module
)
{
$function
=
$module
.
'_filetransfer_info'
;
if
(
function_exists
(
$function
))
{
$result
=
$function
();
if
(
isset
(
$result
)
&&
is_array
(
$result
))
{
foreach
(
$result
as
&
$values
)
{
if
(
empty
(
$values
[
'file path'
]))
{
$values
[
'file path'
]
=
drupal_get_path
(
'module'
,
$module
);
}
$result
=
$function
();
if
(
isset
(
$result
)
&&
is_array
(
$result
))
{
foreach
(
$result
as
&
$values
)
{
if
(
empty
(
$values
[
'file path'
]))
{
$values
[
'file path'
]
=
drupal_get_path
(
'module'
,
$module
);
}
$info
=
array_merge_recursive
(
$info
,
$result
);
}
$info
=
array_merge_recursive
(
$info
,
$result
);
}
}
drupal_alter
(
'filetransfer_info'
,
$info
);
...
...
core/includes/form.inc
View file @
9c29ac79
...
...
@@ -784,7 +784,7 @@ function drupal_retrieve_form($form_id, &$form_state) {
// the actual form builder function ($callback) expects. This allows for
// pre-populating a form with common elements for certain forms, such as
// back/next/save buttons in multi-step form wizards. See drupal_build_form().
if
(
isset
(
$form_state
[
'wrapper_callback'
])
&&
function_exists
(
$form_state
[
'wrapper_callback'
])
)
{
if
(
isset
(
$form_state
[
'wrapper_callback'
]))
{
$form
=
call_user_func_array
(
$form_state
[
'wrapper_callback'
],
$args
);
// Put the prepopulated $form into $args.
$args
[
0
]
=
$form
;
...
...
@@ -4391,9 +4391,7 @@ function batch_process($redirect = NULL, $url = 'batch', $redirect_callback = 'd
// Redirect for processing.
$function
=
$batch
[
'redirect_callback'
];
if
(
function_exists
(
$function
))
{
$function
(
$batch
[
'url'
],
array
(
'query'
=>
array
(
'op'
=>
'start'
,
'id'
=>
$batch
[
'id'
])));
}
$function
(
$batch
[
'url'
],
array
(
'query'
=>
array
(
'op'
=>
'start'
,
'id'
=>
$batch
[
'id'
])));
}
else
{
// Non-progressive execution: bypass the whole progressbar workflow
...
...
core/includes/menu.inc
View file @
9c29ac79
...
...
@@ -632,7 +632,7 @@ function _menu_check_access(&$item, $map) {
if
(
$callback
==
'user_access'
)
{
$item
[
'access'
]
=
(
count
(
$arguments
)
==
1
)
?
user_access
(
$arguments
[
0
])
:
user_access
(
$arguments
[
0
],
$arguments
[
1
]);
}
else
if
(
function_exists
(
$callback
))
{
else
{
$item
[
'access'
]
=
call_user_func_array
(
$callback
,
$arguments
);
}
}
...
...
@@ -692,7 +692,7 @@ function _menu_item_localize(&$item, $map, $link_translate = FALSE) {
$item
[
'title'
]
=
t
(
$item
[
'title'
],
menu_unserialize
(
$item
[
'title_arguments'
],
$map
));
}
}
elseif
(
$callback
&&
function_exists
(
$callback
)
)
{
elseif
(
$callback
)
{
if
(
empty
(
$item
[
'title_arguments'
]))
{
$item
[
'title'
]
=
$callback
(
$item
[
'title'
]);
}
...
...
@@ -1750,7 +1750,7 @@ function menu_get_custom_theme($initialize = FALSE) {
// If this returns a valid theme, it will override any theme that was set
// by a hook_custom_theme() implementation above.
$router_item
=
menu_get_item
();
if
(
!
empty
(
$router_item
[
'access'
])
&&
!
empty
(
$router_item
[
'theme_callback'
])
&&
function_exists
(
$router_item
[
'theme_callback'
])
)
{
if
(
!
empty
(
$router_item
[
'access'
])
&&
!
empty
(
$router_item
[
'theme_callback'
]))
{
$theme_name
=
call_user_func_array
(
$router_item
[
'theme_callback'
],
$router_item
[
'theme_arguments'
]);
if
(
drupal_theme_access
(
$theme_name
))
{
$custom_theme
=
$theme_name
;
...
...
core/includes/token.inc
View file @
9c29ac79
...
...
@@ -86,7 +86,7 @@ function token_replace($text, array $data = array(), array $options = array()) {
}
// Optionally alter the list of replacement values.
if
(
!
empty
(
$options
[
'callback'
])
&&
function_exists
(
$options
[
'callback'
])
)
{
if
(
!
empty
(
$options
[
'callback'
]))
{
$function
=
$options
[
'callback'
];
$function
(
$replacements
,
$data
,
$options
);
}
...
...
core/modules/book/book.module
View file @
9c29ac79
...
...
@@ -1244,7 +1244,7 @@ function book_export_traverse($tree, $visit_func) {
$children
=
book_export_traverse
(
$data
[
'below'
],
$visit_func
);
}
if
(
function_exists
(
$visit_func
))
{
if
(
!
empty
(
$visit_func
))
{
$output
.
=
call_user_func
(
$visit_func
,
$node
,
$children
);
}
else
{
...
...
core/modules/entity/entity.module
View file @
9c29ac79
...
...
@@ -373,7 +373,7 @@ function entity_uri($entity_type, $entity) {
}
// Invoke the callback to get the URI. If there is no callback, return NULL.
if
(
isset
(
$uri_callback
)
&&
function_exists
(
$uri_callback
)
)
{
if
(
isset
(
$uri_callback
))
{
$uri
=
$uri_callback
(
$entity
);
// Pass the entity data to url() so that alter functions do not need to
// lookup this entity again.
...
...
@@ -403,7 +403,7 @@ function entity_uri($entity_type, $entity) {
function
entity_label
(
$entity_type
,
$entity
)
{
$label
=
FALSE
;
$info
=
entity_get_info
(
$entity_type
);
if
(
isset
(
$info
[
'label callback'
])
&&
function_exists
(
$info
[
'label callback'
])
)
{
if
(
isset
(
$info
[
'label callback'
]))
{
$label
=
$info
[
'label callback'
](
$entity_type
,
$entity
);
}
elseif
(
!
empty
(
$info
[
'entity keys'
][
'label'
])
&&
isset
(
$entity
->
{
$info
[
'entity keys'
][
'label'
]}))
{
...
...
core/modules/field/field.module
View file @
9c29ac79
...
...
@@ -494,9 +494,7 @@ function field_get_default_value($entity_type, $entity, $field, $instance, $lang
$items
=
array
();
if
(
!
empty
(
$instance
[
'default_value_function'
]))
{
$function
=
$instance
[
'default_value_function'
];
if
(
function_exists
(
$function
))
{
$items
=
$function
(
$entity_type
,
$entity
,
$field
,
$instance
,
$langcode
);
}
$items
=
$function
(
$entity_type
,
$entity
,
$field
,
$instance
,
$langcode
);
}
elseif
(
!
empty
(
$instance
[
'default_value'
]))
{
$items
=
$instance
[
'default_value'
];
...
...
core/modules/field/modules/list/list.module
View file @
9c29ac79
...
...
@@ -231,7 +231,7 @@ function list_allowed_values($field) {
if
(
!
isset
(
$allowed_values
[
$field
[
'id'
]]))
{
$function
=
$field
[
'settings'
][
'allowed_values_function'
];
if
(
!
empty
(
$function
)
&&
function_exists
(
$function
)
)
{
if
(
!
empty
(
$function
))
{
$values
=
$function
(
$field
);
}
else
{
...
...
core/modules/field_ui/field_ui.module
View file @
9c29ac79
...
...
@@ -281,7 +281,7 @@ function _field_ui_view_mode_menu_access($entity_type, $bundle, $view_mode, $acc
if
(
$access_callback
==
'user_access'
)
{
return
(
count
(
$args
)
==
1
)
?
user_access
(
$args
[
0
])
:
user_access
(
$args
[
0
],
$args
[
1
]);
}
else
if
(
function_exists
(
$access_callback
))
{
else
{
return
call_user_func_array
(
$access_callback
,
$args
);
}
}
...
...
core/modules/filter/filter.admin.inc
View file @
9c29ac79
...
...
@@ -230,7 +230,7 @@ function filter_admin_format_form($form, &$form_state, $format) {
);
foreach
(
$filter_info
as
$name
=>
$filter
)
{
if
(
isset
(
$filter
[
'settings callback'
])
&&
function_exists
(
$filter
[
'settings callback'
])
)
{
if
(
isset
(
$filter
[
'settings callback'
]))
{
$function
=
$filter
[
'settings callback'
];
// Pass along stored filter settings and default settings, but also the
// format object and all filters to allow for complex implementations.
...
...
core/modules/filter/filter.module
View file @
9c29ac79
...
...
@@ -746,7 +746,7 @@ function check_markup($text, $format_id = NULL, $langcode = '', $cache = FALSE)
// Give filters the chance to escape HTML-like data such as code or formulas.
foreach
(
$filters
as
$name
=>
$filter
)
{
if
(
$filter
->
status
&&
isset
(
$filter_info
[
$name
][
'prepare callback'
])
&&
function_exists
(
$filter_info
[
$name
][
'prepare callback'
])
)
{
if
(
$filter
->
status
&&
isset
(
$filter_info
[
$name
][
'prepare callback'
]))
{
$function
=
$filter_info
[
$name
][
'prepare callback'
];
$text
=
$function
(
$text
,
$filter
,
$format
,
$langcode
,
$cache
,
$cache_id
);
}
...
...
@@ -754,7 +754,7 @@ function check_markup($text, $format_id = NULL, $langcode = '', $cache = FALSE)
// Perform filtering.
foreach
(
$filters
as
$name
=>
$filter
)
{
if
(
$filter
->
status
&&
isset
(
$filter_info
[
$name
][
'process callback'
])
&&
function_exists
(
$filter_info
[
$name
][
'process callback'
])
)
{
if
(
$filter
->
status
&&
isset
(
$filter_info
[
$name
][
'process callback'
]))
{
$function
=
$filter_info
[
$name
][
'process callback'
];
$text
=
$function
(
$text
,
$filter
,
$format
,
$langcode
,
$cache
,
$cache_id
);
}
...
...
@@ -1015,7 +1015,7 @@ function _filter_tips($format_id, $long = FALSE) {
$filters
=
filter_list_format
(
$format
->
format
);
$tips
[
$format
->
name
]
=
array
();
foreach
(
$filters
as
$name
=>
$filter
)
{
if
(
$filter
->
status
&&
isset
(
$filter_info
[
$name
][
'tips callback'
])
&&
function_exists
(
$filter_info
[
$name
][
'tips callback'
])
)
{
if
(
$filter
->
status
&&
isset
(
$filter_info
[
$name
][
'tips callback'
]))
{
$tip
=
$filter_info
[
$name
][
'tips callback'
](
$filter
,
$format
,
$long
);
if
(
isset
(
$tip
))
{
$tips
[
$format
->
name
][
$name
]
=
array
(
'tip'
=>
$tip
,
'id'
=>
$name
);
...
...
core/modules/image/image.admin.inc
View file @
9c29ac79
...
...
@@ -389,9 +389,8 @@ function image_effect_form($form, &$form_state, $style, $effect) {
$form
[
'#tree'
]
=
TRUE
;
$form
[
'#attached'
][
'css'
][
drupal_get_path
(
'module'
,
'image'
)
.
'/image.admin.css'
]
=
array
();
if
(
function_exists
(
$effect
[
'form callback'
]))
{
$form
[
'data'
]
=
call_user_func
(
$effect
[
'form callback'
],
$effect
[
'data'
]);
}
$form
[
'data'
]
=
call_user_func
(
$effect
[
'form callback'
],
$effect
[
'data'
]);
// Check the URL for a weight, then the image effect, otherwise use default.
$form
[
'weight'
]
=
array
(
...
...
core/modules/image/image.module
View file @
9c29ac79
...
...
@@ -1150,10 +1150,7 @@ function image_effect_delete($effect) {
function
image_effect_apply
(
$image
,
$effect
)
{
module_load_include
(
'inc'
,
'image'
,
'image.effects'
);
$function
=
$effect
[
'effect callback'
];
if
(
function_exists
(
$function
))
{
return
$function
(
$image
,
$effect
[
'data'
]);
}
return
FALSE
;
return
$function
(
$image
,
$effect
[
'data'
]);
}
/**
...
...
core/modules/rdf/rdf.module
View file @
9c29ac79
...
...
@@ -304,7 +304,7 @@ function rdf_rdfa_attributes($mapping, $data = NULL) {
case
'property'
:
$attributes
[
'property'
]
=
$mapping
[
'predicates'
];
// Convert $data to a specific format as per the callback function.
if
(
isset
(
$data
)
&&
isset
(
$mapping
[
'callback'
])
&&
function_exists
(
$mapping
[
'callback'
])
)
{
if
(
isset
(
$data
)
&&
isset
(
$mapping
[
'callback'
]))
{
$callback
=
$mapping
[
'callback'
];
$attributes
[
'content'
]
=
$callback
(
$data
);
}
...
...
core/modules/search/search.pages.inc
View file @
9c29ac79
...
...
@@ -52,7 +52,7 @@ function search_view($module = NULL, $keys = '') {
// the search query URL clean as a whistle.
if
(
empty
(
$_POST
[
'form_id'
])
||
$_POST
[
'form_id'
]
!=
'search_form'
)
{
$conditions
=
NULL
;
if
(
isset
(
$info
[
'conditions_callback'
])
&&
function_exists
(
$info
[
'conditions_callback'
])
)
{
if
(
isset
(
$info
[
'conditions_callback'
]))
{
// Build an optional array of more search conditions.
$conditions
=
call_user_func
(
$info
[
'conditions_callback'
],
$keys
);
}
...
...
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