本文整理汇总了PHP中Pimcore_Tool::isValidPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Pimcore_Tool::isValidPath方法的具体用法?PHP Pimcore_Tool::isValidPath怎么用?PHP Pimcore_Tool::isValidPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore_Tool
的用法示例。
在下文中一共展示了Pimcore_Tool::isValidPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getByPath
/**
* Static helper to get an asset by the passed path (returned is not the concrete asset like Asset_Folder!)
*
* @param string $path
* @return Asset
*/
public static function getByPath($path)
{
// remove trailing slash
if ($path != "/") {
$path = rtrim($path, "/ ");
}
// correct wrong path (root-node problem)
$path = str_replace("//", "/", $path);
try {
$asset = new Asset();
if (Pimcore_Tool::isValidPath($path)) {
$asset->getResource()->getByPath($path);
return self::getById($asset->getId());
}
} catch (Exception $e) {
Logger::warning($e);
}
return null;
}
示例2: pathExists
/**
* @static
* @param $path
* @return bool
*/
public static function pathExists($path, $type = null)
{
$path = Element_Service::correctPath($path);
try {
$object = new Object_Abstract();
if (Pimcore_Tool::isValidPath($path)) {
$object->getResource()->getByPath($path);
return true;
}
} catch (Exception $e) {
}
return false;
}
示例3: getByPath
/**
* Static helper to get an asset by the passed path (returned is not the concrete asset like Asset_Folder!)
*
* @param string $path
* @return Asset
*/
public static function getByPath($path)
{
$path = Element_Service::correctPath($path);
try {
$asset = new Asset();
if (Pimcore_Tool::isValidPath($path)) {
$asset->getResource()->getByPath($path);
return self::getById($asset->getId());
}
} catch (Exception $e) {
Logger::warning($e);
}
return null;
}
示例4: pathExists
/**
* @static
* @param $path
* @return bool
*/
public static function pathExists($path)
{
$path = Element_Service::correctPath($path);
try {
$document = new Document();
// validate path
if (Pimcore_Tool::isValidPath($path)) {
$document->getResource()->getByPath($path);
return true;
}
} catch (Exception $e) {
}
return false;
}