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


PHP DataHandler::removeLastBar方法代码示例

本文整理汇总了PHP中DataHandler::removeLastBar方法的典型用法代码示例。如果您正苦于以下问题:PHP DataHandler::removeLastBar方法的具体用法?PHP DataHandler::removeLastBar怎么用?PHP DataHandler::removeLastBar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataHandler的用法示例。


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

示例1: searchFile

 /**
  * @param $array_url retorno da Navigation::getUri
  * @param $_startFolder string passe o caminho da view
  * @return ReturnSearchClassVO
  */
 private static function searchFile($array_url, $_startFolder = "")
 {
     //iniciando o objeto de retorno
     $returnReturnSearchClassVO = new ReturnSearchClassVO();
     $searchFileOrFolderName = "";
     //($searchFileOrFolderName != "")?"/".DataHandler::removeSpecialCharacters($searchFileOrFolderName):"";
     //array completa sem a parte filtrada da url
     $array = $array_url;
     //Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY);
     $contador = 0;
     //varredura de hierarquia invertida
     for ($i = count($array) - 1; $i >= 0; $i--) {
         //pegando o string path, tirando o ultimo folder, pois estara no lastFolder
         $stringPath = implode("/", array_slice($array, 0, $i));
         $stringPath = DataHandler::removeLastBar($stringPath);
         $lastFolder = DataHandler::removeSpecialCharacters($array[$i]);
         //criando a array (além dos limites) - que não foi tratada
         $contador++;
         $arrayRestFolder = array_slice($array, count($array) - $contador, count($array));
         $returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
         //echo Debug::li("<b>{$i}</b>[11] Navigation::SEARCH_FILE_MODE_FILE : ".$_startFolder."----".$stringPath." ");
         $searchFileOrFolderName = "";
         //verifica se tem CAMINHO/ultimaPasta.php
         $caminhoBase = $_startFolder . "/" . trim($stringPath) . "/" . $lastFolder;
         $caminhoBase = DataHandler::removeDobleBars(DataHandler::removeDobleBars($caminhoBase));
         if (file_exists($caminhoBase . ".php")) {
             $returnReturnSearchClassVO->success = TRUE;
             $returnReturnSearchClassVO->className = "";
             $returnReturnSearchClassVO->folder = "";
             $returnReturnSearchClassVO->urlToInclude = $caminhoBase . ".php";
             $returnReturnSearchClassVO->file = $lastFolder . ".php";
             $returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
             return $returnReturnSearchClassVO;
         }
         //verifica se existe CAMINHO/ultimaPasta/index.php
         if (file_exists($caminhoBase . "/index.php")) {
             $returnReturnSearchClassVO->success = TRUE;
             $returnReturnSearchClassVO->className = "";
             $returnReturnSearchClassVO->folder = "";
             $returnReturnSearchClassVO->urlToInclude = $caminhoBase . "/index.php";
             $returnReturnSearchClassVO->file = "index.php";
             $returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
             //echo Debug::li("<b>{$i}</b>[11] Navigation::SEARCH_FILE_MODE_FILE : ". $_startFolder.$stringPath."/index.php");
             return $returnReturnSearchClassVO;
         }
     }
     // end for($i = count($array)-1; $i >= 0; $i--){
     return $returnReturnSearchClassVO;
 }
开发者ID:reytuty,项目名称:facil,代码行数:54,代码来源:HttpRequestController.php

示例2: searchFileOrFolder

 /**
  * Retorna apenas 1 resultado dentro do ReturnSearchFileVO, os dados em ReturnSearchFileVO são todos referentes ao mesmo resultado
  * @param $_startFolder 	string
  * @param $searchClass 		string
  * @return ReturnSearchClassVO
  */
 public static function searchFileOrFolder($_urlToIgnore = "", $_startFolder = "", $search_file_mode = Navigation::SEARCH_FILE_MODE_FILE, $searchFileOrFolderName = "", $autoInclude = FALSE)
 {
     //iniciando o objeto de retorno
     $returnReturnSearchClassVO = new ReturnSearchClassVO();
     $searchFileOrFolderName = $searchFileOrFolderName != "" ? "/" . DataHandler::removeSpecialCharacters($searchFileOrFolderName) : "";
     //array completa sem a parte filtrada da url
     $array = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY);
     //Debug::print_r($array);
     $contador = 0;
     //varredura de hierarquia invertida
     for ($i = count($array) - 1; $i >= 0; $i--) {
         //echo Debug::li($i." = valor de i ", FALSE, "FFFF00");
         switch ($search_file_mode) {
             case Navigation::SEARCH_FILE_MODE_CLASS_AND_METHOD:
                 $arrayRestFolder = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY, FALSE, $i + 1);
                 //echo " valor de arrayRestFolder ";
                 //echo Debug::print_r($arrayRestFolder);
                 $stringPath = "";
                 if ($i > 0) {
                     $stringPath = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_STRING, $i - 1);
                 }
                 //echo Debug::li($stringPath." = valor de stringPath ", FALSE, "FFFF55");
                 $currentFolder = "";
                 if ($i < count($array)) {
                     $currentFolder = DataHandler::removeSpecialCharacters($array[$i]);
                 }
                 //echo Debug::li($currentFolder." = valor de currentFolder ", FALSE, "FFFF55");
                 $currentFolder = str_replace("/", "", $currentFolder);
                 //echo Debug::li($currentFolder." = valor de currentFolder ", FALSE, "FFFF55");
                 //procurando folder
                 $searchFileOrFolderName = DataHandler::urlFolderNameToClassName($currentFolder);
                 //echo " valor de searchFileOrFolderName ";
                 //echo Debug::print_r($searchFileOrFolderName);
                 //echo "<br>";
                 $tempMetodo = "init";
                 if ($i + 1 < count($array)) {
                     $tempMetodo = DataHandler::urlFolderNameToMethodName($array[$i + 1]);
                 }
                 //echo Debug::li("<b>tempMetodo:".$tempMetodo."</b>", false, NULL, NULL, "0000ff");
                 //echo $_startFolder.$stringPath."/".$searchFileOrFolderName.".php";
                 if (file_exists($_startFolder . $stringPath . "/" . $searchFileOrFolderName . ".php")) {
                     //echo Debug::li("<b>A classe:".$_startFolder.$stringPath."/".$searchFileOrFolderName.".php </b>");
                     $returnReturnSearchClassVO->success = TRUE;
                     $returnReturnSearchClassVO->file = $searchFileOrFolderName . ".php";
                     $returnReturnSearchClassVO->folder = DataHandler::removeDobleBars($_startFolder . $stringPath . "/");
                     $returnReturnSearchClassVO->urlToInclude = DataHandler::removeDobleBars($_startFolder . $stringPath . "/" . $searchFileOrFolderName . ".php");
                     $returnReturnSearchClassVO->className = $searchFileOrFolderName;
                     $returnReturnSearchClassVO->methodName = $tempMetodo;
                     $returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
                     $className = $returnReturnSearchClassVO->className;
                     if ($autoInclude) {
                         include_once $_startFolder . $stringPath . "/" . $searchFileOrFolderName . ".php";
                         //echo $className;
                         $classe = new $className();
                         //inicia o metodo como vazio
                         $returnReturnSearchClassVO->methodName = "init";
                         //Se existir uma pasta acima dessa, ve qual é pois pode ser tentativa de acessar metodo
                         if ($i + 1 < count($array)) {
                             //echo Debug::li(" >>>>> ".$array[$i+1]);
                             $tempMetodo = DataHandler::urlFolderNameToMethodName($array[$i + 1]);
                             //verifica se o metodo existe
                             if (ClassHandler::isMethodPublic($classe, $tempMetodo)) {
                                 $returnReturnSearchClassVO->methodName = $tempMetodo;
                             }
                         }
                         $metodo = $returnReturnSearchClassVO->methodName;
                         //echo $metodo;
                         return $classe->{$metodo}();
                     }
                     return $returnReturnSearchClassVO;
                 }
                 break;
             case Navigation::SEARCH_FILE_MODE_FILE:
             default:
                 $stringPath = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_STRING, $i + 1);
                 //echo Debug::li($stringPath." = valor de stringPath ", FALSE, "FFFF00");
                 $stringPath = DataHandler::removeLastBar($stringPath);
                 //echo Debug::li($stringPath." = valor de stringPath ", FALSE, "FFFF00");
                 $lastFolder = "";
                 if ($i + 1 < count($array)) {
                     $lastFolder = "/" . DataHandler::removeSpecialCharacters($array[$i + 1]);
                 }
                 //echo Debug::li($lastFolder." = valor de lastFolder ", FALSE, "FFFF00");
                 $currentFolder = "";
                 if ($i < count($array)) {
                     $currentFolder = DataHandler::removeSpecialCharacters($array[$i]);
                 }
                 //echo Debug::li($currentFolder." = valor de currentFolder ", FALSE, "FFFF00");
                 //criando a array (além dos limites) - que não foi tratada
                 $contador++;
                 //echo Debug::li($contador." = valor de contador ", FALSE, "FFFF00");
                 $arrayRestFolder = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY, count($array), count($array) - $contador);
                 //echo " valor de arrayRestFolder ";
                 //echo Debug::print_r($arrayRestFolder);
//.........这里部分代码省略.........
开发者ID:reytuty,项目名称:facil,代码行数:101,代码来源:Navigation.class.php


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