$phpfile ) { array_push( $filenames, strtolower( basename( $php_key ) ) ); } foreach ( $other_files as $php_key => $phpfile ) { array_push( $filenames, strtolower( basename( $php_key ) ) ); } foreach ( $css_files as $php_key => $phpfile ) { array_push( $filenames, strtolower( basename( $php_key ) ) ); } $blacklist = array( 'thumbs.db' => __( 'Windows thumbnail store', 'theme-check' ), 'desktop.ini' => __( 'windows system file', 'theme-check' ), 'project.properties' => __( 'NetBeans Project File', 'theme-check' ), 'project.xml' => __( 'NetBeans Project File', 'theme-check' ), '\.kpf' => __( 'Komodo Project File', 'theme-check' ), '^\.+[a-zA-Z0-9]' => __( 'Hidden Files or Folders', 'theme-check' ), 'php.ini' => __( 'PHP server settings file', 'theme-check' ), 'dwsync.xml' => __( 'Dreamweaver project file', 'theme-check' ), 'error_log' => __( 'PHP error log', 'theme-check' ), 'web.config' => __( 'Server settings file', 'theme-check' ), '\.sql' => __( 'SQL dump file', 'theme-check' ), '__MACOSX' => __( 'OSX system file', 'theme-check' ), '\.lubith' => __( 'Lubith theme generator file', 'theme-check' ), ); $musthave = array( 'index.php', 'style.css' ); $rechave = array( 'readme.txt' => __( 'Please see Theme_Documentation for more information.', 'theme-check' ) ); checkcount(); foreach( $blacklist as $file => $reason ) { if ( $filename = preg_grep( '/' . $file . '/', $filenames ) ) { $error = implode( array_unique( $filename ), ' ' ); $this->error[] = sprintf(''.__('WARNING','theme-check').': '.__('%1$s %2$s found.', 'theme-check'), '' . $error . '', $reason) ; $ret = false; } } foreach( $musthave as $file ) { if ( !in_array( $file, $filenames ) ) { $this->error[] = sprintf(''.__('WARNING','theme-check').': '.__('Could not find the file %s in the theme.', 'theme-check'), '' . $file . '' ); $ret = false; } } foreach( $rechave as $file => $reason ) { if ( !in_array( $file, $filenames ) ) { $this->error[] = sprintf(''.__('RECOMMENDED','theme-check').': '.__('Could not find the file %1$s in the theme. %2$s', 'theme-check'), '' . $file . '', $reason ); } } return $ret; } function getError() { return $this->error; } } $themechecks[] = new File_Checks;