Commit eb2f9c98 authored by Evan Prodromou's avatar Evan Prodromou

replace NULL with null

Another global search-and-replace update. Here, I've replaced the PHP
keyword 'NULL' with its lowercase version. This is another PEAR code
standards change.

darcs-hash:20081223192129-84dde-4a0182e0ec16a01ad88745ad3e08f7cb501aee0b.gz
parent edbc0c66
......@@ -59,4 +59,12 @@ Evan Prodromou <evan@prodromou.name>**20081223191907
getting us towards phpcs-compliance. And that means better code
readability, and that means more participation.
]
[replace NULL with null
Evan Prodromou <evan@prodromou.name>**20081223192129
Another global search-and-replace update. Here, I've replaced the PHP
keyword 'NULL' with its lowercase version. This is another PEAR code
standards change.
]
\ No newline at end of file
......@@ -25,7 +25,7 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
class AllrssAction extends Rss10Action {
var $user = NULL;
var $user = null;
function init() {
$nickname = $this->trimmed('nickname');
......@@ -69,9 +69,9 @@ class AllrssAction extends Rss10Action {
$user = $this->user;
$profile = $user->getProfile();
if (!$profile) {
return NULL;
return null;
}
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
return ($avatar) ? $avatar->url : NULL;
return ($avatar) ? $avatar->url : null;
}
}
\ No newline at end of file
......@@ -152,8 +152,8 @@ class ApiAction extends Action {
header('Content-Type: application/xml; charset=utf-8');
common_start_xml();
common_element_start('hash');
common_element('error', NULL, $msg);
common_element('request', NULL, $_SERVER['REQUEST_URI']);
common_element('error', null, $msg);
common_element('request', null, $_SERVER['REQUEST_URI']);
common_element_end('hash');
common_end_xml();
} else if ($this->content_type == 'json') {
......
......@@ -21,7 +21,7 @@ if (!defined('LACONICA')) { exit(1); }
class BlockAction extends Action {
var $profile = NULL;
var $profile = null;
function prepare($args) {
......@@ -77,7 +77,7 @@ class BlockAction extends Action {
common_show_header(_('Block user'));
common_element('p', NULL,
common_element('p', null,
_('Are you sure you want to block this user? '.
'Afterwards, they will be unsubscribed from you, '.
'unable to subscribe to you in the future, and '.
......
......@@ -88,7 +88,7 @@ class ConfirmaddressAction extends Action {
$cur->query('COMMIT');
common_show_header(_('Confirm Address'));
common_element('p', NULL,
common_element('p', null,
sprintf(_('The address "%s" has been confirmed for your account.'), $cur->$type));
common_show_footer();
}
......
......@@ -41,7 +41,7 @@ class DeletenoticeAction extends DeleteAction {
return _('Delete notice');
}
function show_form($error=NULL) {
function show_form($error=null) {
$user = common_current_user();
common_show_header($this->get_title(), array($this, 'show_header'), $error,
......@@ -91,7 +91,7 @@ class DeletenoticeAction extends DeleteAction {
$notice->delete();
} else {
if ($url) {
common_set_returnto(NULL);
common_set_returnto(null);
} else {
$url = common_local_url('public');
}
......
......@@ -36,9 +36,9 @@ class DeleteprofileAction extends Action {
return _('Export and delete your user information.');
}
function form_header($title, $msg=NULL, $success=false) {
function form_header($title, $msg=null, $success=false) {
common_show_header($title,
NULL,
null,
array($msg, $success),
array($this, 'show_top'));
}
......@@ -84,9 +84,9 @@ class DeleteprofileAction extends Action {
common_element_end('li');
}
function show_form($msg=NULL, $success=false) {
function show_form($msg=null, $success=false) {
$this->form_header(_('Delete my account'), $msg, $success);
common_element('h2', NULL, _('Delete my account confirmation'));
common_element('h2', null, _('Delete my account confirmation'));
$this->show_confirm_delete_form();
common_show_footer();
}
......@@ -213,7 +213,7 @@ class DeleteprofileAction extends Action {
$n_users_deleted = $user->delete();
// logout and redirect to public
common_set_user(NULL);
common_set_user(null);
common_real_login(false); # not logged in
common_forgetme(); # don't log back in!
common_redirect(common_local_url('public'));
......
......@@ -27,7 +27,7 @@ class EmailsettingsAction extends SettingsAction {
return _('Manage how you get email from %%site.name%%.');
}
function show_form($msg=NULL, $success=false) {
function show_form($msg=null, $success=false) {
$user = common_current_user();
$this->form_header(_('Email Settings'), $msg, $success);
common_element_start('form', array('method' => 'post',
......@@ -36,7 +36,7 @@ class EmailsettingsAction extends SettingsAction {
common_local_url('emailsettings')));
common_hidden('token', common_session_token());
common_element('h2', NULL, _('Address'));
common_element('h2', null, _('Address'));
if ($user->email) {
common_element_start('p');
......@@ -58,14 +58,14 @@ class EmailsettingsAction extends SettingsAction {
common_submit('cancel', _('Cancel'));
} else {
common_input('email', _('Email Address'),
($this->arg('email')) ? $this->arg('email') : NULL,
($this->arg('email')) ? $this->arg('email') : null,
_('Email address, like "UserName@example.org"'));
common_submit('add', _('Add'));
}
}
if ($user->email) {
common_element('h2', NULL, _('Incoming email'));
common_element('h2', null, _('Incoming email'));
if ($user->incomingemail) {
common_element_start('p');
......@@ -83,7 +83,7 @@ class EmailsettingsAction extends SettingsAction {
common_submit('newincoming', _('New'));
}
common_element('h2', NULL, _('Preferences'));
common_element('h2', null, _('Preferences'));
common_checkbox('emailnotifysub',
_('Send me notices of new subscriptions through email.'),
......@@ -118,7 +118,7 @@ class EmailsettingsAction extends SettingsAction {
if ($confirm->find(TRUE)) {
return $confirm;
} else {
return NULL;
return null;
}
}
......@@ -273,7 +273,7 @@ class EmailsettingsAction extends SettingsAction {
$user->query('BEGIN');
$original = clone($user);
$user->email = NULL;
$user->email = null;
$result = $user->updateKeys($original);
if (!$result) {
common_log_db_error($user, 'UPDATE', __FILE__);
......@@ -294,7 +294,7 @@ class EmailsettingsAction extends SettingsAction {
}
$orig = clone($user);
$user->incomingemail = NULL;
$user->incomingemail = null;
if (!$user->updateKeys($orig)) {
common_log_db_error($user, 'UPDATE', __FILE__);
......
......@@ -29,7 +29,7 @@ class FavoritedAction extends StreamAction {
$page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
common_show_header(_('Popular notices'),
array($this, 'show_header'), NULL,
array($this, 'show_header'), null,
array($this, 'show_top'));
$this->show_notices($page);
......
......@@ -25,7 +25,7 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
class FavoritesrssAction extends Rss10Action {
var $user = NULL;
var $user = null;
function init() {
$nickname = $this->trimmed('nickname');
......@@ -68,6 +68,6 @@ class FavoritesrssAction extends Rss10Action {
}
function get_image() {
return NULL;
return null;
}
}
\ No newline at end of file
......@@ -30,7 +30,7 @@ class FeaturedAction extends StreamAction {
$page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
common_show_header(_('Featured users'),
array($this, 'show_header'), NULL,
array($this, 'show_header'), null,
array($this, 'show_top'));
$this->show_notices($page);
......
......@@ -97,7 +97,7 @@ class FinishaddopenidAction extends Action {
function message($msg) {
common_show_header(_('OpenID Login'));
common_element('p', NULL, $msg);
common_element('p', null, $msg);
common_show_footer();
}
}
......@@ -52,7 +52,7 @@ class FinishopenidloginAction extends Action {
}
}
function show_top($error=NULL) {
function show_top($error=null) {
if ($error) {
common_element('div', array('class' => 'error'), $error);
} else {
......@@ -62,17 +62,17 @@ class FinishopenidloginAction extends Action {
}
}
function show_form($error=NULL, $username=NULL) {
common_show_header(_('OpenID Account Setup'), NULL, $error,
function show_form($error=null, $username=null) {
common_show_header(_('OpenID Account Setup'), null, $error,
array($this, 'show_top'));
common_element_start('form', array('method' => 'post',
'id' => 'account_connect',
'action' => common_local_url('finishopenidlogin')));
common_hidden('token', common_session_token());
common_element('h2', NULL,
common_element('h2', null,
_('Create new account'));
common_element('p', NULL,
common_element('p', null,
_('Create a new user with this nickname.'));
common_input('newname', _('New nickname'),
($username) ? $username : '',
......@@ -88,9 +88,9 @@ class FinishopenidloginAction extends Action {
common_text(_(' except this private data: password, email address, IM address, phone number.'));
common_element_end('p');
common_submit('create', _('Create'));
common_element('h2', NULL,
common_element('h2', null,
_('Connect existing account'));
common_element('p', NULL,
common_element('p', null,
_('If you already have an account, login with your username and password to connect it to your OpenID.'));
common_input('nickname', _('Existing nickname'));
common_password('password', _('Password'));
......@@ -141,14 +141,14 @@ class FinishopenidloginAction extends Action {
$this->go_home($user->nickname);
} else {
$this->save_values($display, $canonical, $sreg);
$this->show_form(NULL, $this->best_new_nickname($display, $sreg));
$this->show_form(null, $this->best_new_nickname($display, $sreg));
}
}
}
function message($msg) {
common_show_header(_('OpenID Login'));
common_element('p', NULL, $msg);
common_element('p', null, $msg);
common_show_footer();
}
......@@ -290,7 +290,7 @@ class FinishopenidloginAction extends Action {
$url = common_get_returnto();
if ($url) {
# We don't have to return to it again
common_set_returnto(NULL);
common_set_returnto(null);
} else {
$url = common_local_url('all',
array('nickname' =>
......@@ -329,7 +329,7 @@ class FinishopenidloginAction extends Action {
# XXX: others?
return NULL;
return null;
}
function is_new_nickname($str) {
......@@ -369,7 +369,7 @@ class FinishopenidloginAction extends Action {
foreach ($bad as $badpart) {
if (array_key_exists($badpart, $parts)) {
return NULL;
return null;
}
}
......@@ -403,14 +403,14 @@ class FinishopenidloginAction extends Action {
}
}
return NULL;
return null;
}
function xri_to_nickname($xri) {
$base = $this->xri_base($xri);
if (!$base) {
return NULL;
return null;
} else {
# =evan.prodromou
# or @gratis*evan.prodromou
......
......@@ -278,7 +278,7 @@ class FinishremotesubscribeAction extends Action {
common_debug('got result: "'.print_r($result,TRUE).'"', __FILE__);
if ($result->status != 200) {
return NULL;
return null;
}
parse_str($result->body, $return);
......
......@@ -66,21 +66,21 @@ class FoafAction extends Action {
# XXX: might not be a person
common_element_start('Person', array('rdf:about' =>
$user->uri));
common_element('mbox_sha1sum', NULL, sha1('mailto:' . $user->email));
common_element('mbox_sha1sum', null, sha1('mailto:' . $user->email));
if ($profile->fullname) {
common_element('name', NULL, $profile->fullname);
common_element('name', null, $profile->fullname);
}
if ($profile->homepage) {
common_element('homepage', array('rdf:resource' => $profile->homepage));
}
if ($profile->bio) {
common_element('rdfs:comment', NULL, $profile->bio);
common_element('rdfs:comment', null, $profile->bio);
}
# XXX: more structured location data
if ($profile->location) {
common_element_start('based_near');
common_element_start('geo:SpatialThing');
common_element('name', NULL, $profile->location);
common_element('name', null, $profile->location);
common_element_end('geo:SpatialThing');
common_element_end('based_near');
}
......@@ -156,7 +156,7 @@ class FoafAction extends Action {
common_element_end('Person');
foreach ($person as $uri => $p) {
$foaf_url = NULL;
$foaf_url = null;
if ($p[1] instanceof User) {
$foaf_url = common_local_url('foaf', array('nickname' => $p[1]->nickname));
}
......@@ -166,7 +166,7 @@ class FoafAction extends Action {
common_element('knows', array('rdf:resource' => $user->uri));
}
$this->show_microblogging_account($profile, ($p[1] instanceof User) ?
common_root_url() : NULL);
common_root_url() : null);
if ($foaf_url) {
common_element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
}
......@@ -186,7 +186,7 @@ class FoafAction extends Action {
common_element_end('PersonalProfileDocument');
}
function show_microblogging_account($profile, $service=NULL) {
function show_microblogging_account($profile, $service=null) {
# Their account
common_element_start('holdsAccount');
common_element_start('OnlineAccount');
......@@ -194,7 +194,7 @@ class FoafAction extends Action {
common_element('accountServiceHomepage', array('rdf:resource' =>
$service));
}
common_element('accountName', NULL, $profile->nickname);
common_element('accountName', null, $profile->nickname);
common_element('homepage', array('rdf:resource' => $profile->profileurl));
common_element_end('OnlineAccount');
common_element_end('holdsAccount');
......
......@@ -28,7 +28,7 @@ class ImsettingsAction extends SettingsAction {
return _('You can send and receive notices through Jabber/GTalk [instant messages](%%doc.im%%). Configure your address and settings below.');
}
function show_form($msg=NULL, $success=false) {
function show_form($msg=null, $success=false) {
$user = common_current_user();
$this->form_header(_('IM Settings'), $msg, $success);
common_element_start('form', array('method' => 'post',
......@@ -37,7 +37,7 @@ class ImsettingsAction extends SettingsAction {
common_local_url('imsettings')));
common_hidden('token', common_session_token());
common_element('h2', NULL, _('Address'));
common_element('h2', null, _('Address'));
if ($user->jabber) {
common_element_start('p');
......@@ -59,13 +59,13 @@ class ImsettingsAction extends SettingsAction {
common_submit('cancel', _('Cancel'));
} else {
common_input('jabber', _('IM Address'),
($this->arg('jabber')) ? $this->arg('jabber') : NULL,
($this->arg('jabber')) ? $this->arg('jabber') : null,
sprintf(_('Jabber or GTalk address, like "UserName@example.org". First, make sure to add %s to your buddy list in your IM client or on GTalk.'), jabber_daemon_address()));
common_submit('add', _('Add'));
}
}
common_element('h2', NULL, _('Preferences'));
common_element('h2', null, _('Preferences'));
common_checkbox('jabbernotify',
_('Send me notices through Jabber/GTalk.'),
......@@ -93,7 +93,7 @@ class ImsettingsAction extends SettingsAction {
if ($confirm->find(TRUE)) {
return $confirm;
} else {
return NULL;
return null;
}
}
......@@ -244,7 +244,7 @@ class ImsettingsAction extends SettingsAction {
$user->query('BEGIN');
$original = clone($user);
$user->jabber = NULL;
$user->jabber = null;
$result = $user->updateKeys($original);
if (!$result) {
common_log_db_error($user, 'UPDATE', __FILE__);
......
......@@ -85,49 +85,49 @@ class InviteAction extends Action {
common_show_header(_('Invitation(s) sent'));
if ($already) {
common_element('p', NULL, _('You are already subscribed to these users:'));
common_element('p', null, _('You are already subscribed to these users:'));
common_element_start('ul');
foreach ($already as $other) {
common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
}
common_element_end('ul');
}
if ($subbed) {
common_element('p', NULL, _('These people are already users and you were automatically subscribed to them:'));
common_element('p', null, _('These people are already users and you were automatically subscribed to them:'));
common_element_start('ul');
foreach ($subbed as $other) {
common_element('li', NULL, sprintf(_('%s (%s)'), $other->nickname, $other->email));
common_element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email));
}
common_element_end('ul');
}
if ($sent) {
common_element('p', NULL, _('Invitation(s) sent to the following people:'));
common_element('p', null, _('Invitation(s) sent to the following people:'));
common_element_start('ul');
foreach ($sent as $other) {
common_element('li', NULL, $other);
common_element('li', null, $other);
}
common_element_end('ul');
common_element('p', NULL, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
common_element('p', null, _('You will be notified when your invitees accept the invitation and register on the site. Thanks for growing the community!'));
}
common_show_footer();
}
function show_top($error=NULL) {
function show_top($error=null) {
if ($error) {
common_element('p', 'error', $error);
} else {
common_element_start('div', 'instructions');
common_element('p', NULL,
common_element('p', null,
_('Use this form to invite your friends and colleagues to use this service.'));
common_element_end('div');
}
}
function show_form($error=NULL) {
function show_form($error=null) {
global $config;
common_show_header(_('Invite new users'), NULL, $error, array($this, 'show_top'));
common_show_header(_('Invite new users'), null, $error, array($this, 'show_top'));
common_element_start('form', array('method' => 'post',
'id' => 'invite',
......
......@@ -63,7 +63,7 @@ class LoginAction extends Action {
$url = common_get_returnto();
if ($url) {
# We don't have to return to it again
common_set_returnto(NULL);
common_set_returnto(null);
} else {
$url = common_local_url('all',
array('nickname' =>
......@@ -91,7 +91,7 @@ class LoginAction extends Action {
$url = common_get_returnto();
if ($url) {
# We don't have to return to it again
common_set_returnto(NULL);
common_set_returnto(null);
} else {
$url = common_local_url('all',
array('nickname' =>
......@@ -100,8 +100,8 @@ class LoginAction extends Action {
common_redirect($url);
}
function show_form($error=NULL) {
common_show_header(_('Login'), NULL, $error, array($this, 'show_top'));
function show_form($error=null) {
common_show_header(_('Login'), null, $error, array($this, 'show_top'));
common_element_start('form', array('method' => 'post',
'id' => 'login',
'action' => common_local_url('login')));
......@@ -138,7 +138,7 @@ class LoginAction extends Action {
}
}
function show_top($error=NULL) {
function show_top($error=null) {
if ($error) {
common_element('p', 'error', $error);
} else {
......
......@@ -32,7 +32,7 @@ class LogoutAction extends Action {
if (!common_logged_in()) {
common_user_error(_('Not logged in.'));
} else {
common_set_user(NULL);
common_set_user(null);
common_real_login(false); # not logged in
common_forgetme(); # don't log back in!
common_redirect(common_local_url('public'));
......
......@@ -98,7 +98,7 @@ class NewmessageAction extends Action {
common_message_form($content, $user, $to);
}
function show_form($msg=NULL) {
function show_form($msg=null) {
$content = $this->trimmed('content');
$user = common_current_user();
......@@ -117,7 +117,7 @@ class NewmessageAction extends Action {
return;
}
common_show_header(_('New message'), NULL,
common_show_header(_('New message'), null,
array($content, $user, $other),
array($this, 'show_top'));
......
......@@ -78,7 +78,7 @@ class NewnoticeAction extends Action {
$replyto = $this->trimmed('inreplyto');
$notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? NULL : $replyto);
$notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? null : $replyto);
if (is_string($notice)) {
$this->show_form($notice);
......@@ -121,11 +121,11 @@ class NewnoticeAction extends Action {
common_element_end('html');
}
function show_top($content=NULL) {
common_notice_form(NULL, $content);
function show_top($content=null) {
common_notice_form(null, $content);
}
function show_form($msg=NULL) {
function show_form($msg=null) {
if ($msg && $this->boolean('ajax')) {
$this->ajax_error_msg($msg);
return;
......@@ -138,7 +138,7 @@ class NewnoticeAction extends Action {
$content = '@' . $profile->nickname . ' ';
}
}
common_show_header(_('New notice'), NULL, $content,
common_show_header(_('New notice'), null, $content,
array($this, 'show_top'));
if ($msg) {
common_element('p', array('id' => 'error'), $msg);
....