function createPluginTable($pluginName) { requireComponent('LZ.PHP.XMLStruct'); $xmls = new XMLStruct; if (!$xmls->openFile(ROOT . '/plugins/'. $pluginName .'/index.xml')) return ''; if ($xmls->doesExist('/plugin/storage')) { foreach ($xmls->selectNodes('/plugin/storage/table') as $table) { $storageMappings = array(); $storageKeymappings = array(); if(empty($table['name'][0]['.value'])) continue; $tableName = htmlspecialchars($table['name'][0]['.value']); if (!empty($table['fields'][0]['field'])) { foreach($table['fields'][0]['field'] as $field) { if (!isset($field['name'])) continue; // Error? maybe loading fail, so skipping is needed. $fieldName = $field['name'][0]['.value']; if (!isset($field['attribute'])) continue; // Error? maybe loading fail, so skipping is needed. $fieldAttribute = $field['attribute'][0]['.value']; $fieldLength = isset($field['length']) ? $field['length'][0]['.value'] : -1; $fieldIsNull = isset($field['isnull']) ? $field['isnull'][0]['.value'] : 1; $fieldDefault = isset($field['default']) ? $field['default'][0]['.value'] : null; $fieldAutoIncrement = isset($field['autoincrement']) ? $field['autoincrement'][0]['.value'] : 0; array_push($storageMappings, array('name' => $fieldName, 'attribute' => $fieldAttribute, 'length' => $fieldLength, 'isnull' => $fieldIsNull, 'default' => $fieldDefault, 'autoincrement' => $fieldAutoIncrement)); } } if (!empty($table['key'][0]['.value'])) { foreach($table['key'] as $key) { array_push($storageKeymappings, $key['.value']); } } plugin::treatPluginTable($pluginName, $tableName,$storageMappings,$storageKeymappings, $version); unset($tableName); unset($storageMappings); unset($storageKeymappings); } } }