本文整理汇总了PHP中oxConfig::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP oxConfig::getInstance方法的具体用法?PHP oxConfig::getInstance怎么用?PHP oxConfig::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oxConfig
的用法示例。
在下文中一共展示了oxConfig::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_insert_oxid_newbasketitem
/**
* Smarty plugin
* -------------------------------------------------------------
* File: insert.oxid_newbasketitem.php
* Type: string, html
* Name: newbasketitem
* Purpose: Used for tracking in econda, etracker etc.
* -------------------------------------------------------------
*
* @param array $params params
* @param Smarty &$smarty clever simulation of a method
*
* @return string
*/
function smarty_insert_oxid_newbasketitem($params, &$smarty)
{
$myConfig = oxConfig::getInstance();
$aTypes = array('0' => 'none', '1' => 'message', '2' => 'popup', '3' => 'basket');
$iType = $myConfig->getConfigParam('iNewBasketItemMessage');
// If corect type of message is expected
if ($iType && $params['type'] && $params['type'] != $aTypes[$iType]) {
return '';
}
//name of template file where is stored message text
$sTemplate = $params['tpl'] ? $params['tpl'] : 'inc_newbasketitem.snippet.tpl';
//allways render for ajaxstyle popup
$blRender = $params['ajax'] && $iType == 2;
//fetching article data
$oNewItem = oxSession::getVar('_newitem');
$oBasket = oxSession::getInstance()->getBasket();
if ($oNewItem) {
// loading article object here because on some system passing article by session couses problems
$oNewItem->oArticle = oxNew('oxarticle');
$oNewItem->oArticle->Load($oNewItem->sId);
// passing variable to template with unique name
$smarty->assign('_newitem', $oNewItem);
// deleting article object data
oxSession::deleteVar('_newitem');
$blRender = true;
}
// returning generated message content
if ($blRender) {
return $smarty->fetch($sTemplate);
}
}
示例2: testGetSandbox
/**
* Testing that the right sandbox value is returned.
*/
public function testGetSandbox()
{
$oxConfig = oxConfig::getInstance();
$sandbox = $oxConfig->getShopConfVar('bzSandbox', $oxConfig->getShopId, oxConfig::OXMODULE_MODULE_PREFIX . 'bz_barzahlen');
$oView = new bz_barzahlen_payment();
$this->assertEquals($sandbox, $oView->getSandbox());
}
示例3: smarty_insert_oxid_nocache
/**
* Smarty plugin
* -------------------------------------------------------------
* File: insert.oxid_nocache.php
* Type: string, html
* Name: oxid_nocache
* Purpose: Inserts Items not cached
* -------------------------------------------------------------
*
* @param array $params params
* @param Smarty &$smarty clever simulation of a method
*
* @return string
*/
function smarty_insert_oxid_nocache($params, &$smarty)
{
$myConfig = oxConfig::getInstance();
$smarty->caching = false;
/* if( isset( $smarty->oxobject->oProduct))
$smarty->assign_by_ref( "product", $smarty->oxobject->oProduct);*/
// #1184M - specialchar search
$sSearchParamForHTML = oxConfig::getParameter("searchparam");
$sSearchParamForLink = rawurlencode(oxConfig::getParameter("searchparam", true));
if ($sSearchParamForHTML) {
$smarty->assign_by_ref("searchparamforhtml", $sSearchParamForHTML);
$smarty->assign_by_ref("searchparam", $sSearchParamForLink);
}
$sSearchCat = oxConfig::getParameter("searchcnid");
if ($sSearchCat) {
$smarty->assign_by_ref("searchcnid", rawurldecode($sSearchCat));
}
foreach (array_keys($params) as $key) {
$viewData =& $params[$key];
$smarty->assign_by_ref($key, $viewData);
}
$sOutput = $smarty->fetch($params['tpl']);
$smarty->caching = false;
return $sOutput;
}
示例4: onActivate
/**
* Setup routine
*/
public static function onActivate()
{
if (class_exists('oxRegistry')) {
$myConfig = oxRegistry::getConfig();
} else {
$myConfig = oxConfig::getInstance()->getConfig();
}
$bIsEE = $myConfig->getEdition() === "EE";
try {
$db = oxDb::getDb();
// create oxjson groups
if ($bIsEE) {
$maxRRId = intval($db->getOne("select MAX(OXRRID) from oxgroups"));
$nextRRId = $maxRRId + 1;
$sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1, OXRRID) VALUES ('oxjsonro', '1', 'OXJSON Read-only', 'OXJSON Read-only', '{$nextRRId}');";
$db->Execute($sQ);
$nextRRId++;
$sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1, OXRRID) VALUES ('oxjsonfull', '1', 'OXJSON Full', 'OXJSON Full', '{$nextRRId}');";
$db->Execute($sQ);
} else {
$sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1) VALUES ('oxjsonro', '1', 'OXJSON Read-only', 'OXJSON Read-only');";
$db->Execute($sQ);
$nextRRId++;
$sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1) VALUES ('oxjsonfull', '1', 'OXJSON Full', 'OXJSON Full');";
$db->Execute($sQ);
}
} catch (Exception $ex) {
error_log("Error activating module: " . $ex->getMessage());
}
}
示例5: _getStrHandler
/**
* Non static getter returning str handler. The sense of getStr() and _getStrHandler() is
* to be possible to call this method statically ( oxStr::getStr() ), yet leaving the
* possibility to extend it in modules by overriding _getStrHandler() method.
*
* @return object
*/
protected function _getStrHandler()
{
if (oxConfig::getInstance()->isUtf() && function_exists('mb_strlen')) {
return oxNew("oxStrMb");
}
return oxNew("oxStrRegular");
}
示例6: convertToUtf
public function convertToUtf($value)
{
if (!oxConfig::getInstance()->isUtf()) {
$value = utf8_decode($value);
}
return $value;
}
示例7: checkWriteAccess
/**
* Basic access check for writing data, checks for same shopid, should be overridden if field oxshopid does not exist
*
* @param oxBase $oObj loaded shop object
* @param array $aData fields to be written, null for default
*
* @throws Exception on now access
*
* @return null
*/
public function checkWriteAccess($oObj, $aData = null)
{
return;
$myConfig = oxConfig::getInstance();
if (!$myConfig->getConfigParam('blMallUsers')) {
parent::checkWriteAccess($oObj, $aData);
}
}
示例8: log
/**
* log the given message
*
* @param string $message
* @param string $debuginfo
*/
public function log($message, $debuginfo)
{
if (oxConfig::getInstance()->getShopConfVar('PAYMILL_ACTIVATE_LOGGING')) {
$logging = oxNew('paymill_logging');
$logging->assign(array('identifier' => oxSession::getInstance()->getVar('paymill_identifier'), 'debug' => $debuginfo, 'message' => $message, 'date' => date('Y-m-d H:i:s', oxUtilsDate::getInstance()->getTime())));
$logging->save();
}
}
示例9: _writeHeader
protected function _writeHeader($data)
{
$sFileName = $this->_getFileName();
$this->_writeFile($data, $sFileName);
$sFileUrl = oxConfig::getInstance()->getShopUrl() . 'modules/debugax/tmp/file/' . $sFileName . '.json';
header('filedebug :' . $sFileUrl);
return true;
}
示例10: checkWriteAccess
/**
* check for write access for id
*
* @param oxBase $oObj loaded shop object
* @param array $aData fields to be written, null for default
*
* @throws Exception on now access
*
* @return null
*/
public function checkWriteAccess($oObj, $aData = null)
{
return;
if ($oObj->oxorderarticles__oxordershopid->value != oxConfig::getInstance()->getShopId()) {
throw new Exception(oxERPBase::$ERROR_USER_NO_RIGHTS);
}
parent::checkWriteAccess($oObj, $aData);
}
示例11: getPassword
public function getPassword()
{
if (!$this->isBackendUser) {
return parent::getPassword();
}
$oConfig = class_exists('oxRegistry') ? \oxRegistry::getConfig() : \oxConfig::getInstance();
return $oConfig->getConfigParam('sSwFFAdminPassword');
}
示例12: getConfig
/**
* Starts shop framework and returns config instance
*
* @return oxconfig
*/
function getConfig()
{
// custom functions file
include_once getShopBasePath() . 'modules/functions.php';
// Generic utility method file
include_once getShopBasePath() . 'core/oxfunctions.php';
// initializes singleton config class
return oxConfig::getInstance();
}
示例13: smarty_function_oxstyle
/**
* Smarty plugin
* -------------------------------------------------------------
* File: function.oxstyle.php
* Type: string, html
* Name: oxstyle
* Purpose: Collect given css files. but include them only at the top of the page.
*
* Add [{oxstyle include="oxid.css"}] to include local css file.
* Add [{oxstyle include="oxid.css?20120413"}] to include local css file with query string part.
* Add [{oxstyle include="http://www.oxid-esales.com/oxid.css"}] to include externall css file.
*
* IMPORTANT!
* Do not forget to add plain [{oxstyle}] tag where you need to output all collected css includes.
* -------------------------------------------------------------
*
* @param array $params params
* @param Smarty &$smarty clever simulation of a method
*
* @return string
*/
function smarty_function_oxstyle($params, &$smarty)
{
$myConfig = oxConfig::getInstance();
$sSufix = $smarty->_tpl_vars["__oxid_include_dynamic"] ? '_dynamic' : '';
$sCtyles = 'conditional_styles' . $sSufix;
$sStyles = 'styles' . $sSufix;
$aCtyles = (array) $myConfig->getGlobalParameter($sCtyles);
$aStyles = (array) $myConfig->getGlobalParameter($sStyles);
$sOutput = '';
if ($params['include']) {
$sStyle = $params['include'];
if (!preg_match('#^https?://#', $sStyle)) {
// Separate query part #3305.
$aStyle = explode('?', $sStyle);
$sStyle = $aStyle[0] = $myConfig->getResourceUrl($aStyle[0], $myConfig->isAdmin());
// psCDN | start
// note: changes in core-files is normally not the right way, but in this case the best ;-)
$sShopCssURL = $myConfig->getConfigParam('sShopURLPsCss');
$sShopURL = $myConfig->getConfigParam('sShopURL');
if (!empty($sShopCssURL)) {
$sStyle = str_replace($sShopURL, $sShopCssURL . '/', $sStyle);
}
// psCDN | end
// Append query part if still needed #3305.
if ($sStyle && count($aStyle) > 1) {
$sStyle .= '?' . $aStyle[1];
}
}
// File not found ?
if (!$sStyle) {
if ($myConfig->getConfigParam('iDebug') != 0) {
$sError = "{oxstyle} resource not found: " . htmlspecialchars($params['include']);
trigger_error($sError, E_USER_WARNING);
}
return;
}
// Conditional comment ?
if ($params['if']) {
$aCtyles[$sStyle] = $params['if'];
$myConfig->setGlobalParameter($sCtyles, $aCtyles);
} else {
$aStyles[] = $sStyle;
$aStyles = array_unique($aStyles);
$myConfig->setGlobalParameter($sStyles, $aStyles);
}
} else {
foreach ($aStyles as $sSrc) {
$sOutput .= '<link rel="stylesheet" type="text/css" href="' . $sSrc . '">' . PHP_EOL;
}
foreach ($aCtyles as $sSrc => $sCondition) {
$sOutput .= '<!--[if ' . $sCondition . ']><link rel="stylesheet" type="text/css" href="' . $sSrc . '"><![endif]-->' . PHP_EOL;
}
}
return $sOutput;
}
示例14: smarty_function_oxeval
/**
* Smarty function
* -------------------------------------------------------------
* Purpose: eval given string
* add [{ oxeval var="..." }] where you want to display content
* -------------------------------------------------------------
*
* @param array $aParams parameters to process
* @param smarty &$oSmarty smarty object
*
* @return string
*/
function smarty_function_oxeval($aParams, &$oSmarty)
{
if ($aParams['var'] && $aParams['var'] instanceof oxField) {
$aParams['var'] = trim($aParams['var']->getRawValue());
}
// processign only if enabled
if (oxConfig::getInstance()->getConfigParam('bl_perfParseLongDescinSmarty') || isset($aParams['force'])) {
include_once $oSmarty->_get_plugin_filepath('function', 'eval');
return smarty_function_eval($aParams, $oSmarty);
}
return $aParams['var'];
}
示例15: smarty_insert_oxid_tracker
/**
* Smarty plugin
* -------------------------------------------------------------
* File: insert.oxid_tracker.php
* Type: string, html
* Name: oxid_tracker
* Purpose: Output etracker code or Econda Code
* add [{ insert name="oxid_tracker" title="..." }] after Body Tag in Templates
* -------------------------------------------------------------
*
* @param array $params params
* @param Smarty &$smarty clever simulation of a method
*
* @return string
*/
function smarty_insert_oxid_tracker($params, &$smarty)
{
$myConfig = oxConfig::getInstance();
// econda is on ?
if ($myConfig->getConfigParam('blEcondaActive')) {
include_once $myConfig->getConfigParam('sCoreDir') . 'smarty/plugins/oxemosadapter.php';
$sOutput = oxEmosAdapter::getInstance()->getCode($params, $smarty);
// returning JS code to output
if (strlen(trim($sOutput))) {
return "<div style=\"display:none;\">{$sOutput}</div>";
}
}
}