Commit 765d0572 authored by Dries's avatar Dries

- Patch #471142 by stella: code style fixes.

parent 40348517
......@@ -207,7 +207,9 @@ function drupal_truncate_bytes($string, $len) {
if ((ord($string[$len]) < 0x80) || (ord($string[$len]) >= 0xC0)) {
return substr($string, 0, $len);
}
while (--$len >= 0 && ord($string[$len]) >= 0x80 && ord($string[$len]) < 0xC0) {};
// Scan backwards to beginning of the byte sequence.
while (--$len >= 0 && ord($string[$len]) >= 0x80 && ord($string[$len]) < 0xC0);
return substr($string, 0, $len);
}
......
......@@ -189,7 +189,7 @@ class DBLogTestCase extends DrupalWebTestCase {
$this->assertResponse(200);
// Retrieve user object.
$user = user_load_by_name($name);
$this->assertTrue($user != null, t('User @name was loaded', array('@name' => $name)));
$this->assertTrue($user != NULL, t('User @name was loaded', array('@name' => $name)));
$user->pass_raw = $pass; // Needed by drupalLogin.
// Login user.
$this->drupalLogin($user);
......@@ -266,7 +266,7 @@ class DBLogTestCase extends DrupalWebTestCase {
$this->assertResponse(200);
// Retrieve node object.
$node = $this->drupalGetNodeByTitle($title);
$this->assertTrue($node != null, t('Node @title was loaded', array('@title' => $title)));
$this->assertTrue($node != NULL, t('Node @title was loaded', array('@title' => $title)));
// Edit node.
$edit = $this->getContentUpdate($type);
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
......
......@@ -149,7 +149,7 @@ function hook_filter($op, $delta = 0, $format = -1, $text = '', $langcode = '',
*
*
*/
function hook_filter_tips($delta, $format, $long = false) {
function hook_filter_tips($delta, $format, $long = FALSE) {
if ($long) {
return t('To post pieces of code, surround them with &lt;code&gt;...&lt;/code&gt; tags. For PHP code, you can use &lt;?php ... ?&gt;, which will also colour it based on syntax.');
}
......
......@@ -257,7 +257,7 @@ class ForumTestCase extends DrupalWebTestCase {
// Retrieve node object.
$node = $this->drupalGetNodeByTitle($title);
$this->assertTrue($node != null, t('Node @title was loaded', array('@title' => $title)));
$this->assertTrue($node != NULL, t('Node @title was loaded', array('@title' => $title)));
// View forum topic.
$this->drupalGet('node/' . $node->nid);
......
......@@ -601,7 +601,7 @@ function hook_prepare($node) {
return;
}
$node->images['_original'] = $file->filepath;
_image_build_derivatives($node, true);
_image_build_derivatives($node, TRUE);
$node->new_file = TRUE;
}
}
......
......@@ -343,7 +343,7 @@ class PageEditTestCase extends DrupalWebTestCase {
// Check that "edit" link points to correct page.
$this->clickLink(t('Edit'));
$edit_url = url("node/$node->nid/edit", array('absolute' => true));
$edit_url = url("node/$node->nid/edit", array('absolute' => TRUE));
$actual_url = $this->getURL();
$this->assertEqual($edit_url, $actual_url, t('On edit page.'));
......
......@@ -154,7 +154,7 @@ function _openid_create_message($data) {
foreach ($data as $key => $value) {
if ((strpos($key, ':') !== FALSE) || (strpos($key, "\n") !== FALSE) || (strpos($value, "\n") !== FALSE)) {
return null;
return NULL;
}
$serialized .= "$key:$value\n";
}
......@@ -381,7 +381,7 @@ function _openid_dh_rand($stop) {
}
function _openid_get_bytes($num_bytes) {
static $f = null;
static $f = NULL;
$bytes = '';
if (!isset($f)) {
$f = @fopen(OPENID_RAND_SOURCE, "r");
......
......@@ -70,7 +70,7 @@
*
* @ingroup search
*/
function hook_search($op = 'search', $keys = null) {
function hook_search($op = 'search', $keys = NULL) {
switch ($op) {
case 'name':
return t('Content');
......@@ -262,13 +262,13 @@ function hook_update_index() {
// Get node output (filtered and with module-specific fields).
if (node_hook($node, 'view')) {
node_invoke($node, 'view', false, false);
node_invoke($node, 'view', FALSE, FALSE);
}
else {
$node = node_prepare($node, false);
$node = node_prepare($node, FALSE);
}
// Allow modules to change $node->body before viewing.
module_invoke_all('node_view', $node, false, false);
module_invoke_all('node_view', $node, FALSE, FALSE);
$text = '<h1>' . drupal_specialchars($node->title) . '</h1>' . $node->body;
......
<?php
print 'SimpleTest PHP was executed!';
?>
\ No newline at end of file
......@@ -18,8 +18,8 @@ class CacheTestCase extends DrupalWebTestCase {
* @return
* TRUE on pass, FALSE on fail.
*/
protected function checkCacheExists($cid, $var, $table = null) {
if ($table == null) {
protected function checkCacheExists($cid, $var, $table = NULL) {
if ($table == NULL) {
$table = $this->default_table;
}
......
......@@ -757,7 +757,7 @@ class DrupalDataApiTest extends DrupalWebTestCase {
*/
function testDrupalWriteRecord() {
// Insert an object record for a table with a single-field primary key.
$vocabulary = new StdClass();
$vocabulary = new stdClass();
$vocabulary->name = 'test';
$insert_result = drupal_write_record('taxonomy_vocabulary', $vocabulary);
$this->assertTrue($insert_result == SAVED_NEW, t('Correct value returned when a record is inserted with drupal_write_record() for a table with a single-field primary key.'));
......@@ -769,7 +769,7 @@ class DrupalDataApiTest extends DrupalWebTestCase {
$this->assertTrue($update_result == SAVED_UPDATED, t('Correct value returned when a record updated with drupal_write_record() for table with single-field primary key.'));
// Insert an object record for a table with a multi-field primary key.
$vocabulary_node_type = new StdClass();
$vocabulary_node_type = new stdClass();
$vocabulary_node_type->vid = $vocabulary->vid;
$vocabulary_node_type->type = 'page';
$insert_result = drupal_write_record('taxonomy_vocabulary_node_type', $vocabulary_node_type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment