Skip to content

Instantly share code, notes, and snippets.

@Pross
Created January 3, 2011 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pross/763539 to your computer and use it in GitHub Desktop.
Save Pross/763539 to your computer and use it in GitHub Desktop.
<?php
class NewLineCheck implements themecheck {
protected $error = array();
function check( $php_files, $css_files, $other_files) {
$ret = true;
foreach ($php_files as $name => $content) {
checkcount();
if ( preg_match('/\?>[\r\n]+^[\r\n]+<\?php/m',$content, $matches) ) {
$filename = tc_filename( $name );
if ( $filename === 'functions.php' ) {
$this->error[] = "<span class='tc-lead tc-warning'>WARNING</span>: new line <strong>{$filename}</strong> file.";
$ret = false;
}
}
}
// return the pass/fail
return $ret;
}
function getError() { return $this->error; }
}
$themechecks[] = new NewLineCheck;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment