Optimize the code

kiamlaluno - February 22, 2009 - 00:27
Project:Wordpress Import
Version:6.x-1.1
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:won't fix
Description

The code must be optimized a little. Just to make an example, the code could be changed from

<?php
$module_name
= 'wordpress_import';
$dir = drupal_get_path('module', $module_name) .'/tests';
?>

to

<?php
$dir
= drupal_get_path('module', 'wordpress_import') .'/tests';
?>

especially when $module_name is used just once on the function code.

#1

kiamlaluno - February 22, 2009 - 00:32

It would also be preferable to use if (is_null($r) {, rather than if ($r === NULL) {.

#2

kiamlaluno - February 22, 2009 - 00:41

Also, if the string doesn't contain only spaces, and a zero, then

<?php
if ('' != trim($post)) {
 
// ...
}
?>

can be changed in

<?php
if (!trim($post)) {
 
// ...
}
?>

#3

kmonty - November 30, 2009 - 01:21
Status:active» needs review

#4

kiamlaluno - November 30, 2009 - 01:42
Version:6.x-1.0» 6.x-1.1

What I reported is still valid for the latest official release available.

#5

lavamind - November 30, 2009 - 23:48
Status:needs review» won't fix

Release 6.x-1.x will not get any further enhancements, only bug fixes.

Version 2.0 already includes many optimizations, but feel free to submit other enhancements for that version.

 
 

Drupal is a registered trademark of Dries Buytaert.