\s*$#is', '', $file); } //var_dump( preg_match('#(include|require|include_once|require_once)\s*\(?\s*(["\'])(.+)\\2;#', $out_contents, $matches), $matches); //First, Replace includes. $out_contents = preg_replace_callback('#(?Warning: ' . $filename . ' does not exist

'; return ''; } $file = _strip_php_openers(file_get_contents($filename)); //Next, Replace WP_DEBUG with QI_DEBUG in WORDPRESS FILES ONLY if ( strpos($filename, 'wp-files') !== false ) $file = str_replace('WP_DEBUG', 'QI_DEBUG', $file); $file = preg_replace_callback('#(?gzuncompress(), base64_decode and eval() to be available. Your current hosting does not allow one or more of these functions. Please try a Minified Build instead.');\n"; //TODO: Eval doesnt seem to play nice here. } //file_put_contents('release/installer-nonminimised.php', 'r' . $revision . ''; unset($r_parts); } $out_contents = str_replace('/*BuildDate*/', $date, $out_contents); $out_contents = str_replace('/*BuildRevision*/', $revision, $out_contents); //Remove any 'RemoveMe' blocks $out_contents = preg_replace('!(/\*BuildRemoveStart\*/.+?/\*BuildRemoveEnd\*/)!is', '', $out_contents); //Remove non-needed Build* markers. $out_contents = str_replace( array('/*BuildIgnoreInclude*/'), '', $out_contents); //Next, Remove any whitespace thats not needed from within PHP code $in_field = false; $in_php = true; $oca = preg_split('||', $out_contents, -1, PREG_SPLIT_NO_EMPTY); $count = count($oca); $unset = array(); for ( $i = 0; $i < $count; $i++) { $value = $oca[$i]; //PHP Block is starting again. if ( true !== $in_php && substr($out_contents, $i, strlen('' ) { $i++; $in_php = $i; continue; } if ( true !== $in_php ) continue; //End of an enclosed string if ( $value === $in_field && ($oca[$i-1] != '\\' || $oca[$i-2] == '\\') ) { //TODO well we bettter remove any whitespace around any html tags in the values IMO..... $in_field = false; continue; } if ( $in_field ) continue; //detect start of enclosed string. if ( in_array($value, array('"', "'")) ) { $in_field = $value; continue; } $is_whitespace = $in_php && preg_match('|^\s+$|', $value); if ( $is_whitespace ) { //Make sure theres some whitespace after PHP lang items. foreach ( array('50?50:$i), 50)) ) { $i++; array_pop($unset); continue; } //Need whitespace around 'extends' in class declaration if ( preg_match('|class.+ extends$|', substr($out_contents, $i - ($i>50?50:$i), 50)) ) { $i += 1; array_pop($unset); continue; } } if ( $is_whitespace ) $unset[] = $i; } foreach ( $unset as $i ) unset($oca[$i]); $out_contents = implode('', $oca); unset($in_field, $oca, $count, $unset); //Next, Strip Whitespace from the HTML in the file: $in_html = false; $count = strlen($out_contents); for ( $i = 0; $i < $count; $i++) { //PHP Block is starting again. if ( $in_html && substr($out_contents, $i, 5) == '\s+<|m', '><', $test_string1); if ( $test_string1 != $test_string2 ) { $out_contents = substr($out_contents, 0, $in_html) . $test_string2 . substr($out_contents, $i+1); $count = strlen($out_contents); $i = $in_html; //Reset back to start. } $in_html = false; } //HTML Block has ended. if ( !$in_html && $out_contents{$i} == '?' && $out_contents{$i+1} == '>' ) { $i++; $in_html = $i; } //TODO Add a branch here to strip it out when its inside a PHP string.. } //file_put_contents('release/installer-uncompressed.php', '