#!/usr/bin/php ]*)>)(.*)()#imsU'; $pregForm = '##imsU'; $pregAtts = '#(\w+)="(gettext):\'(.*)\'"#imsU'; while( ( $file = $dh->read() ) !== false ) { if( $file[0] == '.' ) { continue; } if( is_dir( $tmplDir . '/' . $file ) ) { continue; } if( !preg_match( '/(.*)(\.[f]?tmpl)$/i', $file, $match ) ) { continue; } $basename = $match[1]; $tmpl = $match[0]; $phpNls = $basename . '.php'; echo " $file "; $html = file_get_contents( $tmplDir . '/' . $tmpl ); /* if( !preg_match_all( $preg, $html, $match, PREG_SET_ORDER ) ) { // nothing to replace // wbDebugger::printMsg(); echo "no patTemplate:gettext found\n"; } else { echo count( $match ) . " strings\n"; } */ if( !preg_match_all( $pregForm, $html, $match, PREG_SET_ORDER ) ) { // nothing to replace // wbDebugger::printMsg(); echo "no patForms:gettext found\n"; } else { foreach( $match as $m ) { $atts = $m[2]; echo "atts: $atts\n"; if( preg_match_all( $pregAtts, $atts, $attMatch, PREG_SET_ORDER ) ) { $gettext = stripslashes( $attMatch[3] ); } } } /* $tmplVarFormat = str_replace( '/', '_', $basename ) . '_%04d'; $phpCode = array(); array_push( $phpCode, '' ); $phpCode = implode( "\n", $phpCode ); $phpFh = fopen( $tmplDir . '/' . $phpNls, 'w' ); if( !$phpFh ) { wbDebugger::printMsg(); echo "Could not open " . $phpNls . "for writing\n"; exit; } fwrite( $phpFh, $phpCode ); fclose( $phpFh ); */ } exit; wbDebugger::printMsg(); ?>