Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
3780b176
Commit
3780b176
authored
Sep 26, 2010
by
Dries Buytaert
Browse files
- Patch
#921606
by munzirtaha, bleen18: various code uses is_null().
parent
88bc80a5
Changes
14
Hide whitespace changes
Inline
Side-by-side
includes/common.inc
View file @
3780b176
...
...
@@ -1616,7 +1616,7 @@ function format_rss_item($title, $link, $description, $args = array()) {
* Format XML elements.
*
* @param $array
* An array where each item represent an element and is either a:
* An array where each item represent
s
an element and is either a:
* - (key => value) pair (<key>value</key>)
* - Associative array with fields:
* - 'key': element name
...
...
includes/file.inc
View file @
3780b176
...
...
@@ -2193,11 +2193,11 @@ function drupal_dirname($uri) {
* @ingroup php_wrappers
*/
function
drupal_mkdir
(
$uri
,
$mode
=
NULL
,
$recursive
=
FALSE
,
$context
=
NULL
)
{
if
(
is
_null
(
$mode
))
{
if
(
!
is
set
(
$mode
))
{
$mode
=
variable_get
(
'file_chmod_directory'
,
0775
);
}
if
(
is
_null
(
$context
))
{
if
(
!
is
set
(
$context
))
{
return
mkdir
(
$uri
,
$mode
,
$recursive
);
}
else
{
...
...
@@ -2282,7 +2282,7 @@ function drupal_tempnam($directory, $prefix) {
function
file_directory_temp
()
{
$temporary_directory
=
variable_get
(
'file_directory_temp'
,
NULL
);
if
(
is
_null
(
$temporary_directory
))
{
if
(
!
is
set
(
$temporary_directory
))
{
$directories
=
array
();
// Has PHP been set with an upload_tmp_dir?
...
...
includes/form.inc
View file @
3780b176
...
...
@@ -2096,7 +2096,7 @@ function form_type_checkboxes_value($element, $input = FALSE) {
// checkboxes to the server at all). This will not affect non-programmatic
// form submissions, since a checkbox can never legitimately be NULL.
foreach ($input as $key => $value) {
if (is
_null
($value)) {
if (
!
is
set
($value)) {
unset($input[$key]);
}
}
...
...
@@ -4009,7 +4009,7 @@ function _batch_queue($batch_set) {
// The class autoloader is not available when running update.php, so make
// sure the files are manually included.
if (is
_null
($queues)) {
if (
!
is
set
($queues)) {
$queues = array();
require_once DRUPAL_ROOT . '/modules/system/system.queue.inc';
require_once DRUPAL_ROOT . '/includes/batch.queue.inc';
...
...
includes/theme.inc
View file @
3780b176
...
...
@@ -1119,7 +1119,7 @@ function theme_get_setting($setting_name, $theme = NULL) {
$cache = &drupal_static(__FUNCTION__, array());
// If no key is given, use the current theme if we can determine it.
if (is
_null
($theme)) {
if (
!
is
set
($theme)) {
$theme = !empty($GLOBALS['theme_key']) ? $GLOBALS['theme_key'] : '';
}
...
...
modules/field/modules/field_sql_storage/field_sql_storage.module
View file @
3780b176
...
...
@@ -106,7 +106,7 @@ function _field_sql_storage_indexname($name, $index) {
*/
function
_field_sql_storage_etid
(
$entity_type
)
{
$etid
=
variable_get
(
'field_sql_storage_'
.
$entity_type
.
'_etid'
,
NULL
);
if
(
is
_null
(
$etid
))
{
if
(
!
is
set
(
$etid
))
{
$etid
=
db_insert
(
'field_config_entity_type'
)
->
fields
(
array
(
'type'
=>
$entity_type
))
->
execute
();
variable_set
(
'field_sql_storage_'
.
$entity_type
.
'_etid'
,
$etid
);
}
...
...
modules/field/tests/field_test.module
View file @
3780b176
...
...
@@ -152,7 +152,7 @@ function field_test_field_language_alter(&$display_language, $context) {
function
field_test_memorize
(
$key
=
NULL
,
$value
=
NULL
)
{
$memorize
=
&
drupal_static
(
__FUNCTION__
,
NULL
);
if
(
is
_null
(
$key
))
{
if
(
!
is
set
(
$key
))
{
$return
=
$memorize
;
$memorize
=
array
();
return
$return
;
...
...
modules/field/tests/field_test.storage.inc
View file @
3780b176
...
...
@@ -70,7 +70,7 @@ function field_test_field_storage_details_alter(&$details, $field) {
* Helper function: stores or retrieves data from the 'storage backend'.
*/
function
_field_test_storage_data
(
$data
=
NULL
)
{
if
(
is
_null
(
$data
))
{
if
(
!
is
set
(
$data
))
{
return
variable_get
(
'field_test_storage_data'
,
array
());
}
else
{
...
...
@@ -318,7 +318,7 @@ function field_test_field_storage_query($field_id, $conditions, $count, &$cursor
}
if
(
$match
)
{
if
(
is
_null
(
$skip
)
||
$skipped
>=
$skip
)
{
if
(
!
is
set
(
$skip
)
||
$skipped
>=
$skip
)
{
$cursor
++
;
// If querying all revisions and the entity type has revisions, we need
// to key the results by revision_ids.
...
...
modules/field_ui/field_ui.admin.inc
View file @
3780b176
...
...
@@ -68,7 +68,7 @@ function field_ui_inactive_message($entity_type, $bundle) {
* This is intended as a callback for array_reduce().
*/
function _field_ui_reduce_order($array, $a) {
$array = is
_null
($array) ? array() : $array;
$array =
!
is
set
($array) ? array() : $array;
if ($a['name']) {
$array[] = $a['name'];
}
...
...
modules/search/search.module
View file @
3780b176
...
...
@@ -959,7 +959,7 @@ function search_form($form, &$form_state, $action = '', $keys = '', $type = NULL
if
(
!
$action
)
{
$action
=
'search/'
.
$module_info
[
'path'
];
}
if
(
is
_null
(
$prompt
))
{
if
(
!
is
set
(
$prompt
))
{
$prompt
=
t
(
'Enter your keywords'
);
}
...
...
modules/simpletest/tests/batch_test.module
View file @
3780b176
...
...
@@ -466,7 +466,7 @@ function batch_test_stack($data = NULL, $reset = FALSE) {
if
(
$reset
)
{
variable_del
(
'batch_test_stack'
);
}
if
(
is
_null
(
$data
))
{
if
(
!
is
set
(
$data
))
{
return
variable_get
(
'batch_test_stack'
,
array
());
}
$stack
=
variable_get
(
'batch_test_stack'
,
array
());
...
...
modules/simpletest/tests/file.test
View file @
3780b176
...
...
@@ -174,7 +174,7 @@ class FileTestCase extends DrupalWebTestCase {
*/
function createDirectory($path = NULL) {
// A directory to operate on.
if (is
_null
($path)) {
if (
!
is
set
($path)) {
$path = file_default_scheme() . '://' . $this->randomName();
}
$this->assertTrue(drupal_mkdir($path) && is_dir($path), t('Directory was created successfully.'));
...
...
@@ -198,12 +198,12 @@ class FileTestCase extends DrupalWebTestCase {
* File object.
*/
function createFile($filepath = NULL, $contents = NULL, $scheme = 'public') {
if (is
_null
($filepath)) {
if (
!
is
set
($filepath)) {
$filepath = $this->randomName();
}
$filepath = $scheme . '://' . $filepath;
if (is
_null
($contents)) {
if (
!
is
set
($contents)) {
$contents = "file_put_contents() doesn't seem to appreciate empty strings so let's put in some data.";
}
...
...
@@ -282,7 +282,7 @@ class FileHookTestCase extends FileTestCase {
function assertFileHookCalled($hook, $expected_count = 1, $message = NULL) {
$actual_count = count(file_test_get_calls($hook));
if (is
_null
($message)) {
if (
!
is
set
($message)) {
if ($actual_count == $expected_count) {
$message = t('hook_file_@name was called correctly.', array('@name' => $hook));
}
...
...
modules/syslog/syslog.module
View file @
3780b176
...
...
@@ -103,7 +103,7 @@ function syslog_watchdog(array $log_entry) {
'!referer'
=>
$log_entry
[
'referer'
],
'!uid'
=>
$log_entry
[
'user'
]
->
uid
,
'!link'
=>
strip_tags
(
$log_entry
[
'link'
]),
'!message'
=>
strip_tags
(
is
_null
(
$log_entry
[
'variables'
])
?
$log_entry
[
'message'
]
:
strtr
(
$log_entry
[
'message'
],
$log_entry
[
'variables'
])),
'!message'
=>
strip_tags
(
!
is
set
(
$log_entry
[
'variables'
])
?
$log_entry
[
'message'
]
:
strtr
(
$log_entry
[
'message'
],
$log_entry
[
'variables'
])),
));
syslog
(
$log_entry
[
'severity'
],
$message
);
...
...
modules/taxonomy/taxonomy.module
View file @
3780b176
...
...
@@ -841,7 +841,7 @@ function taxonomy_get_tree($vid, $parent = 0, $max_depth = NULL, $depth = -1) {
}
}
$max_depth
=
(
is
_null
(
$max_depth
))
?
count
(
$children
[
$vid
])
:
$max_depth
;
$max_depth
=
(
!
is
set
(
$max_depth
))
?
count
(
$children
[
$vid
])
:
$max_depth
;
$tree
=
array
();
if
(
$max_depth
>
$depth
&&
!
empty
(
$children
[
$vid
][
$parent
]))
{
foreach
(
$children
[
$vid
][
$parent
]
as
$child
)
{
...
...
@@ -1038,7 +1038,7 @@ function taxonomy_implode_tags($tags, $vid = NULL) {
$typed_tags
=
array
();
foreach
(
$tags
as
$tag
)
{
// Extract terms belonging to the vocabulary in question.
if
(
is
_null
(
$vid
)
||
$tag
->
vid
==
$vid
)
{
if
(
!
is
set
(
$vid
)
||
$tag
->
vid
==
$vid
)
{
// Make sure we have a completed loaded taxonomy term.
if
(
isset
(
$tag
->
name
))
{
// Commas and quotes in tag names are special cases, so encode 'em.
...
...
scripts/run-tests.sh
View file @
3780b176
...
...
@@ -302,7 +302,7 @@ function simpletest_script_init($server_software) {
function
simpletest_script_execute_batch
()
{
global
$args
;
if
(
is
_null
(
$args
[
'test-id'
]))
{
if
(
!
is
set
(
$args
[
'test-id'
]))
{
simpletest_script_print_error
(
"--execute-batch should not be called interactively."
)
;
exit
;
}
...
...
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