本文整理汇总了PHP中oxUtilsObject::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP oxUtilsObject::getInstance方法的具体用法?PHP oxUtilsObject::getInstance怎么用?PHP oxUtilsObject::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oxUtilsObject
的用法示例。
在下文中一共展示了oxUtilsObject::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Initialize the fixture.
*/
protected function setUp()
{
parent::setUp();
// demo article
$sId = $this->getTestConfig()->getShopEdition() == 'EE' ? '2275' : '2077';
$sNewId = oxUtilsObject::getInstance()->generateUId();
$this->oArticle = oxNew('oxArticle');
$this->oArticle->disableLazyLoading();
$this->oArticle->Load($sId);
// making copy
$this->oArticle->setId($sNewId);
$this->oArticle->oxarticles__oxweight = new oxField(10, oxField::T_RAW);
$this->oArticle->oxarticles__oxstock = new oxField(100, oxField::T_RAW);
$this->oArticle->oxarticles__oxprice = new oxField(19, oxField::T_RAW);
$this->oArticle->oxarticles__oxstockflag = new oxField(2, oxField::T_RAW);
$this->oArticle->save();
// demo category
$sId = $this->getTestConfig()->getShopEdition() == 'EE' ? '30e44ab82c03c3848.49471214' : '8a142c3e4143562a5.46426637';
$sNewId = oxUtilsObject::getInstance()->generateUId();
$this->oCategory = oxNew('oxBase');
$this->oCategory->Init('oxcategories');
$this->oCategory->Load($sId);
// making copy
$this->oCategory->setId($sNewId);
$this->oCategory->save();
// assigning article to category
$oO2Group = oxNew('oxobject2category');
$oO2Group->oxobject2category__oxshopid = new oxField($this->getConfig()->getShopId(), oxField::T_RAW);
$oO2Group->oxobject2category__oxobjectid = new oxField($this->oArticle->getId(), oxField::T_RAW);
$oO2Group->oxobject2category__oxcatnid = new oxField($this->oCategory->getId(), oxField::T_RAW);
$oO2Group->save();
$this->dDefaultVAT = $this->getConfig()->getConfigParam('dDefaultVAT');
$this->getConfig()->setConfigParam('dDefaultVAT', '99');
}
示例2: _getReservationsId
/**
* return the ID of active resevations user basket
*
* @return string
*/
protected function _getReservationsId()
{
$sId = oxRegistry::getSession()->getVariable('basketReservationToken');
if (!$sId) {
$sId = oxUtilsObject::getInstance()->generateUId();
oxRegistry::getSession()->setVariable('basketReservationToken', $sId);
}
return $sId;
}
示例3: _getExportFileName
/**
* Return export file name
*
* @return string
*/
protected function _getExportFileName()
{
$sSessionFileName = oxRegistry::getSession()->getVariable("sExportFileName");
if (!$sSessionFileName) {
$sSessionFileName = md5($this->getSession()->getId() . oxUtilsObject::getInstance()->generateUId());
oxRegistry::getSession()->setVariable("sExportFileName", $sSessionFileName);
}
return $sSessionFileName;
}
示例4: _addThemeConfig
/**
* Adds theme config value
*
* @param string $sShopId shop id
* @param string $sThemeName theme name
* @param string $sVarName name
* @param string $sVarType type
* @param string $sVarValue value
* @param string $sVarGroup group
* @param string $sVarConstrains constrains
* @param string $iVarPos position
*/
protected static function _addThemeConfig($sShopId, $sThemeName, $sVarName, $sVarType, $sVarValue, $sVarGroup, $sVarConstrains, $iVarPos)
{
$sOxId = oxUtilsObject::getInstance()->generateUID();
$sThemeName = 'theme:' . $sThemeName;
$sConfigSQL = 'INSERT INTO `oxconfig` (`OXID`, `OXSHOPID`, `OXMODULE`, `OXVARNAME`, `OXVARTYPE`, `OXVARVALUE`) VALUES ( ?, ?, ?, ?, ?, ' . $sVarValue . ' )';
oxDb::getDb()->execute($sConfigSQL, array($sOxId, $sShopId, $sThemeName, $sVarName, $sVarType));
if (!empty($sVarGroup)) {
$sConfigDisplaySQL = 'INSERT INTO `oxconfigdisplay` (`OXID`, `OXCFGMODULE`, `OXCFGVARNAME`, `OXGROUPING`, `OXVARCONSTRAINT`, `OXPOS`) VALUES ( ?, ?, ?, ?, ?, ? )';
oxDb::getDb()->execute($sConfigDisplaySQL, array($sOxId, $sThemeName, $sVarName, $sVarGroup, $sVarConstrains, $iVarPos));
}
}
示例5: resetCache
/**
* Resets template, language and menu xml cache
*/
public function resetCache()
{
$aTemplates = $this->getModule()->getTemplates();
$oUtils = oxRegistry::getUtils();
$oUtils->resetTemplateCache($aTemplates);
$oUtils->resetLanguageCache();
$oUtils->resetMenuCache();
$oUtilsObject = oxUtilsObject::getInstance();
$oUtilsObject->resetModuleVars();
$this->_clearApcCache();
}
示例6: loadPayPalOrder
/**
* Loads order associated with current PayPal order
*
* @return bool
*/
public function loadPayPalOrder()
{
$sOrderId = oxRegistry::getSession()->getVariable("sess_challenge");
// if order is not created yet - generating it
if ($sOrderId === null) {
$sOrderId = oxUtilsObject::getInstance()->generateUID();
$this->setId($sOrderId);
$this->save();
oxRegistry::getSession()->setVariable("sess_challenge", $sOrderId);
}
return $this->load($sOrderId);
}
示例7: render
/**
* Loads contents info, passes it to Smarty engine and
* returns name of template file "content_main.tpl".
*
* @return string
*/
public function render()
{
$myConfig = $this->getConfig();
parent::render();
$soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
// categorie tree
$oCatTree = oxNew("oxCategoryList");
$oCatTree->loadList();
$oContent = oxNew("oxcontent");
if ($soxId != "-1" && isset($soxId)) {
// load object
$oContent->loadInLang($this->_iEditLang, $soxId);
$oOtherLang = $oContent->getAvailableInLangs();
if (!isset($oOtherLang[$this->_iEditLang])) {
// echo "language entry doesn't exist! using: ".key($oOtherLang);
$oContent->loadInLang(key($oOtherLang), $soxId);
}
// remove already created languages
$aLang = array_diff(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
if (count($aLang)) {
$this->_aViewData["posslang"] = $aLang;
}
foreach ($oOtherLang as $id => $language) {
$oLang = new stdClass();
$oLang->sLangDesc = $language;
$oLang->selected = $id == $this->_iEditLang;
$this->_aViewData["otherlang"][$id] = clone $oLang;
}
// mark selected
if ($oContent->oxcontents__oxcatid->value && isset($oCatTree[$oContent->oxcontents__oxcatid->value])) {
$oCatTree[$oContent->oxcontents__oxcatid->value]->selected = 1;
}
} else {
// create ident to make life easier
$sUId = oxUtilsObject::getInstance()->generateUId();
$oContent->oxcontents__oxloadid = new oxField($sUId);
}
$this->_aViewData["edit"] = $oContent;
$this->_aViewData["link"] = "[{ oxgetseourl ident="" . $oContent->oxcontents__oxloadid->value . "" type="oxcontent" }]";
$this->_aViewData["cattree"] = $oCatTree;
// generate editor
$sCSS = "content.tpl.css";
if ($oContent->oxcontents__oxsnippet->value == '1') {
$sCSS = null;
}
$this->_aViewData["editor"] = $this->_generateTextEditor("100%", 300, $oContent, "oxcontents__oxcontent", $sCSS);
$this->_aViewData["afolder"] = $myConfig->getConfigParam('aCMSfolder');
return "content_main.tpl";
}
示例8: getHash
/**
* Returns text hash
*
* @param string $sText User supplie text
*
* @return string
*/
public function getHash($sText = null)
{
// inserting captcha record
$iTime = time() + $this->_iTimeout;
$sTextHash = $this->getTextHash($sText);
// if session is started - storing captcha info here
if ($this->getSession()->isSessionStarted()) {
$sHash = oxUtilsObject::getInstance()->generateUID();
oxSession::setVar("aCaptchaHash", array($sHash => array($sTextHash => $iTime)));
} else {
$sQ = "insert into oxcaptcha ( oxhash, oxtime ) values ( '{$sTextHash}', '{$iTime}' )";
oxDb::getDb()->execute($sQ);
$sHash = oxDb::getDb()->getOne("select LAST_INSERT_ID()");
}
return $sHash;
}
示例9: generateVoucher
/**
* Generates and saves vouchers. Returns number of saved records
*
* @param int $iCnt voucher counter offset
*
* @return int saved record count
*/
public function generateVoucher($iCnt)
{
$iAmount = abs((int) oxRegistry::getSession()->getVariable("voucherAmount"));
// creating new vouchers
if ($iCnt < $iAmount && ($oVoucherSerie = $this->_getVoucherSerie())) {
if (!$this->_iGenerated) {
$this->_iGenerated = $iCnt;
}
$blRandomNr = (bool) oxRegistry::getSession()->getVariable("randomVoucherNr");
$sVoucherNr = $blRandomNr ? oxUtilsObject::getInstance()->generateUID() : oxRegistry::getSession()->getVariable("voucherNr");
$oNewVoucher = oxNew("oxvoucher");
$oNewVoucher->oxvouchers__oxvoucherserieid = new oxField($oVoucherSerie->getId());
$oNewVoucher->oxvouchers__oxvouchernr = new oxField($sVoucherNr);
$oNewVoucher->save();
$this->_iGenerated++;
}
return $this->_iGenerated;
}
示例10: addArticle
/**
* Add article to recommendation list
*
* @param string $sOXID Object ID
* @param string $sDesc recommended article description
*
* @return bool
*/
public function addArticle($sOXID, $sDesc)
{
$blAdd = false;
if ($sOXID) {
$oDb = oxDb::getDb();
if (!$oDb->getOne("select oxid from oxobject2list where oxobjectid=" . $oDb->quote($sOXID) . " and oxlistid=" . $oDb->quote($this->getId()))) {
$sUid = oxUtilsObject::getInstance()->generateUID();
$sQ = "insert into oxobject2list ( oxid, oxobjectid, oxlistid, oxdesc ) values ( '{$sUid}', " . $oDb->quote($sOXID) . ", " . $oDb->quote($this->getId()) . ", " . $oDb->quote($sDesc) . " )";
$blAdd = $oDb->execute($sQ);
}
}
return $blAdd;
}
示例11: initializeUserForCallBackPayPalUser
/**
* Initializes call back user.
*
* @param array $aPayPalData Callback user data.
*
* @return null
*/
public function initializeUserForCallBackPayPalUser($aPayPalData)
{
// setting mode..
$this->_blCallBackUser = true;
// setting data..
$aStreet = $this->_splitShipToStreetPayPalUser($aPayPalData['SHIPTOSTREET']);
// setting object id as it is requested later while processing user object
$this->setId(oxUtilsObject::getInstance()->generateUID());
$this->oxuser__oxstreet = new oxField($aStreet['street']);
$this->oxuser__oxstreetnr = new oxField($aStreet['streetnr']);
$this->oxuser__oxcity = new oxField($aPayPalData['SHIPTOCITY']);
$this->oxuser__oxzip = new oxField($aPayPalData['SHIPTOZIP']);
$oCountry = oxNew('oxCountry');
$sCountryId = $oCountry->getIdByCode($aPayPalData["SHIPTOCOUNTRY"]);
$this->oxuser__oxcountryid = new oxField($sCountryId);
$sStateId = '';
if (isset($aPayPalData["SHIPTOSTATE"])) {
$oState = oxNew('oxState');
$sStateId = $oState->getIdByCode($aPayPalData["SHIPTOSTATE"], $sCountryId);
}
$this->oxuser__oxstateid = new oxField($sStateId);
}
示例12: insertUser
/**
* insert test user
*/
private function insertUser()
{
$this->testUserId = substr_replace(oxUtilsObject::getInstance()->generateUId(), '_', 0, 1);
$user = oxNew('oxUser');
$user->setId($this->testUserId);
$user->oxuser__oxactive = new oxField('1', oxField::T_RAW);
$user->oxuser__oxrights = new oxField('user', oxField::T_RAW);
$user->oxuser__oxshopid = new oxField('oxbaseshop', oxField::T_RAW);
$user->oxuser__oxusername = new oxField('testuser@oxideshop.dev', oxField::T_RAW);
$user->oxuser__oxpassword = new oxField('c630e7f6dd47f9ad60ece4492468149bfed3da3429940181464baae99941d0ffa5562' . 'aaecd01eab71c4d886e5467c5fc4dd24a45819e125501f030f61b624d7d', oxField::T_RAW);
//password is asdfasdf
$user->oxuser__oxpasssalt = new oxField('3ddda7c412dbd57325210968cd31ba86', oxField::T_RAW);
$user->oxuser__oxcustnr = new oxField('666', oxField::T_RAW);
$user->oxuser__oxfname = new oxField('Bla', oxField::T_RAW);
$user->oxuser__oxlname = new oxField('Foo', oxField::T_RAW);
$user->oxuser__oxstreet = new oxField('blafoostreet', oxField::T_RAW);
$user->oxuser__oxstreetnr = new oxField('123', oxField::T_RAW);
$user->oxuser__oxcity = new oxField('Hamburg', oxField::T_RAW);
$user->oxuser__oxcountryid = new oxField('a7c40f631fc920687.20179984', oxField::T_RAW);
$user->oxuser__oxzip = new oxField('22769', oxField::T_RAW);
$user->oxuser__oxsal = new oxField('MR', oxField::T_RAW);
$user->oxuser__oxactive = new oxField('1', oxField::T_RAW);
$user->oxuser__oxboni = new oxField('1000', oxField::T_RAW);
$user->oxuser__oxcreate = new oxField('2015-05-20 22:10:51', oxField::T_RAW);
$user->oxuser__oxregister = new oxField('2015-05-20 22:10:51', oxField::T_RAW);
$user->oxuser__oxboni = new oxField('1000', oxField::T_RAW);
$user->save();
$newId = substr_replace(oxUtilsObject::getInstance()->generateUId(), '_', 0, 1);
$oDb = oxDb::getDb();
$sQ = 'insert into `oxobject2delivery` (oxid, oxdeliveryid, oxobjectid, oxtype ) ' . " values ('{$newId}', 'oxidstandard', '" . $this->testUserId . "', 'oxdelsetu')";
$oDb->execute($sQ);
}
示例13: addArticle
/**
* Adds article to category
* Creates new list
*/
public function addArticle()
{
$myConfig = $this->getConfig();
$aArticles = $this->_getActionIds('oxarticles.oxid');
$sCategoryID = oxRegistry::getConfig()->getRequestParameter('synchoxid');
$sShopID = $myConfig->getShopId();
$oDb = oxDb::getDb();
$sArticleTable = $this->_getViewName('oxarticles');
// adding
if (oxRegistry::getConfig()->getRequestParameter('all')) {
$aArticles = $this->_getAll($this->_addFilter("select {$sArticleTable}.oxid " . $this->_getQuery()));
}
if (is_array($aArticles)) {
$sO2CView = $this->_getViewName('oxobject2category');
$oNew = oxNew('oxobject2category');
$myUtilsObject = oxUtilsObject::getInstance();
$oActShop = $myConfig->getActiveShop();
$sProdIds = "";
foreach ($aArticles as $sAdd) {
// check, if it's already in, then don't add it again
$sSelect = "select 1 from {$sO2CView} as oxobject2category where oxobject2category.oxcatnid= " . $oDb->quote($sCategoryID) . " and oxobject2category.oxobjectid = " . $oDb->quote($sAdd) . "";
if ($oDb->getOne($sSelect, false, false)) {
continue;
}
$oNew->oxobject2category__oxid = new oxField($oNew->setId(md5($sAdd . $sCategoryID . $sShopID)));
$oNew->oxobject2category__oxobjectid = new oxField($sAdd);
$oNew->oxobject2category__oxcatnid = new oxField($sCategoryID);
$oNew->oxobject2category__oxtime = new oxField(time());
$oNew->save();
if ($sProdIds) {
$sProdIds .= ",";
}
$sProdIds .= $oDb->quote($sAdd);
}
// updating oxtime values
$this->_updateOxTime($sProdIds);
$this->resetArtSeoUrl($aArticles);
$this->resetCounter("catArticle", $sCategoryID);
}
}
示例14: render
/**
* Executes parent::render(), if basket is empty - redirects to main page
* and exits the script (oxorder::validateOrder()). Loads and passes payment
* info to template engine. Refreshes basket articles info by additionally loading
* each article object (oxorder::getProdFromBasket()), adds customer addressing/delivering
* data (oxorder::getDelAddressInfo()) and delivery sets info (oxorder::getShipping()).
* Returns name of template to render order::_sThisTemplate.
*
* @return string
*/
public function render()
{
if ($this->getIsOrderStep()) {
$oBasket = $this->getBasket();
$myConfig = $this->getConfig();
if ($myConfig->getConfigParam('blPsBasketReservationEnabled')) {
$this->getSession()->getBasketReservations()->renewExpiration();
if (!$oBasket || $oBasket && !$oBasket->getProductsCount()) {
oxUtils::getInstance()->redirect($myConfig->getShopHomeURL() . 'cl=basket', true, 302);
}
}
// can we proceed with ordering ?
$oUser = $this->getUser();
if (!$oUser && ($oBasket && $oBasket->getProductsCount() > 0)) {
oxUtils::getInstance()->redirect($myConfig->getShopHomeURL() . 'cl=basket', false, 302);
} elseif (!$oBasket || !$oUser || $oBasket && !$oBasket->getProductsCount()) {
oxUtils::getInstance()->redirect($myConfig->getShopHomeURL(), false, 302);
}
// payment is set ?
if (!$this->getPayment()) {
// redirecting to payment step on error ..
oxUtils::getInstance()->redirect($myConfig->getShopCurrentURL() . '&cl=payment', true, 302);
}
}
parent::render();
// reload blocker
if (!oxSession::getVar('sess_challenge')) {
oxSession::setVar('sess_challenge', oxUtilsObject::getInstance()->generateUID());
}
return $this->_sThisTemplate;
}
示例15:
* (at your option) any later version.
*
* OXID eShop Community Edition is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OXID eShop Community Edition. If not, see <http://www.gnu.org/licenses/>.
*
* @link http://www.oxid-esales.com
* @copyright (C) OXID eSales AG 2003-2014
* @version OXID eShop CE
*/
require_once 'oxerptype.php';
$sArticleClass = oxUtilsObject::getInstance()->getClassName('oxarticle');
eval("class oxErpArticle450_parent extends {$sArticleClass} {};");
/**
* article class, used inside erp for 4.5.0 eShop version
* hotfixe for article long description saving (bug#0002741)
*/
class oxErpArticle450 extends oxErpArticle450_parent
{
/**
* Sets article parameter
*
* @param string $sName name of parameter to set
* @param mixed $sValue parameter value
*
* @return null
*/