本文整理汇总了PHP中uniSubstr函数的典型用法代码示例。如果您正苦于以下问题:PHP uniSubstr函数的具体用法?PHP uniSubstr怎么用?PHP uniSubstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uniSubstr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:38,代码来源:class_formentry_dropdown.php
示例2: 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);
}
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:31,代码来源:class_formentry_template.php
示例3: writeToHistoryArray
private function writeToHistoryArray($strSessionKey)
{
$strQueryString = getServer("QUERY_STRING");
//Clean querystring of empty actions
if (uniSubstr($strQueryString, -8) == "&action=") {
$strQueryString = substr_replace($strQueryString, "", -8);
}
//Just do s.th., if not in the rights-mgmt
if (uniStrpos($strQueryString, "module=right") !== false) {
return;
}
$arrHistory = $this->objSession->getSession($strSessionKey);
//And insert just, if different to last entry
if ($strQueryString == $this->getHistoryEntry(0, $strSessionKey)) {
return;
}
//If we reach up here, we can enter the current query
if ($arrHistory !== false) {
array_unshift($arrHistory, $strQueryString);
while (count($arrHistory) > 10) {
array_pop($arrHistory);
}
} else {
$arrHistory = array($strQueryString);
}
//saving the new array to session
$this->objSession->setSession($strSessionKey, $arrHistory);
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:28,代码来源:class_history.php
示例4: runSingleFile
/**
* @param interface_admin|interface_portal $objViewInstance
*/
private function runSingleFile($objViewInstance)
{
$objReflection = new ReflectionClass($objViewInstance);
$arrMethods = $objReflection->getMethods();
$objAnnotations = new class_reflection(get_class($objViewInstance));
//collect the autotestable annotations located on class-level
foreach ($objAnnotations->getAnnotationValuesFromClass("@autoTestable") as $strValue) {
foreach (explode(",", $strValue) as $strOneMethod) {
echo "found method " . get_class($objViewInstance) . "@" . $strOneMethod . " marked as class-based @autoTestable, preparing call\n";
echo " calling via action() method\n";
$objViewInstance->action($strOneMethod);
}
}
/** @var ReflectionMethod $objOneMethod */
foreach ($arrMethods as $objOneMethod) {
if ($objAnnotations->hasMethodAnnotation($objOneMethod->getName(), "@autoTestable")) {
echo "found method " . get_class($objViewInstance) . "@" . $objOneMethod->getName() . " marked as @autoTestable, preparing call\n";
if (uniSubstr($objOneMethod->getName(), 0, 6) == "action" && $objReflection->hasMethod("action")) {
echo " calling via action() method\n";
$objViewInstance->action(uniSubstr($objOneMethod->getName(), 6));
} else {
echo " direct call";
$objOneMethod->invoke($objViewInstance);
}
}
}
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:30,代码来源:test_generalActionTest.php
示例5: getPlugins
/**
* This method returns all plugins registered for the current extension point searching at the predefined path.
* By default, new instances of the classes are returned. If the implementing
* class requires specific constructor arguments, pass them as the second argument and they will be
* used during instantiation.
*
* @param array $arrConstructorArguments
*
* @static
* @return interface_generic_plugin[]
*/
public function getPlugins($arrConstructorArguments = array())
{
//load classes in passed-folders
$strKey = md5($this->strSearchPath . $this->strPluginPoint);
if (!array_key_exists($strKey, self::$arrPluginClasses)) {
$strPluginPoint = $this->strPluginPoint;
$arrClasses = class_resourceloader::getInstance()->getFolderContent($this->strSearchPath, array(".php"), false, function ($strOneFile) use($strPluginPoint) {
$strOneFile = uniSubstr($strOneFile, 0, -4);
if (uniStripos($strOneFile, "class_") === false || uniStrpos($strOneFile, "class_testbase") !== false) {
return false;
}
$objReflection = new ReflectionClass($strOneFile);
if (!$objReflection->isAbstract() && $objReflection->implementsInterface("interface_generic_plugin")) {
$objMethod = $objReflection->getMethod("getExtensionName");
if ($objMethod->invoke(null) == $strPluginPoint) {
return true;
}
}
return false;
}, function (&$strOneFile) {
$strOneFile = uniSubstr($strOneFile, 0, -4);
});
self::$arrPluginClasses[$strKey] = $arrClasses;
}
$arrReturn = array();
foreach (self::$arrPluginClasses[$strKey] as $strOneClass) {
$objReflection = new ReflectionClass($strOneClass);
if (count($arrConstructorArguments) > 0) {
$arrReturn[] = $objReflection->newInstanceArgs($arrConstructorArguments);
} else {
$arrReturn[] = $objReflection->newInstance();
}
}
return $arrReturn;
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:46,代码来源:class_pluginmanager.php
示例6: installOrUpdate
/**
* Invokes the installer, if given.
* The installer itself is capable of detecting whether an update or a plain installation is required.
*
* @throws class_exception
* @return string
*/
public function installOrUpdate()
{
$strReturn = "";
if (uniStrpos($this->getObjMetadata()->getStrPath(), "core") === false) {
throw new class_exception("Current module not located at /core*.", class_exception::$level_ERROR);
}
if (!$this->isInstallable()) {
throw new class_exception("Current module isn't installable, not all requirements are given", class_exception::$level_ERROR);
}
//search for an existing installer
$objFilesystem = new class_filesystem();
$arrInstaller = $objFilesystem->getFilelist($this->objMetadata->getStrPath() . "/installer/", array(".php"));
if ($arrInstaller === false) {
$strReturn .= "Updating default template pack...\n";
$this->updateDefaultTemplate();
class_cache::flushCache();
return $strReturn;
}
//proceed with elements
foreach ($arrInstaller as $strOneInstaller) {
//skip samplecontent files
if (uniStrpos($strOneInstaller, "element") !== false) {
class_logger::getInstance(class_logger::PACKAGEMANAGEMENT)->addLogRow("triggering updateOrInstall() on installer " . $strOneInstaller . ", all requirements given", class_logger::$levelInfo);
//trigger update or install
$strName = uniSubstr($strOneInstaller, 0, -4);
/** @var $objInstaller interface_installer */
$objInstaller = new $strName();
$strReturn .= $objInstaller->installOrUpdate();
}
}
$strReturn .= "Updating default template pack...\n";
$this->updateDefaultTemplate();
return $strReturn;
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:41,代码来源:class_module_packagemanager_packagemanager_element.php
示例7: setValueToObject
public function setValueToObject()
{
$objReflection = new class_reflection($this->getObjSourceObject());
$strSetter = $objReflection->getSetter($this->getStrSourceProperty());
if ($strSetter !== null && uniStrtolower(uniSubstr($strSetter, 0, 6)) == "setobj" && !$this->getStrValue() instanceof class_date && $this->getStrValue() > 0) {
$this->setStrValue(new class_date($this->getStrValue()));
}
return parent::setValueToObject();
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:9,代码来源:class_formentry_date.php
示例8: getMessageproviders
/**
* @return interface_messageprovider[]
*/
public function getMessageproviders()
{
return class_resourceloader::getInstance()->getFolderContent("/system/messageproviders", array(".php"), false, function ($strOneFile) {
if (uniStrpos($strOneFile, "interface") !== false) {
return false;
}
return true;
}, function (&$strOneFile) {
$strOneFile = uniSubstr($strOneFile, 0, -4);
$strOneFile = new $strOneFile();
});
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:15,代码来源:class_module_messaging_messagehandler.php
示例9: processString
/**
* Calls the scriptlets in order to process additional tags and in order to enrich the content.
*
* @param string $strContent the content to process
* @param int $intContext context-selector used to find the matching scriptlets to apply. if not given, all contexts are applied - worst case!
*
* @return string
* @see interface_scriptlet
*/
public function processString($strContent, $intContext = null)
{
$arrScriptletFiles = class_resourceloader::getInstance()->getFolderContent("/system/scriptlets", array(".php"));
foreach ($arrScriptletFiles as $strPath => $strOneScriptlet) {
$strOneScriptlet = uniSubstr($strOneScriptlet, 0, -4);
/** @var $objScriptlet interface_scriptlet */
$objScriptlet = new $strOneScriptlet();
if ($objScriptlet instanceof interface_scriptlet && ($intContext == null || $intContext & $objScriptlet->getProcessingContext())) {
$strContent = $objScriptlet->processContent($strContent);
class_logger::getInstance("scriptlets.log")->addLogRow("processing call to " . $strOneScriptlet . ", filter: " . $intContext, class_logger::$levelInfo);
}
}
return $strContent;
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:23,代码来源:class_scriptlet_helper.php
示例10: getListOfWidgetsAvailable
/**
* Looks up all widgets available in the filesystem.
* ATTENTION: returns the class-name representation of a file, NOT the filename itself.
*
* @return string[]
*/
public static function getListOfWidgetsAvailable()
{
return class_resourceloader::getInstance()->getFolderContent("/admin/widgets/", array(".php"), false, function ($strFilename) {
if ($strFilename != "interface_adminwidget.php" && $strFilename != "class_adminwidget.php") {
$strFilename = uniSubstr($strFilename, 0, -4);
$objReflection = new ReflectionClass($strFilename);
if (!$objReflection->isAbstract() && $objReflection->implementsInterface("interface_adminwidget")) {
return true;
}
}
return false;
}, function (&$strFilename) {
$strFilename = uniSubstr($strFilename, 0, -4);
});
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:21,代码来源:class_module_dashboard_widget.php
示例11: getSystemParameter
public function getSystemParameter()
{
$strHeaderName = class_config::readPlainConfigsFromFilesystem("https_header");
$strHeaderValue = strtolower(class_config::readPlainConfigsFromFilesystem("https_header_value"));
$arrSystemParameter = array();
$arrSystemParameter["SCHEME"] = isset($_SERVER[$strHeaderName]) && strtolower($_SERVER[$strHeaderName]) == $strHeaderValue ? "https" : "http";
$arrSystemParameter["HOSTNAME"] = $_SERVER['SERVER_NAME'];
$strRequestUri = $_SERVER['REQUEST_URI'];
$path_parts = pathinfo($strRequestUri);
$arrSystemParameter["URLPATHNAME"] = $path_parts['dirname'];
if ($arrSystemParameter["URLPATHNAME"][0] == "/") {
$arrSystemParameter["URLPATHNAME"] = uniSubstr($arrSystemParameter["URLPATHNAME"], 1);
}
return $arrSystemParameter;
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:15,代码来源:seleniumtestsuitegenerator.php
示例12: processContent
/**
* Processes the content.
* Make sure to return the string again, otherwise the output will remain blank.
*
* @param string $strContent
*
* @return string
*/
public function processContent($strContent)
{
$strHighlight = trim(class_carrier::getInstance()->getParam("highlight"));
if ($strHighlight != "") {
$strHighlight = strip_tags($strHighlight);
$strJS = <<<JS
KAJONA.portal.loader.loadFile('/templates/default/js/jquery.highlight.js', function() { \$("body div[class='contentRight']").highlight("{$strHighlight}"); });
JS;
$strJS = "<script type=\"text/javascript\">" . $strJS . "</script>\n";
$intBodyClose = uniStripos($strContent, "</body>");
if ($intBodyClose !== false) {
$strContent = uniSubstr($strContent, 0, $intBodyClose) . $strJS . uniSubstr($strContent, $intBodyClose);
}
}
return $strContent;
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:24,代码来源:class_scriptlet_searchhighlight.php
示例13: walkFolderRecursive
function walkFolderRecursive($strStartFolder)
{
$objFilesystem = new class_filesystem();
$arrFilesAndFolders = $objFilesystem->getCompleteList($strStartFolder, array(".php"), array(), array(".", "..", ".svn"));
foreach ($arrFilesAndFolders["files"] as $arrOneFile) {
$strFilename = $arrOneFile["filename"];
//include the filecontent
$strContent = file_get_contents($strStartFolder . "/" . $strFilename);
if (uniSubstr($strContent, 0, 5) != "<?php") {
echo "Whitespace at the beginning of file >> " . $strStartFolder . "/" . $strFilename . " is:>" . uniSubstr($strContent, 0, 1) . "< << \n";
}
if (uniSubstr($strContent, -2) != "?>") {
echo "Whitespace at the end of file >> " . $strStartFolder . "/" . $strFilename . " << \n";
}
}
foreach ($arrFilesAndFolders["folders"] as $strOneFolder) {
walkFolderRecursive($strStartFolder . "/" . $strOneFolder);
}
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:19,代码来源:filetrimcheck.php
示例14: testModuleModels
public function testModuleModels()
{
echo "preparing object saves...\n";
class_carrier::getInstance()->getObjRights()->setBitTestMode(true);
$arrFiles = class_resourceloader::getInstance()->getFolderContent("/system", array(".php"), false, function ($strOneFile) {
if (uniStripos($strOneFile, "class_module_") !== false) {
$objClass = new ReflectionClass(uniSubstr($strOneFile, 0, -4));
if (!$objClass->isAbstract() && $objClass->isSubclassOf("class_model")) {
$objAnnotations = new class_reflection(uniSubstr($strOneFile, 0, -4));
//block from autotesting?
if ($objAnnotations->hasClassAnnotation("@blockFromAutosave")) {
echo "skipping class " . uniSubstr($strOneFile, 0, -4) . " due to @blockFromAutosave annotation" . "\n";
return false;
}
return true;
}
}
return false;
}, function (&$strOneFile) {
$strOneFile = uniSubstr($strOneFile, 0, -4);
$strOneFile = new $strOneFile();
});
$arrSystemids = array();
/** @var $objOneInstance class_model */
foreach ($arrFiles as $objOneInstance) {
echo "testing object of type " . get_class($objOneInstance) . "@" . $objOneInstance->getSystemid() . "\n";
$this->assertTrue($objOneInstance->updateObjectToDb(), "saving object " . get_class($objOneInstance));
$arrSystemids[$objOneInstance->getSystemid()] = get_class($objOneInstance);
echo " ...saved object of type " . get_class($objOneInstance) . "@" . $objOneInstance->getSystemid() . "\n";
}
$objObjectfactory = class_objectfactory::getInstance();
foreach ($arrSystemids as $strSystemid => $strClass) {
echo "instantiating " . $strSystemid . "@" . $strClass . "\n";
$objInstance = $objObjectfactory->getObject($strSystemid);
$this->assertTrue($objInstance != null);
$this->assertEquals(get_class($objInstance), $strClass);
echo "deleting " . $strSystemid . "@" . $strClass . "\n";
$objInstance->deleteObjectFromDatabase();
}
class_carrier::getInstance()->getObjRights()->setBitTestMode(false);
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:41,代码来源:test_generalModelTest.php
示例15: processPackageUpload
/**
* The real "download" or "upload" should be handled right here.
* All packages have to be downloaded to /project/temp in order to be processed afterwards.
*
* @return string the filename of the package downloaded
*/
public function processPackageUpload()
{
//fetch the upload, validate a few settings and copy the package to /project/temp
$arrSource = class_carrier::getInstance()->getParam("provider_local_file");
$strTarget = "/project/temp/" . generateSystemid() . ".zip";
$objFilesystem = new class_filesystem();
//Check file for correct filters
$strSuffix = uniStrtolower(uniSubstr($arrSource["name"], uniStrrpos($arrSource["name"], ".")));
if (in_array($strSuffix, array(".zip"))) {
if ($objFilesystem->copyUpload($strTarget, $arrSource["tmp_name"])) {
class_logger::getInstance(class_logger::PACKAGEMANAGEMENT)->addLogRow("uploaded package " . $arrSource["name"] . " to " . $strTarget, class_logger::$levelInfo);
class_resourceloader::getInstance()->flushCache();
class_classloader::getInstance()->flushCache();
class_reflection::flushCache();
return $strTarget;
}
}
class_logger::getInstance(class_logger::PACKAGEMANAGEMENT)->addLogRow("error in uploaded package " . $arrSource["name"] . " either wrong format or not writeable target folder", class_logger::$levelInfo);
@unlink($arrSource["tmp_name"]);
return null;
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:27,代码来源:class_module_packagemanager_contentprovider_local.php
示例16: 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;
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:21,代码来源:class_formentry_filedropdown.php
示例17: 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;
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:26,代码来源:class_systemtask_dbimport.php
示例18: testReports
public function testReports()
{
if (!defined("_skinwebpath_")) {
define("_skinwebpath_", "1");
}
echo "processing reports...\n";
$arrReportsInFs = class_resourceloader::getInstance()->getFolderContent("/admin/statsreports", array(".php"), false, function ($strOneFile) {
if (uniStripos($strOneFile, "class_stats_report") === false) {
return false;
}
return true;
}, function (&$strOneFile) {
$strOneFile = uniSubstr($strOneFile, 0, -4);
$strOneFile = new $strOneFile(class_carrier::getInstance()->getObjDB(), class_carrier::getInstance()->getObjToolkit("admin"), class_carrier::getInstance()->getObjLang());
});
$arrReports = array();
foreach ($arrReportsInFs as $objReport) {
if ($objReport instanceof interface_admin_statsreports) {
$arrReports[$objReport->getTitle()] = $objReport;
}
$objStartDate = new class_date();
$objStartDate->setPreviousDay();
$objEndDate = new class_date();
$objEndDate->setNextDay();
$intStartDate = mktime(0, 0, 0, $objStartDate->getIntMonth(), $objStartDate->getIntDay(), $objStartDate->getIntYear());
$intEndDate = mktime(0, 0, 0, $objEndDate->getIntMonth(), $objEndDate->getIntDay(), $objEndDate->getIntYear());
$objReport->setEndDate($intEndDate);
$objReport->setStartDate($intStartDate);
$objReport->setInterval(2);
}
/** @var interface_admin_statsreports $objReport */
foreach ($arrReports as $objReport) {
ob_start();
echo "processing report " . $objReport->getTitle() . "\n";
$objReport->getReport();
$objReport->getReportGraph();
}
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:38,代码来源:test_statsReportsTest.php
示例19: 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 "";
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:30,代码来源:class_formentry_dependentdropdown.php
示例20: uniStrTrim
/**
* Unicode-safe string trimmer
*
* @param string $strString string to wrap
* @param int $intLength
* @param string $strAdd string to add after wrapped string
*
* @return string
*/
function uniStrTrim($strString, $intLength, $strAdd = "…")
{
if ($intLength > 0 && uniStrlen($strString) > $intLength) {
return trim(uniSubstr($strString, 0, $intLength)) . $strAdd;
} else {
return $strString;
}
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:17,代码来源:functions.php
注:本文中的uniSubstr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论