本文整理汇总了PHP中AJXP_Controller::applyIncludeHook方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Controller::applyIncludeHook方法的具体用法?PHP AJXP_Controller::applyIncludeHook怎么用?PHP AJXP_Controller::applyIncludeHook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Controller
的用法示例。
在下文中一共展示了AJXP_Controller::applyIncludeHook方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter
/**
* Filter the very basic keywords from the XML : AJXP_USER, AJXP_INSTALL_PATH, AJXP_DATA_PATH
* Calls the vars.filter hooks.
* @static
* @param $value
* @return mixed|string
*/
public static function filter($value)
{
if (is_string($value) && strpos($value, "AJXP_USER") !== false) {
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null) {
$loggedUser = $loggedUser->getId();
$value = str_replace("AJXP_USER", $loggedUser, $value);
} else {
return "";
}
} else {
$value = str_replace("AJXP_USER", "shared", $value);
}
}
if (is_string($value) && strpos($value, "AJXP_INSTALL_PATH") !== false) {
$value = str_replace("AJXP_INSTALL_PATH", AJXP_INSTALL_PATH, $value);
}
if (is_string($value) && strpos($value, "AJXP_DATA_PATH") !== false) {
$value = str_replace("AJXP_DATA_PATH", AJXP_DATA_PATH, $value);
}
$tab = array(&$value);
AJXP_Controller::applyIncludeHook("vars.filter", $tab);
return $value;
}
示例2: filter
/**
* Filter the very basic keywords from the XML : AJXP_USER, AJXP_INSTALL_PATH, AJXP_DATA_PATH
* Calls the vars.filter hooks.
* @static
* @param $value
* @return mixed|string
*/
public static function filter($value)
{
if (is_string($value) && strpos($value, "AJXP_USER") !== false) {
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null) {
if ($loggedUser->hasParent() && $loggedUser->getResolveAsParent()) {
$loggedUserId = $loggedUser->getParent();
} else {
$loggedUserId = $loggedUser->getId();
}
$value = str_replace("AJXP_USER", $loggedUserId, $value);
} else {
return "";
}
} else {
$value = str_replace("AJXP_USER", "shared", $value);
}
}
if (is_string($value) && strpos($value, "AJXP_GROUP_PATH") !== false) {
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null) {
$gPath = $loggedUser->getGroupPath();
$value = str_replace("AJXP_GROUP_PATH_FLAT", str_replace("/", "_", trim($gPath, "/")), $value);
$value = str_replace("AJXP_GROUP_PATH", $gPath, $value);
} else {
return "";
}
} else {
$value = str_replace(array("AJXP_GROUP_PATH", "AJXP_GROUP_PATH_FLAT"), "shared", $value);
}
}
if (is_string($value) && strpos($value, "AJXP_INSTALL_PATH") !== false) {
$value = str_replace("AJXP_INSTALL_PATH", AJXP_INSTALL_PATH, $value);
}
if (is_string($value) && strpos($value, "AJXP_DATA_PATH") !== false) {
$value = str_replace("AJXP_DATA_PATH", AJXP_DATA_PATH, $value);
}
$tab = array(&$value);
AJXP_Controller::applyIncludeHook("vars.filter", $tab);
return $value;
}
示例3: replaceAjxpXmlKeywords
/**
* Dynamically replace XML keywords with their live values.
* AJXP_SERVER_ACCESS, AJXP_MIMES_*,AJXP_ALL_MESSAGES, etc.
* @static
* @param string $xml
* @param bool $stripSpaces
* @return mixed
*/
public static function replaceAjxpXmlKeywords($xml, $stripSpaces = false)
{
$messages = ConfService::getMessages();
$confMessages = ConfService::getMessagesConf();
$matches = array();
if (isset($_SESSION["AJXP_SERVER_PREFIX_URI"])) {
//$xml = str_replace("AJXP_THEME_FOLDER", $_SESSION["AJXP_SERVER_PREFIX_URI"].AJXP_THEME_FOLDER, $xml);
$xml = str_replace("AJXP_SERVER_ACCESS", $_SESSION["AJXP_SERVER_PREFIX_URI"] . AJXP_SERVER_ACCESS, $xml);
} else {
//$xml = str_replace("AJXP_THEME_FOLDER", AJXP_THEME_FOLDER, $xml);
$xml = str_replace("AJXP_SERVER_ACCESS", AJXP_SERVER_ACCESS, $xml);
}
$xml = str_replace("AJXP_APPLICATION_TITLE", ConfService::getCoreConf("APPLICATION_TITLE"), $xml);
$xml = str_replace("AJXP_MIMES_EDITABLE", AJXP_Utils::getAjxpMimes("editable"), $xml);
$xml = str_replace("AJXP_MIMES_IMAGE", AJXP_Utils::getAjxpMimes("image"), $xml);
$xml = str_replace("AJXP_MIMES_AUDIO", AJXP_Utils::getAjxpMimes("audio"), $xml);
$xml = str_replace("AJXP_MIMES_ZIP", AJXP_Utils::getAjxpMimes("zip"), $xml);
$authDriver = ConfService::getAuthDriverImpl();
if ($authDriver != NULL) {
$loginRedirect = $authDriver->getLoginRedirect();
$xml = str_replace("AJXP_LOGIN_REDIRECT", $loginRedirect !== false ? "'" . $loginRedirect . "'" : "false", $xml);
}
$xml = str_replace("AJXP_REMOTE_AUTH", "false", $xml);
$xml = str_replace("AJXP_NOT_REMOTE_AUTH", "true", $xml);
$xml = str_replace("AJXP_ALL_MESSAGES", "MessageHash=" . json_encode(ConfService::getMessages()) . ";", $xml);
if (preg_match_all("/AJXP_MESSAGE(\\[.*?\\])/", $xml, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$messId = str_replace("]", "", str_replace("[", "", $match[1]));
$xml = str_replace("AJXP_MESSAGE[{$messId}]", $messages[$messId], $xml);
}
}
if (preg_match_all("/CONF_MESSAGE(\\[.*?\\])/", $xml, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$messId = str_replace(array("[", "]"), "", $match[1]);
$message = $messId;
if (array_key_exists($messId, $confMessages)) {
$message = $confMessages[$messId];
}
$xml = str_replace("CONF_MESSAGE[{$messId}]", AJXP_Utils::xmlEntities($message), $xml);
}
}
if (preg_match_all("/MIXIN_MESSAGE(\\[.*?\\])/", $xml, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$messId = str_replace(array("[", "]"), "", $match[1]);
$message = $messId;
if (array_key_exists($messId, $confMessages)) {
$message = $confMessages[$messId];
}
$xml = str_replace("MIXIN_MESSAGE[{$messId}]", AJXP_Utils::xmlEntities($message), $xml);
}
}
if ($stripSpaces) {
$xml = preg_replace("/[\n\r]?/", "", $xml);
$xml = preg_replace("/\t/", " ", $xml);
}
$xml = str_replace(array('xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"', 'xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd"'), "", $xml);
$tab = array(&$xml);
AJXP_Controller::applyIncludeHook("xml.filter", $tab);
return $xml;
}
示例4: createUserObject
/**
* Instantiate a new AbstractAjxpUser
*
* @param String $userId
* @return AbstractAjxpUser
*/
public function createUserObject($userId)
{
$kvCache = ConfService::getInstance()->getKeyValueCache();
$test = $kvCache->fetch("pydio:user:" . $userId);
if ($test !== false && is_a($test, "AbstractAjxpUser")) {
if ($test->personalRole == null) {
$test->personalRole = $test->roles["AJXP_USR_/" . $userId];
}
$test->recomputeMergedRole();
return $test;
}
$userId = AuthService::filterUserSensitivity($userId);
$abstractUser = $this->instantiateAbstractUserImpl($userId);
if (!$abstractUser->storageExists()) {
AuthService::updateDefaultRights($abstractUser);
}
AuthService::updateAutoApplyRole($abstractUser);
AuthService::updateAuthProvidedData($abstractUser);
$args = array(&$abstractUser);
AJXP_Controller::applyIncludeHook("include.user.updateUserObject", $args);
$kvCache->save("pydio:user:" . $userId, $abstractUser);
return $abstractUser;
}
示例5: initRepositoriesListInst
/**
* @param $scope String "user", "all"
* @param bool $includeShared
* @return array
*/
protected function initRepositoriesListInst($scope = "user", $includeShared = true)
{
// APPEND CONF FILE REPOSITORIES
$loggedUser = AuthService::getLoggedUser();
$objList = array();
if ($loggedUser != null) {
$l = $loggedUser->getLock();
if (!empty($l)) {
return $objList;
}
}
foreach ($this->configs["DEFAULT_REPOSITORIES"] as $index => $repository) {
$repo = self::createRepositoryFromArray($index, $repository);
if ($scope == "user" && $loggedUser != null && !self::repositoryIsAccessible($index, $repo, $loggedUser)) {
continue;
}
$repo->setWriteable(false);
$objList["" . $repo->getId()] = $repo;
}
// LOAD FROM DRIVER
$confDriver = self::getConfStorageImpl();
if ($scope == "user") {
$acls = array();
if (AuthService::getLoggedUser() != null) {
$acls = AuthService::getLoggedUser()->mergedRole->listAcls(true);
}
if (!count($acls)) {
$drvList = array();
} else {
$criteria = array("uuid" => array_keys($acls));
$drvList = $confDriver->listRepositoriesWithCriteria($criteria);
}
} else {
if ($includeShared) {
$drvList = $confDriver->listRepositories();
} else {
$drvList = $confDriver->listRepositoriesWithCriteria(array("owner_user_id" => AJXP_FILTER_EMPTY));
}
}
if (is_array($drvList)) {
/**
* @var $drvList Repository[]
*/
foreach ($drvList as $repoId => $repoObject) {
$driver = AJXP_PluginsService::getInstance()->getPluginByTypeName("access", $repoObject->getAccessType());
if (!is_object($driver) || !$driver->isEnabled()) {
unset($drvList[$repoId]);
} else {
$repoObject->setId($repoId);
$drvList[$repoId] = $repoObject;
}
if ($repoObject->hasParent() && !ConfService::findRepositoryByIdOrAlias($repoObject->getParentId())) {
AJXP_Logger::error(__CLASS__, __FUNCTION__, "Disabling repository " . $repoObject->getSlug() . " as parent cannot be correctly loaded.");
unset($drvList[$repoId]);
}
}
foreach ($drvList as $key => $value) {
$objList[$key] = $value;
}
}
$args = array(&$objList);
AJXP_Controller::applyIncludeHook("sec.access_ws", $args);
return $objList;
}
示例6: getRepositoryByIdInst
/**
* See static method
* @param $repoId
* @return Repository|null
*/
public function getRepositoryByIdInst($repoId)
{
if (isset($this->configs["REPOSITORIES"]) && isset($this->configs["REPOSITORIES"][$repoId])) {
return $this->configs["REPOSITORIES"][$repoId];
}
if (isset($this->configs["REPOSITORY"]) && $this->configs["REPOSITORY"]->getId() . "" == $repoId) {
return $this->configs["REPOSITORY"];
}
$test = CacheService::fetch(AJXP_CACHE_SERVICE_NS_SHARED, "repository:" . $repoId);
if ($test !== false) {
return $test;
}
$test = $this->getConfStorageImpl()->getRepositoryById($repoId);
if ($test != null) {
CacheService::save(AJXP_CACHE_SERVICE_NS_SHARED, "repository:" . $repoId, $test);
return $test;
}
// Finally try to search in default repositories
if (isset($this->configs["DEFAULT_REPOSITORIES"]) && isset($this->configs["DEFAULT_REPOSITORIES"][$repoId])) {
$repo = self::createRepositoryFromArray($repoId, $this->configs["DEFAULT_REPOSITORIES"][$repoId]);
$repo->setWriteable(false);
CacheService::save(AJXP_CACHE_SERVICE_NS_SHARED, "repository:" . $repoId, $repo);
return $repo;
}
$hookedRepo = null;
$args = array($repoId, &$hookedRepo);
AJXP_Controller::applyIncludeHook("repository.search", $args);
if ($hookedRepo !== null) {
return $hookedRepo;
}
return null;
}