summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-12-05 01:03:04 -0500
committerCraig Andrews <candrews@integralblue.com>2009-12-05 01:03:04 -0500
commit51f0dd5e37db0e8d2a8690655555d399249942df (patch)
tree33238b09ad63eaefdb2c6499da8bab59d91188ed
parentc08d7f1aa4ac235f524da3994c2f1aef3b0fd079 (diff)
Add configuration option to toggle the indenting of the output HTML. Defaults to indent enabled.
-rw-r--r--actions/twitapisearchatom.php2
-rw-r--r--config.php.sample5
-rw-r--r--lib/action.php2
-rw-r--r--lib/default.php1
-rw-r--r--lib/error.php2
-rw-r--r--lib/htmloutputter.php2
-rw-r--r--lib/rssaction.php2
-rw-r--r--lib/xmloutputter.php5
-rw-r--r--plugins/Facebook/facebookaction.php2
-rw-r--r--plugins/Facebook/facebookutil.php2
10 files changed, 17 insertions, 8 deletions
diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php
index 526ca2ae8..1cb8d7efe 100644
--- a/actions/twitapisearchatom.php
+++ b/actions/twitapisearchatom.php
@@ -71,7 +71,7 @@ class TwitapisearchatomAction extends ApiAction
* @see Action::__construct
*/
- function __construct($output='php://output', $indent=true)
+ function __construct($output='php://output', $indent=null)
{
parent::__construct($output, $indent);
}
diff --git a/config.php.sample b/config.php.sample
index 9fccb84f3..473eb74e2 100644
--- a/config.php.sample
+++ b/config.php.sample
@@ -236,6 +236,11 @@ $config['sphinx']['port'] = 3312;
// Use a different hostname for SSL-encrypted pages
// $config['site']['sslserver'] = 'secure.example.org';
+// Indent HTML and XML
+// Enable (default) for easier to read markup for developers,
+// disable to save some bandwidth.
+// $config['site']['indent'] = true;
+
// If you have a lot of status networks on the same server, you can
// store the site data in a database and switch as follows
// Status_network::setupDB('localhost', 'statusnet', 'statuspass', 'statusnet');
diff --git a/lib/action.php b/lib/action.php
index 8ad391755..87d8a4399 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -68,7 +68,7 @@ class Action extends HTMLOutputter // lawsuit
* @see XMLOutputter::__construct
* @see HTMLOutputter::__construct
*/
- function __construct($output='php://output', $indent=true)
+ function __construct($output='php://output', $indent=null)
{
parent::__construct($output, $indent);
}
diff --git a/lib/default.php b/lib/default.php
index d4ef045ea..db90aeca3 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -53,6 +53,7 @@ $default =
'shorturllength' => 30,
'dupelimit' => 60, # default for same person saying the same thing
'textlimit' => 140,
+ 'indent' => true,
),
'db' =>
array('database' => 'YOU HAVE TO SET THIS IN config.php',
diff --git a/lib/error.php b/lib/error.php
index 3162cfe65..87a4d913b 100644
--- a/lib/error.php
+++ b/lib/error.php
@@ -50,7 +50,7 @@ class ErrorAction extends Action
var $message = null;
var $default = null;
- function __construct($message, $code, $output='php://output', $indent=true)
+ function __construct($message, $code, $output='php://output', $indent=null)
{
parent::__construct($output, $indent);
diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php
index fd448ced5..2091c6e2c 100644
--- a/lib/htmloutputter.php
+++ b/lib/htmloutputter.php
@@ -67,7 +67,7 @@ class HTMLOutputter extends XMLOutputter
* @param boolean $indent Whether to indent output, default true
*/
- function __construct($output='php://output', $indent=true)
+ function __construct($output='php://output', $indent=null)
{
parent::__construct($output, $indent);
}
diff --git a/lib/rssaction.php b/lib/rssaction.php
index d591c99ed..62e3f21b6 100644
--- a/lib/rssaction.php
+++ b/lib/rssaction.php
@@ -52,7 +52,7 @@ class Rss10Action extends Action
* @see Action::__construct
*/
- function __construct($output='php://output', $indent=true)
+ function __construct($output='php://output', $indent=null)
{
parent::__construct($output, $indent);
}
diff --git a/lib/xmloutputter.php b/lib/xmloutputter.php
index 5f06e491d..15b18e7d9 100644
--- a/lib/xmloutputter.php
+++ b/lib/xmloutputter.php
@@ -67,10 +67,13 @@ class XMLOutputter
* @param boolean $indent Whether to indent output, default true
*/
- function __construct($output='php://output', $indent=true)
+ function __construct($output='php://output', $indent=null)
{
$this->xw = new XMLWriter();
$this->xw->openURI($output);
+ if(is_null($indent)) {
+ $indent = common_config('site', 'indent');
+ }
$this->xw->setIndent($indent);
}
diff --git a/plugins/Facebook/facebookaction.php b/plugins/Facebook/facebookaction.php
index c852bbf5e..b090e9bd9 100644
--- a/plugins/Facebook/facebookaction.php
+++ b/plugins/Facebook/facebookaction.php
@@ -44,7 +44,7 @@ class FacebookAction extends Action
var $app_uri = null;
var $app_name = null;
- function __construct($output='php://output', $indent=true, $facebook=null, $flink=null)
+ function __construct($output='php://output', $indent=null, $facebook=null, $flink=null)
{
parent::__construct($output, $indent);
diff --git a/plugins/Facebook/facebookutil.php b/plugins/Facebook/facebookutil.php
index 6f50c173a..2abcbb14e 100644
--- a/plugins/Facebook/facebookutil.php
+++ b/plugins/Facebook/facebookutil.php
@@ -168,7 +168,7 @@ function facebookBroadcastNotice($notice)
function updateProfileBox($facebook, $flink, $notice) {
$fbaction = new FacebookAction($output = 'php://output',
- $indent = true, $facebook, $flink);
+ $indent = null, $facebook, $flink);
$fbaction->updateProfileBox($notice);
}