function readmeta($modfile) { $metadata = array(); $meta = get_filemeta($this->path . $modfile); if ($meta) { $lines = explode("\n", substr($meta, 1)); foreach ($lines as $line) { preg_match("/^(?:[\\s\\*]*?\\b([^@\\*\\/]*))/", $line, $match); if (!empty($match[1])) { $data[] = $match[1]; } preg_match("/^(?:[\\s\\*]*?@([^\\*\\/]+?)\\s(.+))/", $line, $match); if (!empty($match[1]) && !empty($match[2])) { $tags[$match[1]] = $match[2]; } } $module = new stdClass(); $module->file = $modfile; $module->name = $data[0]; $module->description = !empty($data[1]) ? $data[1] : ""; $module->tags = $tags; return $module; } return false; }
function scan_gateway_meta($file) { $metadata = array(); $meta = get_filemeta($file); if ($meta) { $lines = explode("\n", substr($meta, 1)); foreach ($lines as $line) { preg_match("/^(?:[\\s\\*]*?\\b([^@\\*\\/]*))/", $line, $match); if (!empty($match[1])) { $data[] = $match[1]; } preg_match("/^(?:[\\s\\*]*?@([^\\*\\/]+?)\\s(.+))/", $line, $match); if (!empty($match[1]) && !empty($match[2])) { $tags[$match[1]] = $match[2]; } } $gateway = new stdClass(); $gateway->file = $file; $gateway->name = $data[0]; $gateway->description = !empty($data[1]) ? $data[1] : ""; $gateway->tags = $tags; $gateway->activated = false; if ($this->Settings->get('payment_gateway') == $file) { $module->activated = true; } return $gateway; } return false; }