function basis($index = NULL) { $basisConfig = array(); foreach (C('penetration.basis') as $row) { $basisConfig[] = $row['@']; } return is_null($index) ? $basisConfig : addBasisParts($basisConfig[$index]['name']); }
if (!isset($params['f'])) { print "No input file given\n"; usage(basename(__FILE__)); } $dir = dirname(__FILE__); $parts = array(); foreach (qw2('p>periods b>basis r>groups') as $code => $function) { if (!isset($params[$code])) { continue; } $parts = array_merge($parts, $function($params[$code])); } if (count($parts) > 0) { $parts = addBase($parts); if (isset($parts['basis'])) { $parts = array_merge($parts, addBasisParts($parts['basis'])); } if (isset($parts['level'])) { $parts = array_merge($parts, addLevelParts($parts['level'])); } $data = file_get_contents($dir . '/' . $params['f']); foreach ($parts as $k => $v) { $data = preg_replace("/%" . strtoupper($k) . "%/", $v, $data); } print $data; } function periods($index = NULL) { $periods = C('penetration.periods.period'); if (isset($periods['@'])) { $periods = array($periods['@']);