curType = $type;
}
return $type;
}
function getParsers($file){
if(substr_count($file, 'DetailView.html') > 0 || substr_count($file, 'EditView.html' ) > 0) return array('default'=>'StudioParser', array('StudioParser', 'StudioRowParser'));
if(substr_count($file, 'ListView.html' ) > 0) return array('default'=>'XTPLListViewParser', array('XTPLListViewParser'));
return array('default'=>'StudioParser', array('StudioParser'));
}
function parseRows($str){
preg_match_all("'(
]*)>(.*?)(
]*>)'si", $str, $this->rows,PREG_SET_ORDER);
}
function parseNames($str){
$results = array();
preg_match_all("'name[ ]*=[ ]*[\'\"]+([a-zA-Z0-9\_]+)[\'\"]+'si", $str, $results,PREG_SET_ORDER);
return $results;
}
function parseLabels($str){
$mod = array();
$app = array();
preg_match_all("'\{MOD\.([a-zA-Z0-9\_]+)\}'si", $str, $mod,PREG_SET_ORDER);
preg_match_all("'\{APP\.([a-zA-Z0-9\_]+)\}'si", $str, $app,PREG_SET_ORDER);
return array_merge($app, $mod);
}
function getMaxPosition(){
$max = 0;
for($i = 0; $i < count($this->positions) ; $i++){
if($this->positions[$i][2] >= $max){
$max = $this->positions[$i][2] + 1;
}
}
return $max;
}
function parsePositions($str, $output= false) {
$results = array();
preg_match_all("']*sugar=[\'\"]+([a-zA-Z\_]*)([0-9]+)([b]*)[\'\"]+[^>]*>(.*?)'si", $str, $results, PREG_SET_ORDER);
if($output){
return $results;
}
$this->positions = $results;
}
function parseCols($str){
preg_match_all("'(]*?)>(.*?)( | ]*?>)'si", $str, $this->cols,PREG_SET_ORDER);
}
function parse($str){
$this->parsePositions($str);
}
function positionCount($str) {
$result = array ();
return preg_match_all("']*sugar=[\'\"]+([a-zA-Z\_]*)([0-9]+)([b]*)[\'\"]+[^>]*>(.*?)'si", $str, $result, PREG_SET_ORDER)/2;
}
function rowCount($str) {
$result = array ();
return preg_match_all("'(]*>)(.*?)(
]*>)'si", $str, $result);
}
function loadFile($file) {
$this->curFile = $file;
$this->curText = file_get_contents($file);
$this->form = <<