Subscribe: Issues for Feedjit
http://drupal.org/project/issues/rss/feedjit?order=name&sort=asc&status=All&categories=All
Preview: Issues for Feedjit

Issues for Feedjit





 



declared variables should be moved into init hook

Fri, 19 Dec 2008 22:46:09 +0000

On the beginning of the module file there are variables which are declared directly in file, which using t() function.
It's not good idea to to that.

global $_feedjit_color_names, $_feedjit_schemes;
$_feedjit_color_names = array('bc', 'tc', 'brd1', 'lnk', 'hc');
$_feedjit_schemes = array( // in color.module format
  '#FFFFFF,#494949,#336699,#494949,#336699' => t('Feedjit Neutral'),
  '#E8F6BE,#666666,#C4C4C4,#666666,#7F7F7F' => t('Feedjit Green'),
...
);

During loading the files, module making mysql access and slowing down loading process and some functionality can be not available in this time (like caching, other handling, etc).
It's better to move this code into init or boot hook.

Like:

/**
 * Implementation of hook_init().
 */
function feedjit_init() {
    global $_feedjit_color_names, $_feedjit_schemes;
    $_feedjit_color_names = array('bc', 'tc', 'brd1', 'lnk', 'hc');
...
}