本文整理汇总了PHP中uniSubstr函数的典型用法代码示例。如果您正苦于以下问题:PHP uniSubstr函数的具体用法?PHP uniSubstr怎么用?PHP uniSubstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uniSubstr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
}
}
示例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;
}
示例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;
}
示例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();
}
示例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();
});
}
示例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;
}
示例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);
});
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}