function html2xhtml($html)
{
    process_pagebreak_commands($html);
    // Remove SCRIPT tags from the page being processed, as script content may
    // mess the firther html-parsing utilities
    $html = process_script($html);
    // Remove STYLE tags for the same reason and store them in the temporary variable
    // later they will be added back to HEAD section
    $styles = process_style($html);
    // Convert HTML character references to their Unicode analogues
    process_character_references($html);
    remove_comments($html);
    fix_attrs_spaces($html);
    $html = quote_attrs($html);
    $html = escape_attrs_entities($html);
    $html = lowercase_tags($html);
    $html = lowercase_closing_tags($html);
    $html = fix_closing_tags($html);
    $html = close_tag("area", $html);
    $html = close_tag("base", $html);
    $html = close_tag("basefont", $html);
    $html = close_tag("br", $html);
    $html = close_tag("col", $html);
    $html = close_tag("embed", $html);
    $html = close_tag("frame", $html);
    $html = close_tag("hr", $html);
    $html = close_tag("img", $html);
    $html = close_tag("input", $html);
    $html = close_tag("isindex", $html);
    $html = close_tag("link", $html);
    $html = close_tag("meta", $html);
    $html = close_tag("param", $html);
    $html = make_attr_value("checked", $html);
    $html = make_attr_value("compact", $html);
    $html = make_attr_value("declare", $html);
    $html = make_attr_value("defer", $html);
    $html = make_attr_value("disabled", $html);
    $html = make_attr_value("ismap", $html);
    $html = make_attr_value("multiple", $html);
    $html = make_attr_value("nohref", $html);
    $html = make_attr_value("noresize", $html);
    $html = make_attr_value("noshade", $html);
    $html = make_attr_value("nowrap", $html);
    $html = make_attr_value("readonly", $html);
    $html = make_attr_value("selected", $html);
    $html = process_html($html);
    $html = process_body($html);
    $html = process_head($html);
    $html = process_p($html);
    $html = escape_amp($html);
    $html = escape_lt($html);
    $html = escape_gt($html);
    $html = escape_textarea_content($html);
    process_tables($html, 0);
    process_lists($html, 0);
    process_deflists($html, 0);
    process_selects($html, 0);
    $html = fix_tags($html);
    $html = fix_attrs($html);
    $html = insert_styles($html, $styles);
    return $html;
}
Exemple #2
0
/**
* Removes "/* style" as well as "# style" comments from $input.
*
* @param string $input		Input string
*
* @return string			Input string with comments removed
*/
function phpbb_remove_comments($input)
{
    if (!function_exists('remove_comments')) {
        global $phpbb_root_path, $phpEx;
        require $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
    }
    // Remove /* */ comments
    remove_comments($input);
    // Remove # style comments
    remove_remarks($input);
    return $input;
}
/**
*  Function: loadFiles()
*  Param: $file -> The name of the file to load
*  
*  
*/
function loadFiles($file)
{
    global $script, $loaded, $loadDir;
    $arr = explode(',', $file);
    foreach ($arr as $fileN) {
        $fileN = trim($fileN);
        if (!in_array($fileN, $loaded)) {
            $loaded[] = $fileN;
            echo "Loaded File: " . $fileN . " -> ";
            $file = str_replace(pack("CCC", 0xef, 0xbb, 0xbf), "", file_get_contents($loadDir . '/' . $fileN));
            if (!preg_match('/min\\./', $fileN)) {
                $result = JSMinPlus::minify($file);
                //				$result = JSMin::minify($file);
                if ($result === false) {
                    return remove_comments($file);
                } else {
                    echo "OK!\n";
                    return $result;
                }
            } else {
                echo "Pass\n";
                return remove_comments($file);
            }
        }
    }
}
Exemple #4
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', '../v2/logs/error.log');
include '../v2/configs/settings.php';
include 'sql.class.php';
echo '<div id="help">In this step a database will be created and data, needed for the basic functioning of the site will be inserted. If an error occurs, please try pressing check, otherwise continue to the next step.</div>';
echo '%#%#%';
$link = new mysqli(__DB_SERVER__, __DB_USER__, __DB_PASSWORD__, __DB_DATABASE__);
$link->set_charset(__ENCODING__);
if ($link->connect_errno) {
    printf("Connect failed: %s<br/>", $link->mysqli_error);
    exit;
}
$dbms_schema = 'database.sql';
$sql_query = @fread(@fopen($dbms_schema, 'r'), @filesize($dbms_schema));
$sql_query = remove_remarks($sql_query);
$sql_query = remove_comments($sql_query);
$sql_query = split_sql_file($sql_query, ';');
foreach ($sql_query as $query) {
    if (!$link->query($query)) {
        printf("Error: %s<br/>", $link->error);
    }
}
echo "0";
function process_commands(&$string_to_process, &$camos_return_data)
{
    //First, handle replace function as special case.  full depth of inserts should be evaluated prior
    //to evaluating other functions in final string assembly.
    $replace_finished = FALSE;
    while (!$replace_finished) {
        if (preg_match_all("/\\/\\*\\s*replace\\s*::.*?\\*\\//", $string_to_process, $matches)) {
            foreach ($matches[0] as $val) {
                $comm = preg_replace("/(\\/\\*)|(\\*\\/)/", "", $val);
                $comm_array = split('::', $comm);
                //array where first element is command and rest are args
                $replacement_item = trim($comm_array[1]);
                //this is the item name to search for in the database.  easy.
                $replacement_text = '';
                $query = "SELECT content FROM form_CAMOS_item WHERE item like '" . $replacement_item . "'";
                $statement = sqlStatement($query);
                if ($result = sqlFetchArray($statement)) {
                    $replacement_text = $result['content'];
                }
                $replacement_text = formDataCore($replacement_text);
                $string_to_process = str_replace($val, $replacement_text, $string_to_process);
            }
        } else {
            $replace_finished = TRUE;
        }
    }
    //date_add is a function to add a given number of days to the date of the current encounter
    //this will be useful for saving templates of prescriptions with 'do not fill until' dates
    //I am going to implement with mysql date functions.
    //I am putting this before other functions just like replace function because it is replacing text
    //needs to be here.
    if (preg_match("/\\/\\*\\s*date_add\\s*::\\s*(.*?)\\s*\\*\\//", $string_to_process, $matches)) {
        $to_replace = $matches[0];
        $days = $matches[1];
        $query = "select date_format(date_add(date, interval {$days} day),'%W, %m-%d-%Y') as date from form_encounter where " . "pid = " . $_SESSION['pid'] . " and encounter = " . $_SESSION['encounter'];
        $statement = sqlStatement($query);
        if ($result = sqlFetchArray($statement)) {
            $string_to_process = str_replace($to_replace, $result['date'], $string_to_process);
        }
    }
    if (preg_match("/\\/\\*\\s*date_sub\\s*::\\s*(.*?)\\s*\\*\\//", $string_to_process, $matches)) {
        $to_replace = $matches[0];
        $days = $matches[1];
        $query = "select date_format(date_sub(date, interval {$days} day),'%W, %m-%d-%Y') as date from form_encounter where " . "pid = " . $_SESSION['pid'] . " and encounter = " . $_SESSION['encounter'];
        $statement = sqlStatement($query);
        if ($result = sqlFetchArray($statement)) {
            $string_to_process = str_replace($to_replace, $result['date'], $string_to_process);
        }
    }
    //end of special case of replace function
    $return_value = 0;
    $camos_return_data = array();
    // to be filled with additional camos form submissions if any embedded
    $command_array = array();
    //to be filled with potential commands
    $matches = array();
    //to be filled with potential commands
    if (!preg_match_all("/\\/\\*.*?\\*\\//s", $string_to_process, $matches)) {
        return $return_value;
    }
    $command_array = $matches[0];
    foreach ($command_array as $val) {
        //process each command
        $comm = preg_replace("/(\\/\\*)|(\\*\\/)/", "", $val);
        $comm_array = split('::', $comm);
        //array where first element is command and rest are args
        //Here is where we process particular commands
        if (trim($comm_array[0]) == 'billing') {
            array_shift($comm_array);
            //couldn't do it in 'if' or would lose element 0 for next if
            //insert data into the billing table, see, easy!
            $type = trim(array_shift($comm_array));
            $code = trim(array_shift($comm_array));
            $text = trim(array_shift($comm_array));
            $modifier = trim(array_shift($comm_array));
            $units = trim(array_shift($comm_array));
            //make default units 1 if left blank - bm
            if ($units == '') {
                $units = 1;
            }
            $fee = sprintf("%01.2f", trim(array_shift($comm_array)));
            //make default fee 0.00 if left blank
            if ($fee == '') {
                $fee = sprintf("%01.2f", '0.00');
            }
            //in function call 'addBilling' note last param is the remainder of the array.  we will look for justifications here...
            addBilling2($encounter, $type, $code, $text, $modifier, $units, $fee, $comm_array);
        }
        if (trim($comm_array[0]) == 'appt') {
            array_shift($comm_array);
            $days = trim(array_shift($comm_array));
            $time = trim(array_shift($comm_array));
            addAppt($days, $time);
        }
        if (trim($comm_array[0]) == 'vitals') {
            array_shift($comm_array);
            $weight = trim(array_shift($comm_array));
            $height = trim(array_shift($comm_array));
            $systolic = trim(array_shift($comm_array));
            $diastolic = trim(array_shift($comm_array));
            $pulse = trim(array_shift($comm_array));
            $temp = trim(array_shift($comm_array));
            addVitals($weight, $height, $systolic, $diastolic, $pulse, $temp);
        }
        $command_count = 0;
        if (trim($comm_array[0]) == 'camos') {
            $command_count++;
            //data to be submitted as separate camos forms
            //this is for embedded prescriptions, test orders etc... usually within a soap note or something
            //data collected here will be returned so that save.php can give it special treatment and insert
            //into the database after the main form data is submitted so it will be in a sensible order
            array_push($camos_return_data, array("category" => trim($comm_array[1]), "subcategory" => trim($comm_array[2]), "item" => trim($comm_array[3]), "content" => trim($comm_array[4])));
        }
    }
    $string_to_process = remove_comments($string_to_process);
    return $return_value;
}
Exemple #6
0
} else {
    $inputSource = 'input';
    file_put_contents($file, $_POST['input']);
    $originalLength = filesize($file);
}
if ($originalLength == 0) {
    $originalLength = 1;
}
$originalFile = 'results/testing.txt';
file_put_contents($originalFile, file_get_contents($file));
// Actions. Not sure about what the best order is?
if ($_POST['removeWhiteSpace']) {
    remove_whitespace($file);
}
if ($_POST['removeComments']) {
    remove_comments($file);
}
?>

  <div class="grid-container">
    <section class="grid-parent grid-100">
      <div class="grid-100">
        <div class="header grid-40 push-30">
          <a href="index.php">
            <h1><span>CSS</span> OPTIMIZER</h1>
            <p>Let's get that CSS tidied up, shall we?</p>
          </a>
        </div>
      </div>

      <div class="grid-100">