Add configuration option to toggle the indenting of the output HTML. Defaults to indent enabled.

This commit is contained in:
Craig Andrews 2009-12-05 01:03:04 -05:00
parent c08d7f1aa4
commit 51f0dd5e37
10 changed files with 17 additions and 8 deletions

View File

@ -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);
}

View File

@ -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');

View File

@ -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);
}

View File

@ -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',

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}