本文整理汇总了PHP中DataHandler::urlFolderNameToMethodName方法的典型用法代码示例。如果您正苦于以下问题:PHP DataHandler::urlFolderNameToMethodName方法的具体用法?PHP DataHandler::urlFolderNameToMethodName怎么用?PHP DataHandler::urlFolderNameToMethodName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataHandler
的用法示例。
在下文中一共展示了DataHandler::urlFolderNameToMethodName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchController
/**
* @param $array_url tem que ser passado o retorno do Navigation::getURI()
* @return ReturnSearchClassVO
* @desc metodo para buscar controller baseado na url passada
*/
private static function searchController($array_url, $_startFolder = "")
{
//iniciando o objeto de retorno
$returnReturnSearchClassVO = new ReturnSearchClassVO();
$searchFileOrFolderName = "";
//array completa sem a parte filtrada da url
//echo $search_file_mode;
//echo $_url;
$array = $array_url;
//echo Debug::li("iniciando a busca, array recebida:");
//Debug::print_r($array);
$fullStringPath = implode("/", $array);
$contador = 0;
//varredura de hierarquia invertida
for ($i = count($array) - 1; $i >= 0; $i--) {
//echo "<br /><br />nova linha $i <br><hr /><br />";
//precisa tirar um item em que o indice máximo é o $i + 1
$stringPath = self::getParcialFolderPath($fullStringPath, self::URI_RETURN_TYPE_STRING, $i + 1);
//echo Debug::li("*1 stringPath = ".$stringPath."", FALSE, "FF8800");
$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("*2 lastFolder: ".$lastFolder."", FALSE, "FF4400");
$currentFolder = "";
if ($i < count($array)) {
$currentFolder = DataHandler::removeSpecialCharacters($array[$i]);
}
//echo Debug::li("*3 currentFolder: ".$currentFolder." ", FALSE, "FF1100");
//criando a array (além dos limites) - que não foi tratada
$contador++;
//echo Debug::li($contador." = valor de contador ", FALSE, "FFFF00");
$arrayRestFolder = self::getParcialFolderPath($fullStringPath, self::URI_RETURN_TYPE_ARRAY, count($array), count($array) - $contador);
//$arrayRestFolder = array_slice($array, count($array)-$contador , count($array));
//echo Debug::li("*4 arrayRestFolder: ".Debug::print_r($arrayRestFolder, true)." ", FALSE, "AA0000");
//echo " valor de arrayRestFolder ";
//echo Debug::print_r($arrayRestFolder);
$returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
$arrayRestFolder = self::getParcialFolderPath($fullStringPath, self::URI_RETURN_TYPE_ARRAY, FALSE, $i + 1);
//echo " valor de arrayRestFolder ";
//echo Debug::print_r($arrayRestFolder);
$stringPath = "";
if ($i > 0) {
$stringPath = self::getParcialFolderPath($fullStringPath, self::URI_RETURN_TYPE_STRING, $i - 1);
}
// echo Debug::li(" stringPath depois do if do mal: ".$stringPath, FALSE, "FFFF55");
$currentFolder = "";
if ($i < count($array)) {
$currentFolder = DataHandler::removeSpecialCharacters($array[$i]);
}
$currentFolder = str_replace("/", "", $currentFolder);
//procurando folder
$searchFileOrFolderName = DataHandler::urlFolderNameToClassName($currentFolder);
$tempMetodo = "init";
if ($i + 1 < count($array)) {
$tempMetodo = DataHandler::urlFolderNameToMethodName($array[$i + 1]);
}
$folderController = DataHandler::removeDobleBars($_startFolder . "/" . $stringPath . "/" . $searchFileOrFolderName . ".php");
if (file_exists($folderController)) {
$returnReturnSearchClassVO->success = TRUE;
$returnReturnSearchClassVO->file = $searchFileOrFolderName . ".php";
$returnReturnSearchClassVO->folder = DataHandler::removeDobleBars($_startFolder . "/" . $stringPath . "/");
$returnReturnSearchClassVO->urlToInclude = $folderController;
$returnReturnSearchClassVO->className = $searchFileOrFolderName;
$returnReturnSearchClassVO->methodName = $tempMetodo;
$returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
$className = $returnReturnSearchClassVO->className;
return $returnReturnSearchClassVO;
}
}
// end for($i = count($array)-1; $i >= 0; $i--){
return $returnReturnSearchClassVO;
}
示例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);
//.........这里部分代码省略.........