You are here

function csstidy_print::formatted_page in Advanced CSS/JS Aggregation 7

Same name and namespace in other branches
  1. 6 advagg_css_compress/csstidy/class.csstidy_print.inc \csstidy_print::formatted_page()

Returns the formatted CSS code to make a complete webpage

@access public @version 1.4

Parameters

string $doctype shorthand for the document type:

bool $externalcss indicates whether styles to be attached internally or as an external stylesheet:

string $title title to be added in the head of the document:

string $lang two-letter language code to be added to the output:

Return value

string

File

advagg_css_compress/csstidy/class.csstidy_print.inc, line 123

Class

csstidy_print
CSS Printing class

Code

function formatted_page($doctype = 'xhtml1.1', $externalcss = true, $title = '', $lang = 'en') {
  switch ($doctype) {
    case 'xhtml1.0strict':
      $doctype_output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
			"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
      break;
    case 'xhtml1.1':
    default:
      $doctype_output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
				"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
      break;
  }
  $output = $cssparsed = '';
  $this->output_css_plain =& $output;
  $output .= $doctype_output . "\n" . '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $lang . '"';
  $output .= $doctype === 'xhtml1.1' ? '>' : ' lang="' . $lang . '">';
  $output .= "\n<head>\n    <title>{$title}</title>";
  if ($externalcss) {
    $output .= "\n    <style type=\"text/css\">\n";
    $cssparsed = file_get_contents('cssparsed.css');
    $output .= $cssparsed;

    // Adds an invisible BOM or something, but not in css_optimised.php
    $output .= "\n</style>";
  }
  else {
    $output .= "\n" . '    <link rel="stylesheet" type="text/css" href="cssparsed.css" />';

    //			}
  }
  $output .= "\n</head>\n<body><code id=\"copytext\">";
  $output .= $this
    ->formatted();
  $output .= '</code>' . "\n" . '</body></html>';
  return $this->output_css_plain;
}