本文整理汇总了PHP中_root::getConfigVar方法的典型用法代码示例。如果您正苦于以下问题:PHP _root::getConfigVar方法的具体用法?PHP _root::getConfigVar怎么用?PHP _root::getConfigVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_root
的用法示例。
在下文中一共展示了_root::getConfigVar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* constructeur
* @access public
* @param array tableau a verifier ($_POST,tableau de la row...)
*/
public function __construct($tPost)
{
$this->tPost = $tPost;
$sClass = _root::getConfigVar('check.class', 'plugin_check');
$this->oCheck = new $sClass();
$this->bCheck = true;
}
示例2: generate
private function generate($sTable, $tField)
{
$tNewField = array('id');
foreach ($tField as $sField) {
if (trim($sField) == '') {
continue;
}
$tNewField[] = trim($sField);
}
$sStructure = implode(';', $tNewField);
$oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json');
if (!$oDir->exist()) {
$oDir->save();
}
$oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json/base');
if (!$oDir->exist()) {
$oDir->save();
}
$oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json/base/' . $sTable . '');
if (!$oDir->exist()) {
$oDir->save();
}
$sPath = _root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json/base/' . $sTable . '/';
$oFile = new _file($sPath . 'structure.csv');
$oFile->setContent($sStructure);
$oFile->save();
$sPath = _root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json/base/' . $sTable . '/';
$oFile = new _file($sPath . 'max.txt');
$oFile->setContent(1);
$oFile->save();
}
示例3: regenerateIndexXml
public function regenerateIndexXml($sConfig, $sTable, $sIndex)
{
//$sConfig='xml';
if (_root::getConfigVar('db.' . $sConfig . '.sgbd') == 'xml') {
if (!file_exists(_root::getConfigVar('db.' . $sConfig . '.database'))) {
$sBuilderDbPath = _root::getConfigVar('path.data') . 'genere/' . _root::getParam('id') . '/public/' . _root::getConfigVar('db.' . $sConfig . '.database');
if (file_exists($sBuilderDbPath)) {
_root::setConfigVar('db.' . $sConfig . '.database', $sBuilderDbPath);
} else {
throw new Exception('Base inexistante ' . _root::getConfigVar('db.' . $sConfig . '.database') . ' ni ' . $sBuilderDbPath);
}
}
} else {
if (_root::getConfigVar('db.' . $sConfig . '.sgbd') == 'csv') {
if (!file_exists(_root::getConfigVar('db.' . $sConfig . '.database'))) {
$sBuilderDbPath = _root::getConfigVar('path.data') . 'genere/' . _root::getParam('id') . '/public/' . _root::getConfigVar('db.' . $sConfig . '.database');
if (file_exists($sBuilderDbPath)) {
_root::setConfigVar('db.' . $sConfig . '.database', $sBuilderDbPath);
} else {
throw new Exception('Base inexistante ' . _root::getConfigVar('db.' . $sConfig . '.database') . ' ni ' . $sBuilderDbPath);
}
}
}
}
$oModelFactory = new model_mkfbuilderfactory();
$oModelFactory->setConfig($sConfig);
return $oModelFactory->getSgbd()->generateIndexForTable($sTable, $sIndex);
}
示例4: _new
public function _new()
{
if (_root::getRequest()->isPost()) {
$sProject = _root::getParam('projet');
if (isset($_POST['opt']) and $_POST['opt'] == 'withexamples') {
model_mkfbuilderprojet::getInstance()->create(_root::getParam('projet'));
self::getTools()->updateLayoutTitle(_root::getParam('projet'));
} else {
if (isset($_POST['opt']) and $_POST['opt'] == 'withBootstrap') {
model_mkfbuilderprojet::getInstance()->createEmpty($sProject);
//copy bootstrap
model_mkfbuilderprojet::getInstance()->copyFromTo('data/sources/fichiers/layout/bootstrap.php', 'data/genere/' . $sProject . '/layout/bootstrap.php');
//update title
self::getTools()->updateFile(_root::getParam('projet'), array('examplesite' => $sProject), 'layout/bootstrap.php');
//update layout
self::getTools()->updateFile(_root::getParam('projet'), array('template1' => 'bootstrap'), 'module/default/main.php');
} else {
model_mkfbuilderprojet::getInstance()->createEmpty(_root::getParam('projet'));
self::getTools()->updateLayoutTitle(_root::getParam('projet'));
}
}
_root::redirect('builder::list');
}
$oTpl = new _tpl('builder::new');
$oTpl->iswritable = is_writable(_root::getConfigVar('path.generation'));
$this->oLayout->add('main', $oTpl);
}
示例5: __construct
/**
* constructeur
* @access public
* @param string $sToken
*/
public function __construct()
{
$this->sSalt = 'fdsfA34T679hjfdsAfef';
$this->iLifetime = _root::getConfigVar('security.xsrf.timeout.lifetime');
$this->bUseSession = _root::getConfigVar('security.xsrf.session.enabled', 0);
$this->sSessionVar = 'xsrfTokenArray';
}
示例6: getImg
/**
* retourne le code html d'une image
* @access public
* @param string $sSrc path de l'image, par defaut utilisera le path.img configure dans conf/site.php
* @param string $sAlt texte alternatif
* @param array $tOption tableau contenant autant d'options a ajouter
* array('style'=>'border:1px') >> <img style="border:1px"...
* @return string retourne le code html de l'image
*/
public function getImg($sSrc, $sAlt = null, $tOption = null)
{
if ($sAlt == null) {
$sAlt = $sSrc;
}
$sOptions = $this->getOptionFromTab($tOption);
return '<img src="' . _root::getConfigVar('path.img') . $sSrc . '" title="' . $sAlt . '" ' . $sOptions . '/>';
}
示例7: load
private function load($sId)
{
if ($this->_toFile and isset($this->_toFile[$sId])) {
return;
}
$oFile = new _file(_root::getConfigVar('path.cache') . $sId . '.cachevar');
$this->_toFile[$sId] = $oFile;
}
示例8: load
/**
* charge le fichier de langue situe dans la section [path], valeur de i18n
* @access public static
* @param string $sLang (doit etre present dans le fichier de config [language] allow separer par des virgules
*/
public static function load($sLang)
{
$tAllowed = preg_split('/,/', _root::getConfigVar('language.allow'));
if (!in_array($sLang, $tAllowed) and $sLang != _root::getConfigVar('language.default')) {
throw new Exception('Lang not allowed, list allow:' . _root::getConfigVar('language.allow'));
}
include_once _root::getConfigVar('path.i18n') . $sLang . '.php';
self::$tLangue = _root::getConfigVar('tLangue');
}
示例9: getSgbd
/**
* @access public static
* @return object sgbd
*/
public function getSgbd()
{
$bFirst = false;
if ($this->_sClassSgbd == null) {
$sVarIniConfig = _root::getConfigVar('model.ini.var', 'db');
$tClassSgbd = _root::getConfigVar($sVarIniConfig);
if (!$tClassSgbd) {
$sMsg = 'Il vous manque un fichier de configuration';
$sMsg .= ' ou le bloc de configuration [' . $sVarIniConfig . '] concernant la connexion' . "\n";
$sMsg .= '
Exemple:
[' . $sVarIniConfig . ']
mysql.dsn="mysql:dbname=blog;host=localhost"
mysql.sgbd=pdo_mysql
mysql.hostname=localhost
mysql.database=blog
mysql.username=root
mysql.password=pass
';
throw new Exception($sMsg);
}
$this->_sClassSgbd = 'sgbd_' . $tClassSgbd[$this->sConfig . '.sgbd'];
$bFirst = true;
if (substr($this->_sClassSgbd, 0, 8) == 'sgbd_pdo') {
$sClassPath = _root::getConfigVar('path.lib') . 'sgbd/pdo/' . $this->_sClassSgbd . '.php';
} elseif (substr($this->_sClassSgbd, 0, 5) == 'sgbd_') {
$sClassPath = _root::getConfigVar('path.lib') . 'sgbd/' . $this->_sClassSgbd . '.php';
}
if (!file_exists($sClassPath)) {
$oDirPdo = new _dir(_root::getConfigVar('path.lib') . 'sgbd/pdo/');
$tListPdo = $oDirPdo->getListFile();
$tPlus = array('Liste driver pdo:');
foreach ($tListPdo as $oFile) {
$tPlus[] = '-' . $oFile->getName();
}
$sListePdo = implode("\n", $tPlus);
$oDir = new _dir(_root::getConfigVar('path.lib') . 'sgbd/');
$tList = $oDir->getListFile();
$tPlus = array('Liste driver autre:');
foreach ($tList as $oFile) {
$tPlus[] = '-' . $oFile->getName();
}
$sListeAutre = implode("\n", $tPlus);
throw new Exception('Pas de driver ' . $this->_sClassSgbd . ' (' . $sClassPath . ')' . "\n" . $sListePdo . "\n" . $sListeAutre);
}
}
$this->_oSgbd = call_user_func(array($this->_sClassSgbd, 'getInstance'), $this->sConfig);
if ($bFirst) {
$this->_oSgbd->setConfig($tClassSgbd);
}
return $this->_oSgbd;
}
示例10: _connect
/**
* @access public
*/
public function _connect()
{
//on regenere un nouvel id de session
session_regenerate_id(true);
$this->_bConnected = true;
$_SESSION['ip'] = sha1($_SERVER['REMOTE_ADDR']);
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$_SESSION['userAgent'] = sha1($_SERVER['HTTP_USER_AGENT']);
} else {
$_SESSION['userAgent'] = sha1('noUserAgent');
}
if ((int) _root::getConfigVar('auth.session.timeout.enabled') == 1) {
$_SESSION['timeout'] = time() + (int) _root::getConfigVar('auth.session.timeout.lifetime');
}
}
示例11: _index
public function _index()
{
module_builder::getTools()->rootAddConf('conf/connexion.ini.php');
$tConnexion = _root::getConfigVar('db');
$tSqlite = array();
foreach ($tConnexion as $sConfig => $val) {
if (substr($val, 0, 6) == 'sqlite') {
$tSqlite[substr($sConfig, 0, -4)] = $val;
}
}
$msg = '';
$detail = '';
if ($this->isPost()) {
$sDbFilename = _root::getParam('sDbFilename');
$sTable = _root::getParam('sTable');
$tField = _root::getParam('tField');
$tType = _root::getParam('tType');
$tSize = _root::getParam('tSize');
try {
$oDb = new PDO($sDbFilename);
} catch (PDOException $exception) {
die($exception->getMessage());
}
$oDb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sSql = 'CREATE TABLE IF NOT EXISTS ' . $sTable . '(';
$sSql .= 'id INTEGER PRIMARY KEY AUTOINCREMENT';
foreach ($tField as $i => $sField) {
$sSql .= ',';
$sSql .= $sField . ' ' . $tType[$i];
if ($tType[$i] == 'VARCHAR') {
$sSql .= '(' . $tSize[$i] . ')';
}
}
$sSql .= ')';
try {
$oDb->exec($sSql);
} catch (PDOException $exception) {
die($exception->getMessage());
}
$msg = trR('baseTableGenereAvecSucces', array('#maTable#' => $sTable, '#listField#' => implode(',', $tField)));
$detail = trR('creationFichier', array('#FICHIER#' => ' sqlite ' . $sDbFilename));
}
$oTpl = $this->getView('index');
$oTpl->msg = $msg;
$oTpl->detail = $detail;
$oTpl->tSqlite = $tSqlite;
return $oTpl;
}
示例12: _index
public function _index()
{
module_builder::getTools()->rootAddConf('conf/connexion.ini.php');
$tConnexion = _root::getConfigVar('db');
$tSqlite = array();
foreach ($tConnexion as $sConfig => $val) {
if (substr($val, 0, 6) == 'sqlite') {
$tSqlite[substr($sConfig, 0, -4)] = $val;
}
}
$msg = '';
$detail = '';
if (_root::getRequest()->isPost()) {
$sDbFilename = _root::getParam('sDbFilename');
$sTable = _root::getParam('sTable');
$tField = _root::getParam('tField');
$tType = _root::getParam('tType');
$tSize = _root::getParam('tSize');
try {
$oDb = new PDO($sDbFilename);
} catch (PDOException $exception) {
die($exception->getMessage());
}
$oDb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sSql = 'CREATE TABLE IF NOT EXISTS ' . $sTable . '(';
$sSql .= 'id INTEGER PRIMARY KEY AUTOINCREMENT';
foreach ($tField as $i => $sField) {
$sSql .= ',';
$sSql .= $sField . ' ' . $tType[$i];
if ($tType[$i] == 'VARCHAR') {
$sSql .= '(' . $tSize[$i] . ')';
}
}
$sSql .= ')';
try {
$oDb->exec($sSql);
} catch (PDOException $exception) {
die($exception->getMessage());
}
$msg = 'Table ' . $sTable . ' (champs: ' . implode(',', $tField) . ') généré avec succès';
$detail = 'Création du fichier sqlite ' . $sDbFilename;
}
$oTpl = new _Tpl('moduleSqlite::index');
$oTpl->msg = $msg;
$oTpl->detail = $detail;
$oTpl->tSqlite = $tSqlite;
return $oTpl;
}
示例13: _simple
public function _simple()
{
$msg = '';
$detail = '';
list($msg, $detail) = $this->processSimple();
module_builder::getTools()->rootAddConf('conf/connexion.ini.php');
$oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/model/');
$tFile = array();
$tRowMethodes = array();
$tModule = module_builder::getTools()->getListModule();
foreach ($oDir->getListFile() as $oFile) {
if (preg_match('/.sample.php/', $oFile->getName()) or !preg_match('/.php$/', $oFile->getName())) {
continue;
}
$tFile[] = $oFile->getName();
require_once $oFile->getAdresse();
$sClassFoo = substr($oFile->getName(), 0, -4);
$oModelFoo = new $sClassFoo();
if (method_exists($oModelFoo, 'getSelect')) {
$tRowMethodes[substr($oFile->getName(), 0, -4)] = substr($oFile->getName(), 0, -4) . '::getSelect()';
}
}
$oTpl = new _Tpl('moduleViewForm::simple');
if (_root::getParam('class') != '') {
$sClass = substr(_root::getParam('class'), 0, -4);
require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php';
$tColumn = module_builder::getTools()->getListColumnFromClass($sClass);
$oTpl->sClass = $sClass;
$sId = null;
$tId = module_builder::getTools()->getIdTabFromClass($sClass);
foreach ($tColumn as $i => $sColumn) {
if (in_array($sColumn, $tId)) {
unset($tColumn[$i]);
$sId = $sColumn;
}
}
$oTpl->tColumn = $tColumn;
$oTpl->sId = $sId;
$oTpl->tRowMethodes = $tRowMethodes;
$oModel = new $sClass();
}
$oTpl->msg = $msg;
$oTpl->detail = $detail;
$oTpl->tFile = $tFile;
$oTpl->tModule = $tModule;
return $oTpl;
}
示例14: _project
public function _project()
{
$bBootstrap = 0;
if (file_exists('data/genere/' . _root::getParam('id') . '/layout/bootstrap.php')) {
$bBootstrap = 1;
}
if ($bBootstrap) {
$tType = array('all', 'bootstrap');
} else {
$tType = array('all', 'normal');
}
$sLang = _root::getConfigVar('language.default');
$tLinkModule = array();
foreach ($tType as $sType) {
$sPathModule = _root::getConfigVar('path.module') . '/mods/' . $sType;
$tModulesAll = scandir($sPathModule);
foreach ($tModulesAll as $sModule) {
if (file_exists($sPathModule . '/' . $sModule . '/info.ini')) {
$tIni = parse_ini_file($sPathModule . '/' . $sModule . '/info.ini');
$priority = 999;
if (isset($tIni['priority'])) {
$priority = $tIni['priority'];
}
$sPriority = sprintf('%03d', $priority);
$tLinkModule[$tIni['category']][$tIni['title.' . $sLang] . ' <sup>version ' . $tIni['version'] . '</sup>'] = $sPriority . 'mods_' . $sType . '_' . $sModule . '::index';
}
}
}
//$tModules=scandir(_root::getConfigVar('path.module')).'/mods/normal';
$tTitle = array('market', 'coucheModel', 'modules', 'modulesEmbedded', 'views', 'databasesEmbedded', 'unitTest');
$tLink = array();
foreach ($tTitle as $sTitle) {
if (isset($tLinkModule[$sTitle])) {
$tLinkModuleCat = $tLinkModule[$sTitle];
asort($tLinkModuleCat);
$tLink[tr('menu_' . $sTitle)] = 'title';
foreach ($tLinkModuleCat as $sLabel => $sLink) {
$tLink[$sLabel] = substr($sLink, 3);
}
}
}
$oTpl = $this->getView('project');
$oTpl->tLink = $tLink;
return $oTpl;
}
示例15: autoload
public static function autoload($sClass)
{
$tab = preg_split('/_/', $sClass);
if ($sClass[0] == '_') {
include _root::getConfigVar('path.lib') . 'class' . $sClass . '.php';
} else {
if (in_array($tab[0], array('plugin', 'model', 'abstract'))) {
include _root::getConfigVar('path.' . $tab[0]) . $sClass . '.php';
} else {
if ($tab[0] == 'module') {
if (count($tab) == 2 or _root::getConfigVar('module.folder.organized', 0) == 0) {
include _root::getConfigVar('path.module') . substr($sClass, 7) . '/main.php';
} else {
unset($tab[0]);
include _root::getConfigVar('path.module') . implode('/', $tab) . '/main.php';
}
} else {
if ($tab[0] == 'row') {
include _root::getConfigVar('path.model') . 'model_' . substr($sClass, 4) . '.php';
} else {
if ($tab[0] == 'sgbd' and in_array($tab[1], array('syntax', 'pdo'))) {
include _root::getConfigVar('path.lib') . 'sgbd/' . $tab[1] . '/' . $sClass . '.php';
} else {
if ($tab[0] == 'sgbd') {
include _root::getConfigVar('path.lib') . 'sgbd/' . $sClass . '.php';
//definissez ici votre regle de chargement
//ici, si la classe debute par my_, on la cherche dans ../myClass
} else {
if (substr($sClass, 0, 3) == 'my_') {
//on inclut la classe en tronquant my_
//exple: my_metier => ../myClass/metier.php
include '../myClasses/' . substr($sClass, 3) . '.php';
} else {
return false;
}
}
}
}
}
}
}
}