本文整理汇总了PHP中uniStrlen函数的典型用法代码示例。如果您正苦于以下问题:PHP uniStrlen函数的具体用法?PHP uniStrlen怎么用?PHP uniStrlen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uniStrlen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
/**
* Validates the passed chunk of data.
* In most cases, this'll be a string-object.
*
* @param string $objValue
* @return bool
*/
public function validate($objValue)
{
if (is_string($objValue) && uniStrlen($objValue) == 1) {
return true;
}
return false;
}
示例2: validate
/**
* Validates the passed chunk of data.
* In most cases, this'll be a string-object.
*
* @param string $objValue
* @return bool
*/
public function validate($objValue)
{
if (!is_string($objValue) || uniStrlen($objValue) == 0) {
return false;
}
return is_dir(_realpath_ . $objValue);
}
示例3: validate
/**
* Validates the passed chunk of data.
* In most cases, this'll be a string-object.
*
* @param string $objValue
* @return bool
*/
public function validate($objValue)
{
if (!is_string($objValue) || uniStrlen($objValue) == 0) {
return false;
}
return is_file(_realpath_ . $this->strBaseDir . $objValue);
}
示例4: getUserlist
/**
* @return string
*/
private function getUserlist()
{
$strReturn = "";
$strTemplateWrapperID = $this->objTemplate->readTemplate("/element_userlist/" . $this->arrElementData["char1"], "userlist_wrapper");
$strTemplateRowID = $this->objTemplate->readTemplate("/element_userlist/" . $this->arrElementData["char1"], "userlist_row");
$arrUserFinal = $this->loadUserlist();
$strRows = "";
foreach ($arrUserFinal as $objOneUser) {
$objTargetUser = $objOneUser->getObjSourceUser();
if ($objTargetUser instanceof class_usersources_user_kajona) {
$arrRow = array();
$arrRow["userName"] = $objTargetUser->getStrName();
$arrRow["userForename"] = $objTargetUser->getStrForename();
$arrRow["userStreet"] = $objTargetUser->getStrStreet();
$arrRow["userEmail"] = $objTargetUser->getStrEmail();
$arrRow["userPostal"] = $objTargetUser->getStrPostal();
$arrRow["userCity"] = $objTargetUser->getStrCity();
$arrRow["userPhone"] = $objTargetUser->getStrTel();
$arrRow["userMobile"] = $objTargetUser->getStrMobile();
$arrRow["userBirthday"] = uniStrlen($objTargetUser->getLongDate()) > 5 ? dateToString(new class_date($objTargetUser->getLongDate()), false) : "";
$strRows .= $this->fillTemplate($arrRow, $strTemplateRowID);
}
}
$strLink = getLinkPortalHref($this->getPagename(), "", "exportToCsv");
$strReturn .= $this->fillTemplate(array("userlist_rows" => $strRows, "csvHref" => $strLink), $strTemplateWrapperID);
return $strReturn;
}
示例5: doPortalSearch
/**
* Calls the single search-functions, sorts the results and creates the output.
* Method for portal-searches.
*
* @param class_module_search_search $objSearch
*
* @return class_search_result[]
*/
public function doPortalSearch($objSearch)
{
$objSearch->setStrQuery(trim(uniStrReplace("%", "", $objSearch->getStrQuery())));
if (uniStrlen($objSearch->getStrQuery()) == 0) {
return array();
}
//create a search object
$objSearch->setBitPortalObjectFilter(true);
$arrHits = $this->doIndexedSearch($objSearch);
$arrReturn = array();
foreach ($arrHits as $objOneResult) {
$objInstance = $objOneResult->getObjObject();
if ($objInstance instanceof class_module_pages_pageelement) {
$objInstance = $objInstance->getConcreteAdminInstance();
if ($objInstance != null) {
$objInstance->loadElementData();
} else {
continue;
}
}
$arrUpdatedResults = $objInstance->updateSearchResult($objOneResult);
if (is_array($arrUpdatedResults)) {
$arrReturn = array_merge($arrReturn, $arrUpdatedResults);
} else {
if ($objOneResult != null && $objOneResult instanceof class_search_result) {
$arrReturn[] = $objOneResult;
}
}
}
//log the query
class_module_search_log::generateLogEntry($objSearch->getStrQuery());
$arrReturn = $this->mergeDuplicates($arrReturn);
return $arrReturn;
}
示例6: updateValue
/**
* Overwritten in order to load key-value pairs declared by annotations
*/
protected function updateValue()
{
parent::updateValue();
if ($this->getObjSourceObject() != null && $this->getStrSourceProperty() != "") {
$objReflection = new class_reflection($this->getObjSourceObject());
//try to find the matching source property
$arrProperties = $objReflection->getPropertiesWithAnnotation(self::STR_TEMPLATEDIR_ANNOTATION);
$strSourceProperty = null;
foreach ($arrProperties as $strPropertyName => $strValue) {
if (uniSubstr(uniStrtolower($strPropertyName), uniStrlen($this->getStrSourceProperty()) * -1) == $this->getStrSourceProperty()) {
$strSourceProperty = $strPropertyName;
}
}
if ($strSourceProperty == null) {
return;
}
$strTemplateDir = $objReflection->getAnnotationValueForProperty($strSourceProperty, self::STR_TEMPLATEDIR_ANNOTATION);
//load templates
$arrTemplates = class_resourceloader::getInstance()->getTemplatesInFolder($strTemplateDir);
$arrTemplatesDD = array();
if (count($arrTemplates) > 0) {
foreach ($arrTemplates as $strTemplate) {
$arrTemplatesDD[$strTemplate] = $strTemplate;
}
}
$this->setArrKeyValues($arrTemplatesDD);
}
}
示例7: updateValue
/**
* Overwritten in order to load key-value pairs declared by annotations
*/
protected function updateValue()
{
parent::updateValue();
if ($this->getObjSourceObject() != null && $this->getStrSourceProperty() != "") {
$objReflection = new class_reflection($this->getObjSourceObject());
//try to find the matching source property
$arrProperties = $objReflection->getPropertiesWithAnnotation(self::STR_DDVALUES_ANNOTATION);
$strSourceProperty = null;
foreach ($arrProperties as $strPropertyName => $strValue) {
if (uniSubstr(uniStrtolower($strPropertyName), uniStrlen($this->getStrSourceProperty()) * -1) == $this->getStrSourceProperty()) {
$strSourceProperty = $strPropertyName;
}
}
if ($strSourceProperty == null) {
return;
}
$strDDValues = $objReflection->getAnnotationValueForProperty($strSourceProperty, self::STR_DDVALUES_ANNOTATION);
if ($strDDValues !== null && $strDDValues != "") {
$arrDDValues = array();
foreach (explode(",", $strDDValues) as $strOneKeyVal) {
$strOneKeyVal = uniSubstr(trim($strOneKeyVal), 1, -1);
$arrOneKeyValue = explode("=>", $strOneKeyVal);
$strKey = trim($arrOneKeyValue[0]) == "" ? " " : trim($arrOneKeyValue[0]);
if (count($arrOneKeyValue) == 2) {
$strValue = class_carrier::getInstance()->getObjLang()->getLang(trim($arrOneKeyValue[1]), $this->getObjSourceObject()->getArrModule("modul"));
if ($strValue == "!" . trim($arrOneKeyValue[1]) . "!") {
$strValue = $arrOneKeyValue[1];
}
$arrDDValues[$strKey] = $strValue;
}
}
$this->setArrKeyValues($arrDDValues);
}
}
}
示例8: validate
/**
* Validates the passed chunk of data.
* In most cases, this'll be a string-object.
*
* @param string $objValue
* @return bool
*/
public function validate($objValue)
{
if (!is_string($objValue)) {
return false;
}
return uniStrlen($objValue) === 2;
}
示例9: tokenizeAndClearShortText
/**
* Splits the current text into several tokens
* @return void
*/
private function tokenizeAndClearShortText()
{
$arrResults = array();
preg_match_all('/\\w{1,}/u', $this->getText(), $arrResults);
$arrFiltered = array_filter($arrResults[0], function ($strOneHit) {
return is_numeric($strOneHit) || uniStrlen($strOneHit) > 2;
});
$this->setResults($arrFiltered);
$this->setResults(array_count_values($this->getResults()));
}
示例10: authenticateUser
/**
* Tries to authenticate a user with the given credentials.
* The password is unencrypted, each source should take care of its own encryption.
*
* @param interface_usersources_user|class_usersources_user_kajona $objUser
* @param string $strPassword
*
* @return bool
*/
public function authenticateUser(interface_usersources_user $objUser, $strPassword)
{
if ($objUser instanceof class_usersources_user_kajona) {
$bitMD5Encryption = false;
if (uniStrlen($objUser->getStrFinalPass()) == 32) {
$bitMD5Encryption = true;
}
if ($objUser->getStrFinalPass() == self::encryptPassword($strPassword, $objUser->getStrSalt(), $bitMD5Encryption)) {
return true;
}
}
return false;
}
示例11: getActionNameForClass
/**
* Tries to get the name of an action (edit, delete, list, new, save) for a given object-type.
* Example: Converts list to listOtherObject for the object class_module_demo_demo if the annotation
* @ objectListOtherObject class_module_demo_demo is declared
*
* @param string $strAction
* @param $objInstance
*
* @return string
*/
protected function getActionNameForClass($strAction, $objInstance)
{
if (isset(self::$arrActionNameMapping[$strAction])) {
$strAnnotationPrefix = self::$arrActionNameMapping[$strAction];
if ($strAction == "new") {
return $strAction . $this->getStrCurObjectTypeName();
} else {
$objReflection = new class_reflection($this);
$arrAnnotations = $objReflection->getAnnotationsWithValueFromClass(get_class($objInstance));
foreach ($arrAnnotations as $strProperty) {
if (uniStrpos($strProperty, $strAnnotationPrefix) === 0) {
return $strAction . uniSubstr($strProperty, uniStrlen($strAnnotationPrefix));
}
}
}
}
return parent::getActionNameForClass($strAction, $objInstance);
}
示例12: validate
/**
* Validates the passed chunk of data.
* In most cases, this'll be a string-object.
*
* @param string $objValue
* @return bool
*/
public function validate($objValue)
{
if (!is_string($objValue)) {
return false;
}
$intMin = 1;
$intMax = 0;
//todo does not makes sense here as the else part will never be reached?extract intMax to class variable?
$intLen = uniStrlen($objValue);
if ($intMax == 0) {
if ($intLen >= $intMin) {
return true;
}
} else {
if ($intLen >= $intMin && $intLen <= $intMax) {
return true;
}
}
return false;
}
示例13: getSourceDir
private function getSourceDir()
{
if ($this->getObjSourceObject() != null && $this->getStrSourceProperty() != "") {
$objReflection = new class_reflection($this->getObjSourceObject());
//try to find the matching source property
$arrProperties = $objReflection->getPropertiesWithAnnotation(self::STR_SOURCEDIR_ANNOTATION);
$strSourceProperty = null;
foreach ($arrProperties as $strPropertyName => $strValue) {
if (uniSubstr(uniStrtolower($strPropertyName), uniStrlen($this->getStrSourceProperty()) * -1) == $this->getStrSourceProperty()) {
$strSourceProperty = $strPropertyName;
}
}
if ($strSourceProperty != null) {
$strDir = $objReflection->getAnnotationValueForProperty($strSourceProperty, self::STR_SOURCEDIR_ANNOTATION);
if ($strDir !== null && $strDir != "") {
return $strDir;
}
}
}
return null;
}
示例14: getAdminForm
/**
* @see interface_admin_systemtask::getAdminForm()
* @return string
*/
public function getAdminForm()
{
$strReturn = "";
//show dropdown to select db-dump
$objFilesystem = new class_filesystem();
$arrFiles = $objFilesystem->getFilelist(_projectpath_ . "/dbdumps/", array(".sql", ".gz"));
$arrOptions = array();
foreach ($arrFiles as $strOneFile) {
$arrDetails = $objFilesystem->getFileDetails(_projectpath_ . "/dbdumps/" . $strOneFile);
$strTimestamp = "";
if (uniStrpos($strOneFile, "_") !== false) {
$strTimestamp = uniSubstr($strOneFile, uniStrrpos($strOneFile, "_") + 1, uniStrpos($strOneFile, ".") - uniStrrpos($strOneFile, "_"));
}
if (uniStrlen($strTimestamp) > 9 && is_numeric($strTimestamp)) {
$arrOptions[$strOneFile] = $strOneFile . " (" . bytesToString($arrDetails["filesize"]) . ")" . "<br />" . $this->getLang("systemtask_dbimport_datefilename") . " " . timeToString($strTimestamp) . "<br />" . $this->getLang("systemtask_dbimport_datefileinfo") . " " . timeToString($arrDetails['filechange']);
} else {
$arrOptions[$strOneFile] = $strOneFile . " (" . bytesToString($arrDetails["filesize"]) . ")" . "<br />" . $this->getLang("systemtask_dbimport_datefileinfo") . " " . timeToString($arrDetails['filechange']);
}
}
$strReturn .= $this->objToolkit->formInputRadiogroup("dbImportFile", $arrOptions, $this->getLang("systemtask_dbimport_file"));
return $strReturn;
}
示例15: getValueAsText
/**
* Returns a textual representation of the formentries' value.
* May contain html, but should be stripped down to text-only.
*
* @return string
*/
public function getValueAsText()
{
//load all matching and possible values based on the prefix
if ($this->getObjSourceObject() == null || $this->getStrSourceProperty() == "") {
return $this->getStrValue() . " Error: No target object mapped or missing @fieldValuePrefix annotation!";
}
$objReflection = new class_reflection($this->getObjSourceObject());
//try to find the matching source property
$arrProperties = $objReflection->getPropertiesWithAnnotation(self::STR_VALUE_ANNOTATION);
$strSourceProperty = null;
foreach ($arrProperties as $strPropertyName => $strValue) {
if (uniSubstr(uniStrtolower($strPropertyName), uniStrlen($this->getStrSourceProperty()) * -1) == $this->getStrSourceProperty()) {
$strSourceProperty = $strPropertyName;
}
}
if ($strSourceProperty == null) {
return $this->getStrValue();
}
$strPrefix = trim($objReflection->getAnnotationValueForProperty($strSourceProperty, self::STR_VALUE_ANNOTATION));
if ($this->getStrValue() !== null && $this->getStrValue() !== "") {
return $this->getObjSourceObject()->getLang($strPrefix . $this->getStrValue());
}
return "";
}