本文整理汇总了PHP中VQMod类的典型用法代码示例。如果您正苦于以下问题:PHP VQMod类的具体用法?PHP VQMod怎么用?PHP VQMod使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VQMod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modelFromDirectory
/**
* Allows loading from a specified directory instead of DIR_APPLICATION
*
* @param $model
* @param $directory
* @throws Exception when file was not found
*/
private function modelFromDirectory($model, $directory)
{
if (!$directory) {
$directory = DIR_APPLICATION;
}
$file = $directory . '/model/' . $model . '.php';
$class = 'Model' . preg_replace('/[^a-zA-Z0-9]/', '', $model);
if (file_exists($file)) {
if (class_exists('VQMod')) {
include_once VQMod::modCheck(modification($file), $file);
} else {
include_once $file;
}
$this->registry->set('model_' . str_replace('/', '_', $model), new $class($this->registry));
} else {
throw new Exception('Model not found', 404);
}
}
示例2: execute
private function execute($action)
{
if (method_exists($action, 'getFile')) {
if (file_exists($action->getFile())) {
require_once VQMod::modCheck($action->getFile());
$class = $action->getClass();
$controller = new $class($this->registry);
if (is_callable(array($controller, $action->getMethod()))) {
$action = call_user_func_array(array($controller, $action->getMethod()), $action->getArgs());
} else {
$action = $this->error;
$this->error = '';
}
} else {
$action = $this->error;
$this->error = '';
}
} else {
$result = $action->execute($this->registry);
if (is_object($result)) {
$action = $result;
} elseif ($result === false) {
$action = $this->error;
$this->error = '';
} else {
$action = false;
}
}
return $action;
}
示例3: vqmod_resolve
public function vqmod_resolve($file)
{
if (class_exists('VQMod')) {
$is_static = false;
$folder = dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'vqmod' . DIRECTORY_SEPARATOR;
$vqmod_file_contents = file_get_contents($folder . 'vqmod.php');
$is_static = stripos($vqmod_file_contents, 'public static function modCheck') !== FALSE;
if ($is_static) {
$file = VQMod::modCheck($file);
} else {
$vqmod = new VQMod();
$file = $vqmod->modCheck($file);
unset($vqmod);
}
}
return $file;
}
示例4: autoload
function autoload($class)
{
$file = DIR_SYSTEM . 'library/' . str_replace('\\', '/', strtolower($class)) . '.php';
if (is_file($file)) {
include_once VQMod::modCheck(modification($file), $file);
return true;
}
return false;
}
示例5: __construct
public function __construct($driver, $hostname, $username, $password, $database)
{
if (file_exists(DIR_DATABASE . $driver . '.php')) {
require_once VQMod::modCheck(DIR_DATABASE . $driver . '.php');
} else {
exit('Error: Could not load database file ' . $driver . '!');
}
$this->driver = new $driver($hostname, $username, $password, $database);
}
示例6: query
public function query($sql)
{
require_once VQMod::modCheck(DIR_SYSTEM . 'nitro/config.php');
require_once VQMod::modCheck(DIR_SYSTEM . 'nitro/core/core.php');
$nitroPersistence = getNitroPersistence();
if (!empty($nitroPersistence['Nitro']['Enabled']) && $nitroPersistence['Nitro']['Enabled'] == 'yes' && !empty($nitroPersistence['Nitro']['DBCache']['Enabled']) && $nitroPersistence['Nitro']['DBCache']['Enabled'] == 'yes') {
$nitro_matches = array();
$nitro_match = false;
// Product COUNT Queries
if (!empty($nitroPersistence['Nitro']['DBCache']['ProductCountQueries']) && $nitroPersistence['Nitro']['DBCache']['ProductCountQueries'] == 'yes') {
$nitro_match = preg_match('~SELECT.*COUNT\\(.*FROM.*[^0-9a-zA-Z_]' . DB_PREFIX . '(product)([\\s]|$)~i', $sql, $nitro_matches);
}
// Category COUNT Queries
if (!$nitro_match && !empty($nitroPersistence['Nitro']['DBCache']['CategoryCountQueries']) && $nitroPersistence['Nitro']['DBCache']['CategoryCountQueries'] == 'yes') {
$nitro_match = preg_match('~SELECT.*COUNT\\(.*FROM.*[^0-9a-zA-Z_]' . DB_PREFIX . '(category)([\\s]|$)~i', $sql, $nitro_matches);
}
// Category Queries
if (!$nitro_match && !empty($nitroPersistence['Nitro']['DBCache']['CategoryQueries']) && $nitroPersistence['Nitro']['DBCache']['CategoryQueries'] == 'yes') {
$nitro_match = preg_match('~SELECT.*FROM.*[^0-9a-zA-Z_]' . DB_PREFIX . '(category)([\\s]|$)~i', $sql, $nitro_matches);
}
// SEO URLs Queries
if (!$nitro_match && !empty($nitroPersistence['Nitro']['DBCache']['SeoUrls']) && $nitroPersistence['Nitro']['DBCache']['SeoUrls'] == 'yes') {
$nitro_match = preg_match('~SELECT.*FROM.*[^0-9a-zA-Z_]' . DB_PREFIX . '(url_alias)([\\s]|$)~i', $sql, $nitro_matches);
}
// Search Queries
if (!$nitro_match && !empty($nitroPersistence['Nitro']['DBCache']['Search']) && $nitroPersistence['Nitro']['DBCache']['Search'] == 'yes') {
$nitro_match = preg_match('~SELECT.*WHERE.*(LIKE|MATCH)~i', $sql, $nitro_matches);
if ($nitro_match) {
$nitro_match = false;
if (!empty($nitroPersistence['Nitro']['DBCache']['SearchKeywords'])) {
$nitro_keywords = explode(",", $nitroPersistence['Nitro']['DBCache']['SearchKeywords']);
foreach ($nitro_keywords as $nitro_keyword) {
if (stripos(trim($nitro_keyword), $sql) !== FALSE) {
$nitro_match = true;
break;
}
}
}
}
}
if ($nitro_match) {
require_once VQMod::modCheck(DIR_SYSTEM . 'nitro/core/dbcache.php');
$nitro_cache_selector = strtolower($nitro_matches[1]) . '.' . md5($sql);
// category.6ef5cee93ce985fe9de730a1d837455d
$nitro_result = getNitroDBCache($nitro_cache_selector);
if ($nitro_result !== FALSE) {
return $nitro_result;
}
}
}
if (!empty($nitro_cache_selector)) {
$nitro_db_result = $this->driver->query($sql);
setNitroDBCache($nitro_cache_selector, $nitro_db_result);
return $nitro_db_result;
}
return $this->driver->query($sql);
}
示例7: _autoloadController
private static function _autoloadController($class)
{
preg_match_all('/((?:^|[A-Z])[a-z]+)/', $class, $matches);
if (isset($matches[0][1]) && isset($matches[0][2])) {
$file = DIR_APPLICATION . 'controller/' . strtolower($matches[0][1]) . '/' . strtolower($matches[0][2]) . '.php';
if (file_exists($file)) {
require_once VQMod::modCheck(VQMod::modCheck($file));
}
}
}
示例8: helper
public function helper($helper)
{
$file = DIR_SYSTEM . 'helper/' . str_replace('../', '', (string) $helper) . '.php';
if (file_exists($file)) {
include_once VQMod::modCheck(modification($file), $file);
} else {
trigger_error('Error: Could not load helper ' . $file . '!');
exit;
}
}
开发者ID:phucsystem,项目名称:sannhaonline,代码行数:10,代码来源:vq2-system_storage_modification_system_engine_loader.php
示例9: helper
public function helper($helper)
{
$file = DIR_SYSTEM . 'helper/' . $helper . '.php';
if (file_exists($file)) {
include_once VQMod::modCheck($file);
} else {
trigger_error('Error: Could not load helper ' . $file . '!');
exit;
}
}
示例10: autoload
function autoload($class)
{
$file = DIR_SYSTEM . 'library/' . str_replace('\\', '/', strtolower($class)) . '.php';
if (file_exists($file)) {
include VQMod::modCheck(modification($file));
return true;
} else {
return false;
}
}
示例11: __construct
public function __construct($driver, $hostname, $username, $password, $database)
{
$file = DIR_DATABASE . $driver . '.php';
if (file_exists($file)) {
require_once VQMod::modCheck($file);
$class = 'DB' . $driver;
$this->driver = new $class($hostname, $username, $password, $database);
} else {
exit('Error: Could not load database driver type ' . $driver . '!');
}
}
示例12: load
public function load($filename)
{
$file = DIR_CONFIG . $filename . '.php';
if (file_exists($file)) {
$_ = array();
require VQMod::modCheck($file);
$this->data = array_merge($this->data, $_);
} else {
trigger_error('Error: Could not load config ' . $filename . '!');
exit;
}
}
示例13: database
public function database($driver, $hostname, $username, $password, $database)
{
$file = DIR_SYSTEM . 'database/' . $driver . '.php';
$class = 'Database' . preg_replace('/[^a-zA-Z0-9]/', '', $driver);
if (file_exists($file)) {
include_once VQMod::modCheck($file);
$this->registry->set(str_replace('/', '_', $driver), new $class($hostname, $username, $password, $database));
} else {
trigger_error('Error: Could not load database ' . $driver . '!');
exit;
}
}
示例14: modCheck
public static function modCheck($file)
{
global $vqmod;
if (class_exists('VQMod')) {
if (isset($vqmod) && is_object($vqmod)) {
return $vqmod->modCheck($file);
}
if (isset(VQMod::$_vqversion)) {
return VQMod::modCheck($file);
}
}
return $file;
}
示例15: load
public function load($filename)
{
$_ = array();
$file = DIR_LANGUAGE . $this->default . '/' . $filename . '.php';
if (file_exists($file)) {
require VQMod::modCheck($file);
}
$file = DIR_LANGUAGE . $this->directory . '/' . $filename . '.php';
if (file_exists($file)) {
require VQMod::modCheck($file);
}
$this->data = array_merge($this->data, $_);
return $this->data;
}