public function load($filename, $directory, $default) { $data = []; $_ = []; //load extension language default $file = Extension::dirExtension() . '*/*/' . Util::getConfig('environment') . '/language/' . $default . '/' . $filename . '.php'; $file_extensions = glob($file); foreach ($file_extensions as $file_extension) { if (file_exists($file_extension)) { require \Vqmod::modCheck($file_extension); } } $data = array_merge($data, $_); //load extension language $file = Extension::dirExtension() . '*/*/' . Util::getConfig('environment') . '/language/' . $directory . '/' . $filename . '.php'; $file_extensions = glob($file); foreach ($file_extensions as $file_extension) { if (file_exists($file_extension)) { require $file_extension; } } $data = array_merge($data, $_); //load theme language $file_theme = Theme::dirCurrentTheme() . '/language/' . $default . '/' . $filename . '.php'; if (file_exists($file_theme)) { require $file_theme; } $data = array_merge($data, $_); $file_theme = Theme::dirCurrentTheme() . '/language/' . $directory . '/' . $filename . '.php'; if (file_exists($file_theme)) { require $file_theme; } $data = array_merge($data, $_); return $data; }
public function load($file, $filename) { if (file_exists($file)) { $_ = array(); require Vqmod::modCheck($file); $this->data = array_merge($this->data, $_); } else { global $registry; //load extension config $file = DIR_ROOT . $registry->get('config')->get('extension_path') . '/*/app/system/config/' . $filename . '.php'; $file_extensions = glob($file); if (isset($file_extensions[0]) && file_exists($file_extensions[0])) { $_ = array(); require Vqmod::modCheck($file_extensions[0]); $this->data = array_merge($this->data, $_); } else { trigger_error('Error: Could not load config ' . $filename . '!'); exit; } } }
<?php // Version define('VERSION', '2.0.0.0'); // VQMODDED Startup if (ENABLE_VQMOD) { require_once Vqmod::modCheck(DIR_SYSTEM . 'startup.php'); } else { require_once DIR_SYSTEM . 'startup.php'; } // Registry $registry = new Registry(); // Config $config = new Config(); $registry->set('config', $config); // Database $db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE); $registry->set('db', $db); // Settings $query = $db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '0'"); foreach ($query->rows as $setting) { if (!$setting['serialized']) { $config->set($setting['key'], $setting['value']); } else { $config->set($setting['key'], unserialize($setting['value'])); } } // Loader $loader = new Loader($registry); $registry->set('load', $loader); // Url
/** * VqmodObject::_parseMods() * * @param \DOMNode $node <modification> node to be parsed * @return null * @description Parses modifications in preparation for the applyMod method to work */ private function _parseMods(\DOMNode $node) { $files = $node->getElementsByTagName('file'); $replaces = Vqmod::$replaces; foreach ($files as $file) { $path = $file->getAttribute('path') ? $file->getAttribute('path') : ''; $filesToMod = explode(',', $file->getAttribute('name')); foreach ($filesToMod as $filename) { $fileToMod = $path . $filename; if (!empty($replaces)) { foreach ($replaces as $r) { if (count($r) == 2) { $fileToMod = preg_replace($r[0], $r[1], $fileToMod); } } } $error = $file->hasAttribute('error') ? $file->getAttribute('error') : 'log'; $fullPath = Vqmod::path($fileToMod); if ((!$fullPath || !file_exists($fullPath)) && strpos($fileToMod, '*') === false) { $fullPath = DIR_CORE . '/' . $fileToMod; } if (!$fullPath || !file_exists($fullPath)) { if (strpos($fileToMod, '*') !== false) { $fullPath = DIR_CORE . '/' . $fileToMod; } else { if ($error == 'log' || $error == 'abort') { $skip = $error == 'log' ? ' (SKIPPED)' : ' (ABORTING MOD)'; Vqmod::$log->write('VqmodObject::parseMods - Could not resolve path for [' . $fileToMod . ']' . $skip, $this); } if ($error == 'log' || $error == 'skip') { continue; } elseif ($error == 'abort') { return false; } } } $operations = $file->getElementsByTagName('operation'); foreach ($operations as $opIndex => $operation) { Vqmod::$fileModding = $fileToMod . '(' . $opIndex . ')'; $skipOperation = false; $error = $operation->hasAttribute('error') ? $operation->getAttribute('error') : 'abort'; $ignoreif = $operation->getElementsByTagName('ignoreif')->item(0); if ($ignoreif) { $ignoreif = new VQSearchNode($ignoreif); } else { $ignoreif = false; } $search = $operation->getElementsByTagName('search')->item(0); $add = $operation->getElementsByTagName('add')->item(0); if (!$search) { Vqmod::$log->write('Operation <search> tag missing', $this); $skipOperation = true; } if (!$add) { Vqmod::$log->write('Operation <add> tag missing', $this); $skipOperation = true; } if (!$skipOperation) { $this->mods[$fullPath][] = array('search' => new VQSearchNode($search), 'add' => new VQAddNode($add), 'ignoreif' => $ignoreif, 'error' => $error, 'fileToMod' => $fileToMod, 'opIndex' => $opIndex); } } Vqmod::$fileModding = false; } } }