From 04ef1ba8eee7a9e2a565d7b4b747ef607665d562 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 23 Dec 2008 14:33:23 -0500 Subject: change function headers to K&R style Another huge change, for PEAR code standards compliance. Function headers have to be in K&R style (opening brace on its own line), instead of having the opening brace on the same line as the function and parameters. So, a little perl magic found all the function definitions and move the opening brace to the next line (properly indented... usually). darcs-hash:20081223193323-84dde-a28e36ecc66672c783c2842d12fc11043c13ab28.gz --- scripts/sitemap.php | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'scripts/sitemap.php') diff --git a/scripts/sitemap.php b/scripts/sitemap.php index b49bfe2a5..504783e88 100644 --- a/scripts/sitemap.php +++ b/scripts/sitemap.php @@ -18,7 +18,8 @@ index_map(); # ------------------------------------------------------------------------------ # Generate index sitemap of all other sitemaps. -function index_map() { +function index_map() +{ global $output_paths; $output_dir = $output_paths['output_dir']; $output_url = $output_paths['output_url']; @@ -40,7 +41,8 @@ function index_map() { } # Generate sitemap of standard site elements. -function standard_map() { +function standard_map() +{ global $output_paths; $standard_map_urls .= url( @@ -77,7 +79,8 @@ function standard_map() { } # Generate sitemaps of all notices. -function notices_map() { +function notices_map() +{ global $output_paths; $notices = DB_DataObject::factory('notice'); @@ -115,7 +118,8 @@ function notices_map() { } # Generate sitemaps of all users. -function user_map() { +function user_map() +{ global $output_paths; $users = DB_DataObject::factory('user'); @@ -208,7 +212,8 @@ function user_map() { # ------------------------------------------------------------------------------ # Generate a element. -function url($url_args) { +function url($url_args) +{ $url = preg_replace('/&/', '&', $url_args['url']); # escape ampersands for XML $lastmod = $url_args['lastmod']; $changefreq = $url_args['changefreq']; @@ -238,7 +243,8 @@ function url($url_args) { return $url_out; } -function sitemap($sitemap_args) { +function sitemap($sitemap_args) +{ $url = preg_replace('/&/', '&', $sitemap_args['url']); # escape ampersands for XML $lastmod = $sitemap_args['lastmod']; @@ -259,7 +265,8 @@ function sitemap($sitemap_args) { } # Generate a element. -function urlset($urlset_text) { +function urlset($urlset_text) +{ $urlset = '' . "\n" . '' . "\n" . $urlset_text . @@ -269,7 +276,8 @@ function urlset($urlset_text) { } # Generate a element. -function sitemapindex($sitemapindex_text) { +function sitemapindex($sitemapindex_text) +{ $sitemapindex = '' . "\n" . '' . "\n" . $sitemapindex_text . @@ -279,7 +287,8 @@ function sitemapindex($sitemapindex_text) { } # Generate a sitemap from an array containing elements and write it to a file. -function array_to_map($url_list, $filename_prefix) { +function array_to_map($url_list, $filename_prefix) +{ global $output_paths; if ($url_list) { @@ -297,7 +306,8 @@ function array_to_map($url_list, $filename_prefix) { # ------------------------------------------------------------------------------ # Parse command line arguments. -function parse_args() { +function parse_args() +{ $args = getopt('f:d:u:'); if (is_null($args[f]) && is_null($args[d]) && is_null($args[u])) { @@ -338,7 +348,8 @@ function parse_args() { } # Ensure paths end with a "/". -function trailing_slash($path) { +function trailing_slash($path) +{ if (preg_match('/\/$/', $path) == 0) { $path .= '/'; } @@ -347,7 +358,8 @@ function trailing_slash($path) { } # Write data to disk. -function write_file($path, $data) { +function write_file($path, $data) +{ if (is_null($path)) { error('No path specified for writing to.'); } elseif (is_null($data)) { @@ -364,7 +376,8 @@ function write_file($path, $data) { } # Display an error message and exit. -function error ($error_msg) { +function error ($error_msg) +{ if (is_null($error_msg)) { $error_msg = 'error() was called without any explanation!'; } -- cgit v1.2.3-54-g00ecf