本文整理汇总了PHP中getStr函数的典型用法代码示例。如果您正苦于以下问题:PHP getStr函数的具体用法?PHP getStr怎么用?PHP getStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getStr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setupNavigation
/**
* Sets up navigation for current view
*
* @param string $sNode None name
*/
protected function _setupNavigation($sNode)
{
$myAdminNavig = $this->getNavigation();
$sNode = oxRegistry::getConfig()->getRequestParameter("menu");
// active tab
$iActTab = oxRegistry::getConfig()->getRequestParameter('actedit');
$iActTab = $iActTab ? $iActTab : $this->_iDefEdit;
$sActTab = $iActTab ? "&actedit={$iActTab}" : '';
// list url
$this->_aViewData['listurl'] = $myAdminNavig->getListUrl($sNode) . $sActTab;
// edit url
$sEditUrl = $myAdminNavig->getEditUrl($sNode, $iActTab) . $sActTab;
if (!getStr()->preg_match("/^http(s)?:\\/\\//", $sEditUrl)) {
//internal link, adding path
/** @var oxUtilsUrl $oUtilsUrl */
$oUtilsUrl = oxRegistry::get("oxUtilsUrl");
$sSelfLinkParameter = $this->getViewConfig()->getViewConfigParam('selflink');
$sEditUrl = $oUtilsUrl->appendParamSeparator($sSelfLinkParameter) . $sEditUrl;
}
$this->_aViewData['editurl'] = $sEditUrl;
// tabs
$this->_aViewData['editnavi'] = $myAdminNavig->getTabs($sNode, $iActTab);
// active tab
$this->_aViewData['actlocation'] = $myAdminNavig->getActiveTab($sNode, $iActTab);
// default tab
$this->_aViewData['default_edit'] = $myAdminNavig->getActiveTab($sNode, $this->_iDefEdit);
// passign active tab number
$this->_aViewData['actedit'] = $iActTab;
// buttons
$this->_aViewData['bottom_buttons'] = $myAdminNavig->getBtn($sNode);
}
示例2: smarty_modifier_oxaddparams
/**
* Smarty function
* -------------------------------------------------------------
* Purpose: add additional parameters to SEO url
* add |oxaddparams:"...." to link
* -------------------------------------------------------------
*
* @param string $sUrl Url
* @param string $sDynParams Dynamic URL parameters
*
* @return string
*/
function smarty_modifier_oxaddparams($sUrl, $sDynParams)
{
$oStr = getStr();
// removing empty parameters
$sDynParams = $sDynParams ? $oStr->preg_replace(array('/^\\?/', '/^\\&(amp;)?$/'), '', $sDynParams) : false;
if ($sDynParams) {
$sUrl .= (strpos($sUrl, '?') !== false ? "&" : "?") . $sDynParams;
}
return oxUtilsUrl::getInstance()->processSeoUrl($sUrl);
}
示例3: setActiveValue
/**
* Set attribute selected value
*
* @param string $sValue - attribute value
*
* @return null
*/
public function setActiveValue($sValue)
{
$this->_sActiveValue = getStr()->htmlspecialchars($sValue);
}
示例4: parse
/**
* @return $this
* @throws Exception
*/
public function parse()
{
$handle = self::getFileHandler(self::$parseFile, "r");
self::flushMainFile();
self::flushTempFile();
/**
* @param $handle
* @return Generator
*/
function getStr($handle)
{
while (($buffer = fgets($handle)) !== false) {
$keywords = preg_split("/[\\s+]/", preg_replace("/[^\\d\\w]+/ui", ' ', $buffer));
(yield $keywords);
}
fclose($handle);
}
$generator = getStr($handle);
$a = [];
foreach ($generator as $value) {
foreach ($value as $item) {
$a[strtolower($item)] = isset($a[strtolower($item)]) ? $a[strtolower($item)] + 1 : 1;
}
if (count($a) >= self::MAX_ARRAY_ELEMENT) {
$this->writeData($a);
$a = [];
}
}
$this->writeData($a);
return $this;
}
示例5: render
/**
* Sets efire parameters to view, returns name of template to render
*
* @return string
*/
public function render()
{
$oStr = getStr();
$myConfig = $this->getConfig();
$this->_aViewData['sEfiUsername'] = $oStr->htmlspecialchars($myConfig->getConfigParam('sEfiUsername'));
$this->_aViewData['sEfiPassword'] = $oStr->htmlspecialchars($myConfig->getConfigParam('sEfiPassword'));
return parent::render();
}
示例6: prepareStrForSearch
/**
* Prepares and returns string for search engines.
*
* @param string $sSearchStr String to prepare for search engines
*
* @return string
*/
public function prepareStrForSearch($sSearchStr)
{
$oStr = getStr();
if ($oStr->hasSpecialChars($sSearchStr)) {
return $oStr->recodeEntities($sSearchStr, true, array('&'), array('&'));
}
return '';
}
示例7: getGPSData
public function getGPSData()
{
$userVehicle = $this->userModel->getAssignedVehicle($this->userId);
if ($userVehicle !== null) {
$vehicleId = getStr($userVehicle->Vehicle_idvehicle);
echo $this->vehicleModel->getLastDrivenPath($vehicleId);
}
}
示例8: processFiles
/**
* Uploaded file processor (filters, etc), sets configuration parameters to passed object and returns it.
*
* @param object $oObject Object, that parameters are modified according to passed files.
* @param array $aFiles Name of files to process.
* @param bool $blUseMasterImage Use master image as source for processing.
* @param bool $blUnique TRUE - forces new file creation with unique name.
*
* @return object
*/
public function processFiles($oObject = null, $aFiles = array(), $blUseMasterImage = false, $blUnique = true)
{
$aFiles = $aFiles ? $aFiles : $_FILES;
if (isset($aFiles['myfile']['name'])) {
$oDb = oxDb::getDb();
$oConfig = $this->getConfig();
$oStr = getStr();
// A. protection for demoshops - strictly defining allowed file extensions.
$blDemo = (bool) $oConfig->isDemoShop();
// Folder where images will be processed.
$sTmpFolder = $oConfig->getConfigParam('sCompileDir');
$iNewFilesCounter = 0;
$aSource = $aFiles['myfile']['tmp_name'];
$aError = $aFiles['myfile']['error'];
$sErrorsDescription = '';
$oEx = oxNew('oxExceptionToDisplay');
while (list($sKey, $sValue) = each($aFiles['myfile']['name'])) {
$sSource = $aSource[$sKey];
$iError = $aError[$sKey];
$aFiletype = explode('@', $sKey);
$sKey = $aFiletype[1];
$sType = $aFiletype[0];
$sValue = strtolower($sValue);
$sImagePath = $this->_getImagePath($sType);
// Should translate error to user if file was uploaded.
if (UPLOAD_ERR_OK !== $iError && UPLOAD_ERR_NO_FILE !== $iError) {
$sErrorsDescription = $this->translateError($iError);
$oEx->setMessage($sErrorsDescription);
oxRegistry::get('oxUtilsView')->addErrorToDisplay($oEx, false);
}
// Checking file type and building final file name.
if ($sSource && ($sValue = $this->_prepareImageName($sValue, $sType, $blDemo, $sImagePath, $blUnique))) {
// Moving to tmp folder for processing as safe mode or spec. open_basedir setup.
// Usually does not allow file modification in php's temp folder.
$sProcessPath = $sTmpFolder . basename($sSource);
if ($sProcessPath) {
if ($blUseMasterImage) {
// Using master image as source, so only copying it to.
$blMoved = $this->_copyFile($sSource, $sImagePath . $sValue);
} else {
$blMoved = $this->_moveImage($sSource, $sImagePath . $sValue);
}
if ($blMoved) {
// New image successfully add.
$iNewFilesCounter++;
// Assign the name.
if ($oObject && isset($oObject->{$sKey})) {
$oObject->{$sKey}->setValue($sValue);
$oDb->Execute("INSERT INTO `ongr_sync_jobs` SET\n `TYPE` = 'U',\n `WORKER_TYPE` = 'P',\n `ENTITY` = 'pictures',\n `TABLE` = ?,\n `OXID` = ?,\n `STATUS` = 0,\n `PRIORITY` = 0,\n `CHANGES` = ?", array($oObject->getCoreTableName(), $oObject->getId(), $sKey));
}
}
}
}
}
$this->_setNewFilesCounter($iNewFilesCounter);
}
return $oObject;
}
示例9: 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 external 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 = oxRegistry::getConfig();
$sSuffix = !empty($smarty->_tpl_vars["__oxid_include_dynamic"]) ? '_dynamic' : '';
$sWidget = !empty($params['widget']) ? $params['widget'] : '';
$blInWidget = !empty($params['inWidget']) ? $params['inWidget'] : false;
$sCStyles = 'conditional_styles' . $sSuffix;
$sStyles = 'styles' . $sSuffix;
$aCStyles = (array) $myConfig->getGlobalParameter($sCStyles);
$aStyles = (array) $myConfig->getGlobalParameter($sStyles);
if ($sWidget && !$blInWidget) {
return;
}
$sOutput = '';
if (!empty($params['include'])) {
$sStyle = $params['include'];
if (!preg_match('#^https?://#', $sStyle)) {
$sOriginalStyle = $sStyle;
// Separate query part #3305.
$aStyle = explode('?', $sStyle);
$sStyle = $aStyle[0] = $myConfig->getResourceUrl($aStyle[0], $myConfig->isAdmin());
if ($sStyle && count($aStyle) > 1) {
// Append query part if still needed #3305.
$sStyle .= '?' . $aStyle[1];
} elseif ($sSPath = $myConfig->getResourcePath($sOriginalStyle, $myConfig->isAdmin())) {
// Append file modification timestamp #3725.
$sStyle .= '?' . filemtime($sSPath);
}
}
// File not found ?
if (!$sStyle) {
if ($myConfig->getConfigParam('iDebug') != 0) {
$sError = "{oxstyle} resource not found: " . getStr()->htmlspecialchars($params['include']);
trigger_error($sError, E_USER_WARNING);
}
return;
}
// Conditional comment ?
if (!empty($params['if'])) {
$aCStyles[$sStyle] = $params['if'];
$myConfig->setGlobalParameter($sCStyles, $aCStyles);
} 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 ($aCStyles as $sSrc => $sCondition) {
$sOutput .= '<!--[if ' . $sCondition . ']><link rel="stylesheet" type="text/css" href="' . $sSrc . '"><![endif]-->' . PHP_EOL;
}
}
return $sOutput;
}
示例10: checkData
function checkData($data)
{
if (is_array($data)) {
foreach ($data as $key => $v) {
$data[$key] = checkData($v);
}
} else {
$data = getStr($data);
}
return $data;
}
示例11: selectTable
function selectTable($sp)
{
$ids = explode(",", getInstanceIDs("Device.X_CISCO_COM_DDNS.Service."));
foreach ($ids as $key => $j) {
$spArr[$j] = getStr("Device.X_CISCO_COM_DDNS.Service." . $j . ".ServiceName");
if (strcasecmp($sp, $spArr[$j]) == 0) {
return $j;
}
}
return 0;
}
示例12: php_getstr
function php_getstr($str)
{
if ("Enabled" == $_SESSION["psmMode"]) {
if (strstr($str, "WiFi")) {
return "";
}
if (strstr($str, "MoCA")) {
return "";
}
}
return getStr($str);
}
示例13: _addFilter
/**
* Adds filter SQL to current query
*
* @param string $sQ query to add filter condition
*
* @return string
*/
protected function _addFilter($sQ)
{
$sQ = parent::_addFilter($sQ);
// display variants or not ?
if ($this->getConfig()->getConfigParam('blVariantsSelection')) {
$sQ .= ' group by ' . $this->_getViewName('oxarticles') . '.oxid ';
$oStr = getStr();
if ($oStr->strpos($sQ, "select count( * ) ") === 0) {
$sQ = "select count( * ) from ( {$sQ} ) as _cnttable";
}
}
return $sQ;
}
示例14: getPort4XHSEnabled
function getPort4XHSEnabled()
{
$rootObjName = "Device.X_CISCO_COM_MultiLAN.";
$paramNameArray = array("Device.X_CISCO_COM_MultiLAN.");
$mapping_array = array("PrimaryLANBridge", "PrimaryLANBridgeHSPorts", "HomeSecurityBridge", "HomeSecurityBridgePorts");
$multiLan = getParaValues($rootObjName, $paramNameArray, $mapping_array);
if (!empty($multiLan)) {
$pLanBridgeHSPortEnable = getStr($multiLan[0]["PrimaryLANBridge"] . ".Port." . $multiLan[0]["PrimaryLANBridgeHSPorts"] . ".Enable");
$HSBridgePortEnable = getStr($multiLan[0]["HomeSecurityBridge"] . ".Port." . $multiLan[0]["HomeSecurityBridgePorts"] . ".Enable");
return $pLanBridgeHSPortEnable === 'false' && $HSBridgePortEnable === 'true';
}
return false;
}
示例15: _getData
/**
* Formats and returns statiistics configuration related data array for ajax response
*
* @param string $sCountQ this param currently is not used as thsi mathod overrides default function behaviour
* @param string $sQ this param currently is not used as thsi mathod overrides default function behaviour
*
* @return array
*/
protected function _getData($sCountQ, $sQ)
{
$aResponse['startIndex'] = $this->_getStartIndex();
$aResponse['sort'] = '_' . $this->_getSortCol();
$aResponse['dir'] = $this->_getSortDir();
// all possible reports
$aReports = oxSession::getVar("allstat_reports");
$sSynchId = oxConfig::getParameter("synchoxid");
$sOxId = oxConfig::getParameter("oxid");
$sStatId = $sSynchId ? $sSynchId : $sOxId;
$oStat = oxNew('oxstatistic');
$oStat->load($sStatId);
$aStatData = unserialize($oStat->oxstatistics__oxvalue->value);
$aData = array();
$iCnt = 0;
$oStr = getStr();
// filter data
$aFilter = oxConfig::getParameter("aFilter");
$sFilter = is_array($aFilter) && isset($aFilter['_0']) ? $oStr->preg_replace('/^\\*/', '%', $aFilter['_0']) : null;
foreach ($aReports as $oReport) {
if ($sSynchId) {
if (is_array($aStatData) && in_array($oReport->filename, $aStatData)) {
continue;
}
} else {
if (!is_array($aStatData) || !in_array($oReport->filename, $aStatData)) {
continue;
}
}
// checking filter
if ($sFilter && !$oStr->preg_match("/^" . preg_quote($sFilter) . "/i", $oReport->name)) {
continue;
}
$aData[$iCnt]['_0'] = $oReport->name;
$aData[$iCnt]['_1'] = $oReport->filename;
$iCnt++;
}
// ordering ...
if (oxConfig::getParameter("dir")) {
if ('asc' == oxConfig::getParameter("dir")) {
usort($aData, array($this, "sortAsc"));
} else {
usort($aData, array($this, "sortDesc"));
}
} else {
usort($aData, array($this, "sortAsc"));
}
$aResponse['records'] = $aData;
$aResponse['totalRecords'] = count($aReports);
return $aResponse;
}