当前位置: 首页>>代码示例>>PHP>>正文


PHP uniStrReplace函数代码示例

本文整理汇总了PHP中uniStrReplace函数的典型用法代码示例。如果您正苦于以下问题:PHP uniStrReplace函数的具体用法?PHP uniStrReplace怎么用?PHP uniStrReplace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了uniStrReplace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: installOrUpdate

 /**
  * Generic implementation, triggers the update or the install method, depending on the parts already installed.
  * @return string
  */
 public function installOrUpdate()
 {
     $strReturn = "";
     $objModule = null;
     if ($this->objMetadata->getStrType() == class_module_packagemanager_manager::STR_TYPE_ELEMENT) {
         if (class_module_system_module::getModuleByName("pages") !== null && is_dir(class_resourceloader::getInstance()->getCorePathForModule("module_pages", true))) {
             $objModule = class_module_pages_element::getElement(uniStrReplace("element_", "", $this->objMetadata->getStrTitle()));
         }
     } else {
         $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle());
     }
     if ($objModule === null) {
         class_logger::getInstance("triggering installation of " . $this->objMetadata->getStrTitle(), class_logger::$levelInfo);
         $strReturn .= $this->install();
     } else {
         $strVersionInstalled = $objModule->getStrVersion();
         $strVersionAvailable = $this->objMetadata->getStrVersion();
         if (version_compare($strVersionAvailable, $strVersionInstalled, ">")) {
             class_logger::getInstance("triggering update of " . $this->objMetadata->getStrTitle(), class_logger::$levelInfo);
             $strReturn .= $this->update();
         }
     }
     class_carrier::getInstance()->flushCache(class_carrier::INT_CACHE_TYPE_DBTABLES);
     return $strReturn;
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:29,代码来源:class_installer_base.php

示例2: uploadForm

 /**
  * @param string $formErrors
  *
  * @return string
  */
 private function uploadForm($formErrors = "")
 {
     $strReturn = "";
     //validate the rights
     $objFilemanagerRepo = new class_module_mediamanager_repo($this->arrElementData["char2"]);
     if ($objFilemanagerRepo->rightRight1()) {
         $strTemplateID = $this->objTemplate->readTemplate("/element_portalupload/" . $this->arrElementData["char1"], "portalupload_uploadform");
         $strDlFolderId = "";
         if ($this->getParam("action") == "mediaFolder") {
             $strDlFolderId = $this->getParam("systemid");
         }
         $arrTemplate = array();
         $arrTemplate["portaluploadDlfolder"] = $strDlFolderId;
         // check if there was an successfull upload before
         if ($this->getParam("uploadSuccess") == "1") {
             $arrTemplate["portaluploadSuccess"] = $this->getLang("portaluploadSuccess");
         }
         $arrTemplate["formErrors"] = $formErrors;
         $strAllowedFileRegex = uniStrReplace(array(".", ","), array("", "|"), $objFilemanagerRepo->getStrUploadFilter());
         $arrTemplate["formAction"] = class_link::getLinkPortalHref($this->getPagename(), "", $this->getAction(), "", $strDlFolderId);
         $arrTemplate["maxFileSize"] = class_carrier::getInstance()->getObjConfig()->getPhpMaxUploadSize();
         $arrTemplate["acceptFileTypes"] = $strAllowedFileRegex != "" ? "/(\\.|\\/)(" . $strAllowedFileRegex . ")\$/i" : "''";
         $arrTemplate["elementId"] = $this->arrElementData["content_id"];
         $arrTemplate["mediamanagerRepoId"] = $objFilemanagerRepo->getSystemid();
         $strReturn .= $this->fillTemplate($arrTemplate, $strTemplateID);
     } else {
         $strReturn .= $this->getLang("commons_error_permissions");
     }
     return $strReturn;
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:35,代码来源:class_element_portalupload_portal.php

示例3: 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;
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:42,代码来源:class_module_search_commons.php

示例4: actionGetReport

 /**
  * Triggers the "real" creation of the report and wraps the code inline into a xml-structure
  *
  * @return string
  * @permissions view
  */
 protected function actionGetReport()
 {
     $strPlugin = $this->getParam("plugin");
     $strReturn = "";
     $objPluginManager = new class_pluginmanager(class_module_stats_admin::$STR_PLUGIN_EXTENSION_POINT, "/admin/statsreports");
     $objPlugin = null;
     foreach ($objPluginManager->getPlugins(array(class_carrier::getInstance()->getObjDB(), $this->objToolkit, $this->getObjLang())) as $objOneReport) {
         if (uniStrReplace("class_stats_report_", "", get_class($objOneReport)) == $strPlugin) {
             $objPlugin = $objOneReport;
             break;
         }
     }
     if ($objPlugin !== null && $objPlugin instanceof interface_admin_statsreports) {
         //get date-params as ints
         $intStartDate = mktime(0, 0, 0, $this->objDateStart->getIntMonth(), $this->objDateStart->getIntDay(), $this->objDateStart->getIntYear());
         $intEndDate = mktime(0, 0, 0, $this->objDateEnd->getIntMonth(), $this->objDateEnd->getIntDay(), $this->objDateEnd->getIntYear());
         $objPlugin->setEndDate($intEndDate);
         $objPlugin->setStartDate($intStartDate);
         $objPlugin->setInterval($this->intInterval);
         $arrImage = $objPlugin->getReportGraph();
         if (!is_array($arrImage)) {
             $arrImage = array($arrImage);
         }
         foreach ($arrImage as $strImage) {
             if ($strImage != "") {
                 $strReturn .= $this->objToolkit->getGraphContainer($strImage);
             }
         }
         $strReturn .= $objPlugin->getReport();
         $strReturn = "<content><![CDATA[" . $strReturn . "]]></content>";
     }
     return $strReturn;
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:39,代码来源:class_module_stats_admin_xml.php

示例5: 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)
 {
     $objLang = class_carrier::getInstance()->getObjLang();
     $arrTemp = array();
     preg_match_all("#\\[lang,([A-Za-z0-9_]+),([0-9A-Za-z_]+)\\]#i", $strContent, $arrTemp);
     foreach ($arrTemp[0] as $intKey => $strSearchString) {
         $strContent = uniStrReplace($strSearchString, $objLang->getLang($arrTemp[1][$intKey], $arrTemp[2][$intKey]), $strContent);
     }
     return $strContent;
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:18,代码来源:class_scriptlet_lang.php

示例6: loadData

 /**
  * Loads the navigation-class and passes control
  *
  * @throws class_exception
  * @return string
  */
 public function loadData()
 {
     $strPath = class_resourceloader::getInstance()->getPathForFile("/portal/forms/" . $this->arrElementData["formular_class"]);
     if ($strPath === false) {
         throw new class_exception("failed to load form-class " . $this->arrElementData["formular_class"], class_exception::$level_ERROR);
     }
     require_once _realpath_ . $strPath;
     $strClassname = uniStrReplace(".php", "", $this->arrElementData["formular_class"]);
     $objForm = new $strClassname($this->arrElementData);
     $strReturn = $objForm->action();
     return $strReturn;
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:18,代码来源:class_element_formular_portal.php

示例7: sendHeaders

 /**
  *
  */
 public function sendHeaders()
 {
     if ($this->strRedirectUrl != "") {
         $this->strStatusCode = class_http_statuscodes::SC_REDIRECT;
         $this->arrAdditionalHeaders[] = "Location: " . uniStrReplace("&amp;", "&", $this->strRedirectUrl);
     }
     header($this->getStrStatusCode());
     header($this->getStrResponseType());
     foreach ($this->arrAdditionalHeaders as $strOneHeader) {
         header($strOneHeader);
     }
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:15,代码来源:class_response_object.php

示例8: getFASomeImage

 /**
  * @param string $strImage
  * @param string $strTooltip
  *
  * @return null|string
  */
 private function getFASomeImage($strImage, $strTooltip)
 {
     $strName = uniStrReplace(array(".png", ".gif"), "", $strImage);
     if (isset(self::$arrFAImages[$strName])) {
         if ($strTooltip == "") {
             return self::$arrFAImages[$strName];
         } else {
             return "<span rel=\"tooltip\" title=\"" . $strTooltip . "\" data-kajona-icon='" . $strName . "' >" . self::$arrFAImages[$strName] . "</span>";
         }
     }
     return null;
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:18,代码来源:class_adminskin_imageresolver.php

示例9: addFile

 /**
  * Adds a file to the zip-archive.
  * The second, optional param indicates the filename inside the archive
  *
  * @param string $strSourceFile
  * @param string $strTargetFile
  *
  * @return bool
  */
 public function addFile($strSourceFile, $strTargetFile = "")
 {
     $strSourceFile = uniStrReplace(_realpath_, "", $strSourceFile);
     if ($strTargetFile == "") {
         $strTargetFile = $strSourceFile;
     }
     $strTargetFile = ltrim($strTargetFile, "/");
     if (file_exists(_realpath_ . $strSourceFile)) {
         return $this->objArchive->addFile(_realpath_ . $strSourceFile, $strTargetFile);
     } else {
         return false;
     }
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:22,代码来源:class_zip.php

示例10: 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)
 {
     $arrTemp = array();
     preg_match_all("#\\[img,([ \\-+%A-Za-z0-9_\\./\\\\(\\)]+),([0-9]+),([0-9]+)(,fixed|,max|)\\]#i", $strContent, $arrTemp);
     foreach ($arrTemp[0] as $intKey => $strSearchString) {
         if (isset($arrTemp[4][$intKey]) && $arrTemp[4][$intKey] == ",fixed") {
             $strContent = uniStrReplace($strSearchString, _webpath_ . "/image.php?image=" . urlencode($arrTemp[1][$intKey]) . "&amp;fixedWidth=" . $arrTemp[2][$intKey] . "&amp;fixedHeight=" . $arrTemp[3][$intKey], $strContent);
         } else {
             $strContent = uniStrReplace($strSearchString, _webpath_ . "/image.php?image=" . urlencode($arrTemp[1][$intKey]) . "&amp;maxWidth=" . $arrTemp[2][$intKey] . "&amp;maxHeight=" . $arrTemp[3][$intKey], $strContent);
         }
     }
     //fast way, no urlencode required
     //$strContent = preg_replace("#\[img,([A-Za-z0-9_\./\\\]+),([0-9]+),([0-9]+)\]#i", _webpath_."/image.php?image=\${1}&amp;maxWidth=\${2}&amp;maxHeight=\${3}", $strContent);
     return $strContent;
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:23,代码来源:class_scriptlet_imagehelper.php

示例11: 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)
 {
     $arrTemp = array();
     preg_match_all("#\\[qrcode,([ \\?\\&\\-=:+%;A-Za-z0-9_\\./\\\\]+)(,[1-3])\\]#i", $strContent, $arrTemp);
     foreach ($arrTemp[0] as $intKey => $strSearchString) {
         $intSize = 1;
         $strSubstr = isset($arrTemp[2][$intKey]) ? (int) substr($arrTemp[2][$intKey], 1) : 1;
         if ($strSubstr >= 1 && $strSubstr <= 3) {
             $intSize = $strSubstr;
         }
         $objQrCode = new class_qrcode();
         $objQrCode->setIntSize($intSize);
         $strImage = $objQrCode->getImageForString($arrTemp[1][$intKey]);
         $strContent = uniStrReplace($strSearchString, _webpath_ . "/" . $strImage, $strContent);
     }
     return $strContent;
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:25,代码来源:class_scriptlet_qrcode.php

示例12: testPerformanceTest

 public function testPerformanceTest()
 {
     $objLang = class_lang::getInstance();
     $arrParameters = array("lorem", "ipsum", "dolor", "sit", "amet");
     $strPropertyRaw = "lorem {0} ipsum {1} dolor {2} sit {3} amet {4} {0}";
     $intStart = microtime(true);
     for ($intI = 0; $intI <= 100; $intI++) {
         $strProperty = $strPropertyRaw;
         foreach ($arrParameters as $intKey => $strParameter) {
             $strProperty = uniStrReplace("{" . $intKey . "}", $strParameter, $strProperty);
         }
         $this->assertEquals($strProperty, "lorem lorem ipsum ipsum dolor dolor sit sit amet amet lorem");
     }
     $intEnd = microtime(true);
     echo "uniStrReplace: " . ($intEnd - $intStart) . " sec\n";
     $intStart = microtime(true);
     for ($intI = 0; $intI <= 100; $intI++) {
         $strProperty = uniStrReplace(array_map(function ($i) {
             return "{" . $i . "}";
         }, array_keys($arrParameters)), $arrParameters, $strPropertyRaw);
         $this->assertEquals($strProperty, "lorem lorem ipsum ipsum dolor dolor sit sit amet amet lorem");
     }
     $intEnd = microtime(true);
     echo "array based uniStrReplace: " . ($intEnd - $intStart) . " sec\n";
     $intStart = microtime(true);
     for ($intI = 0; $intI <= 100; $intI++) {
         $strProperty = preg_replace_callback("/{(\\d)}/", function ($hit) use($arrParameters) {
             return $arrParameters[$hit[1]];
         }, $strPropertyRaw);
         $this->assertEquals($strProperty, "lorem lorem ipsum ipsum dolor dolor sit sit amet amet lorem");
     }
     $intEnd = microtime(true);
     echo "preg_replace based : " . ($intEnd - $intStart) . " sec\n";
     $intStart = microtime(true);
     for ($intI = 0; $intI <= 100; $intI++) {
         $strProperty = $objLang->replaceParams($strPropertyRaw, $arrParameters);
         $this->assertEquals($strProperty, "lorem lorem ipsum ipsum dolor dolor sit sit amet amet lorem");
     }
     $intEnd = microtime(true);
     echo "current implementation : " . ($intEnd - $intStart) . " sec\n";
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:41,代码来源:test_langTest.php

示例13: actionList

 /**
  * Returns a list of all posts in the current gb
  *
  * @return string
  * @permissions view
  */
 protected function actionList()
 {
     $strReturn = "";
     $arrTemplate = array();
     $arrTemplate["liste_posts"] = "";
     //Load all posts
     $objArraySectionIterator = new class_array_section_iterator(class_module_guestbook_post::getPostsCount($this->arrElementData["guestbook_id"], true));
     $objArraySectionIterator->setIntElementsPerPage($this->arrElementData["guestbook_amount"]);
     $objArraySectionIterator->setPageNumber((int) ($this->getParam("pv") != "" ? $this->getParam("pv") : 1));
     $objArraySectionIterator->setArraySection(class_module_guestbook_post::getPosts($this->arrElementData["guestbook_id"], true, $objArraySectionIterator->calculateStartPos(), $objArraySectionIterator->calculateEndPos()));
     $arrObjPosts = $this->objToolkit->simplePager($objArraySectionIterator, $this->getLang("commons_next"), $this->getLang("commons_back"), "", $this->getPagename());
     //and put posts into a template
     /** @var class_module_guestbook_post $objOnePost */
     foreach ($objArraySectionIterator as $objOnePost) {
         if ($objOnePost->rightView()) {
             $strTemplatePostID = $this->objTemplate->readTemplate("/module_guestbook/" . $this->arrElementData["guestbook_template"], "post");
             $arrTemplatePost = array();
             $arrTemplatePost["post_name"] = "<a href=\"mailto:" . $objOnePost->getStrGuestbookPostEmail() . "\">" . $objOnePost->getStrGuestbookPostName() . "</a>";
             $arrTemplatePost["post_name_plain"] = $objOnePost->getStrGuestbookPostName();
             $arrTemplatePost["post_email"] = $objOnePost->getStrGuestbookPostEmail();
             $arrTemplatePost["post_page"] = "<a href=\"http://" . $objOnePost->getStrGuestbookPostPage() . "\">" . $objOnePost->getStrGuestbookPostPage() . "</a>";
             //replace encoded newlines
             $arrTemplatePost["post_text"] = uniStrReplace("&lt;br /&gt;", "<br />", $objOnePost->getStrGuestbookPostText());
             $arrTemplatePost["post_date"] = timeToString($objOnePost->getIntGuestbookPostDate());
             $arrTemplate["liste_posts"] .= $this->objTemplate->fillTemplate($arrTemplatePost, $strTemplatePostID, false);
         }
     }
     //link to the post-form & pageview links
     $arrTemplate["link_newentry"] = getLinkPortal($this->getParam("page") ? $this->getParam("page") : "", "", "", $this->getLang("eintragen"), "insertGuestbook");
     $arrTemplate["link_forward"] = $arrObjPosts["strForward"];
     $arrTemplate["link_pages"] = $arrObjPosts["strPages"];
     $arrTemplate["link_back"] = $arrObjPosts["strBack"];
     $strTemplateID = $this->objTemplate->readTemplate("/module_guestbook/" . $this->arrElementData["guestbook_template"], "list");
     $strReturn .= $this->fillTemplate($arrTemplate, $strTemplateID);
     return $strReturn . "";
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:42,代码来源:class_module_guestbook_portal.php

示例14: renderTagAction

 /**
  * Renders the icon to edit a records tags
  * @param class_model|interface_model $objListEntry
  * @return string
  */
 protected function renderTagAction(class_model $objListEntry)
 {
     if ($objListEntry->getIntRecordDeleted() == 1) {
         return "";
     }
     if ($objListEntry->rightView()) {
         //the tag list is more complex and wrapped by a js-logic to load the tags by ajax afterwards
         // @codingStandardsIgnoreStart
         $strOnClick = "KAJONA.admin.folderview.dialog.setContentIFrame('" . class_link::getLinkAdminHref("tags", "genericTagForm", "&systemid=" . $objListEntry->getSystemid()) . "'); KAJONA.admin.folderview.dialog.setTitle('" . uniStrReplace(array("\r", "\n"), "", strip_tags(nl2br($objListEntry->getStrDisplayName()))) . "'); KAJONA.admin.folderview.dialog.init(); return false;";
         $strLink = "<a href=\"#\" onclick=\"" . $strOnClick . "\" title=\"" . $this->getLang("commons_edit_tags") . "\" rel=\"tagtooltip\" data-systemid=\"" . $objListEntry->getSystemid() . "\">" . class_adminskin_helper::getAdminImage("icon_tag", $this->getLang("commons_edit_tags"), true) . "</a>";
         // @codingStandardsIgnoreEnd
         return $this->objToolkit->listButton($strLink);
     }
     return "";
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:20,代码来源:class_admin_simple.php

示例15: createFilename

/**
 * Creates a filename valid for filesystems
 *
 * @param string $strName
 * @param bool $bitFolder
 *
 * @return string
 */
function createFilename($strName, $bitFolder = false)
{
    $strName = uniStrtolower($strName);
    if (!$bitFolder) {
        $strEnding = uniSubstr($strName, uniStrrpos($strName, ".") + 1);
    } else {
        $strEnding = "";
    }
    if (!$bitFolder) {
        $strReturn = uniSubstr($strName, 0, uniStrrpos($strName, "."));
    } else {
        $strReturn = $strName;
    }
    //Filter non allowed chars
    $arrSearch = array(" ", ".", ":", "ä", "ö", "ü", "/", "ß", "!");
    $arrReplace = array("_", "_", "_", "ae", "oe", "ue", "_", "ss", "_");
    $strReturn = uniStrReplace($arrSearch, $arrReplace, $strReturn);
    //and the ending
    if (!$bitFolder) {
        $strEnding = uniStrReplace($arrSearch, $arrReplace, $strEnding);
    }
    //remove all other special characters
    $strTemp = preg_replace("/[^A-Za-z0-9_-]/", "", $strReturn);
    //do a replacing in the ending, too
    if ($strEnding != "") {
        //remove all other special characters
        $strEnding = "." . preg_replace("/[^A-Za-z0-9_-]/", "", $strEnding);
    }
    $strReturn = $strTemp . $strEnding;
    return $strReturn;
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:39,代码来源:functions.php


注:本文中的uniStrReplace函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。