if ( $handler = @opendir( $tplsadmin_autoupdate_path . '/' ) ) {
    while ( false !== ( $file = readdir( $handler ) ) ) {
        $file_path = $tplsadmin_autoupdate_path . '/' . $file;

        if ( is_file( $file_path ) && '.tpl' == substr( $file, - 5 ) ) {