[ticket/9556] Drop php closing tags, add trailing newline

Closing tags converted using Oleg's script.
remove-php-end-tags.py -a .

Trailing newlines added using the following where $ext is file extension.
find . -type f -name "*.$ext" -print | xargs printf "e %s\nw\n" | ed -s;

Extensions: php, css, html, js, xml.

PHPBB3-9556
This commit is contained in:
Igor Wiedler 2010-11-09 08:59:25 +01:00
parent 2e51e68ca1
commit af5b9a9640
474 changed files with 274 additions and 738 deletions

View file

@ -411,5 +411,3 @@ function run_command($command)
$result = trim(`$command`); $result = trim(`$command`);
echo "\n- Command Run: " . $command . "\n"; echo "\n- Command Run: " . $command . "\n";
} }
?>

View file

@ -618,5 +618,3 @@ function validate_range($value_ary, &$error)
} }
} }
} }
?>

View file

@ -49,5 +49,3 @@ $template->assign_vars(array(
$template->display('body'); $template->display('body');
garbage_collection(); garbage_collection();
?>

View file

@ -237,5 +237,3 @@ foreach ($cache->obtain_hooks() as $hook)
{ {
@include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx); @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
} }
?>

View file

@ -283,5 +283,3 @@ function unlock_cron()
WHERE config_name = 'cron_lock' AND config_value = '" . $db->sql_escape(CRON_ID) . "'"; WHERE config_name = 'cron_lock' AND config_value = '" . $db->sql_escape(CRON_ID) . "'";
$db->sql_query($sql); $db->sql_query($sql);
} }
?>

View file

@ -413,5 +413,3 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
unset($sql_ary); unset($sql_ary);
} }
?>

View file

@ -143,5 +143,3 @@ function adjust_avatar($old_name, $midfix)
} }
return false; return false;
} }
?>

View file

@ -170,5 +170,3 @@ $db->sql_freeresult($result);
// Done // Done
$db->sql_close(); $db->sql_close();
?>

View file

@ -122,5 +122,3 @@ $db->sql_freeresult($result);
// Done // Done
$db->sql_close(); $db->sql_close();
?>

View file

@ -128,5 +128,3 @@ $db->sql_freeresult($result);
// Done // Done
$db->sql_close(); $db->sql_close();
?>

View file

@ -126,5 +126,3 @@ $db->sql_freeresult($result);
// Done // Done
$db->sql_close(); $db->sql_close();
?>

View file

@ -126,4 +126,3 @@ $db->sql_freeresult($result);
// Done // Done
$db->sql_close(); $db->sql_close();
echo 'done'; echo 'done';
?>

View file

@ -48,5 +48,3 @@ echo 'FINISHED';
// Done // Done
$db->sql_close(); $db->sql_close();
?>

View file

@ -458,5 +458,3 @@ function make_user($username)
} }
} }
?>

View file

@ -72,5 +72,3 @@ do
while ($start); while ($start);
echo "<p><b>Done</b></p>\n"; echo "<p><b>Done</b></p>\n";
?>

View file

@ -58,5 +58,3 @@ while ($row = $db->sql_fetchrow($result))
$db->sql_freeresult($result); $db->sql_freeresult($result);
echo "<p><b>Done</b></p>\n"; echo "<p><b>Done</b></p>\n";
?>

View file

@ -2047,5 +2047,3 @@ EOF;
} }
echo 'done'; echo 'done';
?>

View file

@ -543,5 +543,3 @@ fclose($fp);
echo '<br>Finished!'; echo '<br>Finished!';
flush(); flush();
?>

View file

@ -186,5 +186,3 @@ function rndm_username()
return $usernames[array_rand($usernames)]; return $usernames[array_rand($usernames)];
} }
?>

View file

@ -152,5 +152,3 @@ function download($url)
echo "\n"; echo "\n";
} }
?>

View file

@ -240,5 +240,3 @@ function download($url)
echo "\n"; echo "\n";
} }
?>

View file

@ -76,5 +76,3 @@ $db->sql_query($sql);
//$db->sql_query("DROP TABLE {$table_prefix}attach_temp"); //$db->sql_query("DROP TABLE {$table_prefix}attach_temp");
echo "<p><b>Done</b></p>\n"; echo "<p><b>Done</b></p>\n";
?>

View file

@ -205,5 +205,3 @@ foreach ($sql_ary as $sql)
} }
echo "<p><b>Done</b></p>\n"; echo "<p><b>Done</b></p>\n";
?>

View file

@ -1398,5 +1398,3 @@ function get_schema_struct()
return $schema_data; return $schema_data;
} }
?>

View file

@ -54,5 +54,3 @@ else
flush(); flush();
} }
} }
?>

View file

@ -80,5 +80,3 @@ echo 'www.URL: ' . $www_url . "<br />\n";
// no schema and no authority // no schema and no authority
$relative_url = "$segment$path_abempty(?:\?$query)?(?:\#$fragment)?"; $relative_url = "$segment$path_abempty(?:\?$query)?(?:\#$fragment)?";
echo 'relative URL: ' . $relative_url . "<br />\n"; echo 'relative URL: ' . $relative_url . "<br />\n";
?>

View file

@ -0,0 +1,65 @@
#!/usr/bin/env python
# Remove ending PHP tags '?>'
# @author Oleg Pudeyev
# @license http://opensource.org/licenses/gpl-license.php GNU Public License
import sys, os, os.path, optparse
def error(message, code):
print >>sys.stderr, message
exit(code)
parser = optparse.OptionParser()
parser.add_option('-a', '--aggressive', help='Remove ending tags when they are followed by whitespace', action='store_true')
options, args = parser.parse_args()
if len(args) != 1:
parser.usage()
error("Usage: remove-php-end-tags path", 2)
path = args[0]
if not os.path.exists(path):
error("Path does not exist: %s" % path, 3)
if options.aggressive:
import re
fix_re = re.compile(r'\s*\?>\s*$')
def fix_content(content):
content = fix_re.sub(r'\n', content)
return content
else:
def fix_content(content):
if content.endswith('?>'):
content = content[:-2].strip() + "\n"
return content
def process_file(path):
f = open(path)
try:
content = f.read()
finally:
f.close()
fixed_content = fix_content(content)
if content != fixed_content:
f = open(path, 'w')
try:
f.write(fixed_content)
finally:
f.close()
def process_dir(path):
for root, dirs, files in os.walk(path):
if '.svn' in dirs:
dirs.remove('.svn')
for file in files:
if file.endswith('.php'):
path = os.path.join(root, file)
process_file(path)
if os.path.isdir(path):
process_dir(path)
else:
process_file(path)

View file

@ -147,5 +147,3 @@ function add_bots($bots)
} }
} }
} }
?>

View file

@ -116,5 +116,3 @@ function utf8_normalize_nfkc($strings)
return $strings; return $strings;
} }
?>

View file

@ -54,4 +54,3 @@ echo 'FINISHED';
// Done // Done
$db->sql_close(); $db->sql_close();
?>

View file

@ -309,5 +309,3 @@ else
file_gc(); file_gc();
} }
} }
?>

View file

@ -85,5 +85,3 @@ $template->set_filenames(array(
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer(); page_footer();
?>

View file

@ -1489,6 +1489,3 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base
$item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title']; $item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title'];
} }
} }
?>

View file

@ -80,5 +80,3 @@ class acm extends acm_memory
return apc_delete($this->key_prefix . $var); return apc_delete($this->key_prefix . $var);
} }
} }
?>

View file

@ -117,5 +117,3 @@ class acm extends acm_memory
return eaccelerator_rm($this->key_prefix . $var); return eaccelerator_rm($this->key_prefix . $var);
} }
} }
?>

View file

@ -728,5 +728,3 @@ class acm
return @unlink($filename); return @unlink($filename);
} }
} }
?>

View file

@ -134,5 +134,3 @@ class acm extends acm_memory
return $this->memcache->delete($this->key_prefix . $var); return $this->memcache->delete($this->key_prefix . $var);
} }
} }
?>

View file

@ -435,5 +435,3 @@ class acm_memory
return true; return true;
} }
} }
?>

View file

@ -152,5 +152,3 @@ class acm
return false; return false;
} }
} }
?>

View file

@ -117,5 +117,3 @@ class acm extends acm_memory
return xcache_isset($this->key_prefix . $var); return xcache_isset($this->key_prefix . $var);
} }
} }
?>

View file

@ -1456,5 +1456,3 @@ class acp_attachments
} }
} }
?>

View file

@ -248,5 +248,3 @@ class acp_ban
); );
} }
} }
?>

View file

@ -472,5 +472,3 @@ class acp_bbcodes
); );
} }
} }
?>

View file

@ -985,5 +985,3 @@ class acp_board
} }
} }
?>

View file

@ -414,5 +414,3 @@ class acp_bots
return ($row) ? false : true; return ($row) ? false : true;
} }
} }
?>

View file

@ -144,5 +144,3 @@ class acp_captcha
exit_handler(); exit_handler();
} }
} }
?>

View file

@ -2455,5 +2455,3 @@ function fgetd_seekless(&$fp, $delim, $read, $seek, $eof, $buffer = 8192)
return false; return false;
} }
?>

View file

@ -104,5 +104,3 @@ class acp_disallow
); );
} }
} }
?>

View file

@ -258,5 +258,3 @@ class acp_email
} }
} }
?>

View file

@ -1950,5 +1950,3 @@ class acp_forums
} }
} }
?>

View file

@ -794,5 +794,3 @@ class acp_groups
} }
} }
} }
?>

View file

@ -951,5 +951,3 @@ class acp_icons
return $item_count; return $item_count;
} }
} }
?>

View file

@ -308,5 +308,3 @@ class acp_inactive
$this->page_title = 'ACP_INACTIVE_USERS'; $this->page_title = 'ACP_INACTIVE_USERS';
} }
} }
?>

View file

@ -127,5 +127,3 @@ class acp_jabber
)); ));
} }
} }
?>

View file

@ -1469,5 +1469,3 @@ $lang = array_merge($lang, array(
return $entry; return $entry;
} }
} }
?>

View file

@ -173,5 +173,3 @@ class acp_logs
} }
} }
} }
?>

View file

@ -613,5 +613,3 @@ class acp_main
$this->page_title = 'ACP_MAIN'; $this->page_title = 'ACP_MAIN';
} }
} }
?>

View file

@ -1061,5 +1061,3 @@ class acp_modules
return $this->lang_name($target['module_langname']); return $this->lang_name($target['module_langname']);
} }
} }
?>

View file

@ -567,5 +567,3 @@ class acp_permission_roles
$auth_admin->acl_clear_prefetch(); $auth_admin->acl_clear_prefetch();
} }
} }
?>

View file

@ -1312,5 +1312,3 @@ class acp_permissions
); );
} }
} }
?>

View file

@ -80,5 +80,3 @@ class acp_php_info
$template->assign_var('PHPINFO', $output); $template->assign_var('PHPINFO', $output);
} }
} }
?>

View file

@ -1625,5 +1625,3 @@ class acp_profile
return $sql; return $sql;
} }
} }
?>

View file

@ -462,5 +462,3 @@ class acp_prune
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
} }
?>

View file

@ -236,5 +236,3 @@ class acp_ranks
} }
} }
?>

View file

@ -371,5 +371,3 @@ class acp_reasons
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
} }
?>

View file

@ -625,5 +625,3 @@ class acp_search
return $error; return $error;
} }
} }
?>

View file

@ -86,5 +86,3 @@ class acp_send_statistics
} }
} }
} }
?>

View file

@ -3772,5 +3772,3 @@ parse_css_file = {PARSE_CSS_FILE}
} }
} }
?>

View file

@ -89,5 +89,3 @@ class acp_update
)); ));
} }
} }
?>

View file

@ -2388,5 +2388,3 @@ class acp_users
return ($var & 1 << $user->keyoptions[$key]) ? true : false; return ($var & 1 << $user->keyoptions[$key]) ? true : false;
} }
} }
?>

View file

@ -183,5 +183,3 @@ class acp_words
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
} }
?>

View file

@ -1281,5 +1281,3 @@ class auth_admin extends auth
return true; return true;
} }
} }
?>

View file

@ -36,5 +36,3 @@ class acp_attachments_info
{ {
} }
} }
?>

View file

@ -35,5 +35,3 @@ class acp_ban_info
{ {
} }
} }
?>

View file

@ -33,5 +33,3 @@ class acp_bbcodes_info
{ {
} }
} }
?>

View file

@ -48,5 +48,3 @@ class acp_board_info
{ {
} }
} }
?>

View file

@ -33,6 +33,3 @@ class acp_bots_info
{ {
} }
} }
?>

View file

@ -34,5 +34,3 @@ class acp_captcha_info
{ {
} }
} }
?>

View file

@ -34,5 +34,3 @@ class acp_database_info
{ {
} }
} }
?>

View file

@ -33,6 +33,3 @@ class acp_disallow_info
{ {
} }
} }
?>

View file

@ -33,6 +33,3 @@ class acp_email_info
{ {
} }
} }
?>

View file

@ -33,5 +33,3 @@ class acp_forums_info
{ {
} }
} }
?>

View file

@ -33,5 +33,3 @@ class acp_groups_info
{ {
} }
} }
?>

View file

@ -34,5 +34,3 @@ class acp_icons_info
{ {
} }
} }
?>

View file

@ -33,5 +33,3 @@ class acp_inactive_info
{ {
} }
} }
?>

View file

@ -33,4 +33,3 @@ class acp_jabber_info
{ {
} }
} }
?>

View file

@ -33,5 +33,3 @@ class acp_language_info
{ {
} }
} }
?>

View file

@ -36,5 +36,3 @@ class acp_logs_info
{ {
} }
} }
?>

View file

@ -33,5 +33,3 @@ class acp_main_info
{ {
} }
} }
?>

View file

@ -35,5 +35,3 @@ class acp_modules_info
{ {
} }
} }
?>

View file

@ -36,5 +36,3 @@ class acp_permission_roles_info
{ {
} }
} }
?>

View file

@ -50,5 +50,3 @@ class acp_permissions_info
{ {
} }
} }
?>

View file

@ -33,5 +33,3 @@ class acp_php_info_info
{ {
} }
} }
?>

View file

@ -33,5 +33,3 @@ class acp_profile_info
{ {
} }
} }
?>

View file

@ -34,5 +34,3 @@ class acp_prune_info
{ {
} }
} }
?>

View file

@ -33,5 +33,3 @@ class acp_ranks_info
{ {
} }
} }
?>

View file

@ -33,5 +33,3 @@ class acp_reasons_info
{ {
} }
} }
?>

View file

@ -34,5 +34,3 @@ class acp_search_info
{ {
} }
} }
?>

View file

@ -33,5 +33,3 @@ class acp_send_statistics_info
{ {
} }
} }
?>

View file

@ -36,5 +36,3 @@ class acp_styles_info
{ {
} }
} }
?>

Some files were not shown because too many files have changed in this diff Show more