/** * Test the getResourceIdentifier method * * @param string|int $expected * @param string $requestKey * @param string|int $requestValue * @param string $method * @param string $paramAlias * @param string $paramId * @dataProvider providerGetResourceIdentifier */ public function testGetResourceIdentifier($expected, $requestKey, $requestValue, $method = 'alias', $paramAlias = 'q', $paramId = 'id') { $_REQUEST[$requestKey] = $requestValue; $this->modx->setOption('request_param_alias', $paramAlias); $this->modx->setOption('request_param_id', $paramId); $this->modx->setOption('site_start', 1); $identifier = $this->request->getResourceIdentifier($method); $this->assertEquals($expected, $identifier, 'The Resource Identifier did not match the expected value.'); unset($_REQUEST[$requestKey]); }
/* * modxRepository by Fi1osof * http://community.modx-cms.ru/profile/Fi1osof/ * http://modxstore.ru */ if ($modx->context->key == 'mgr') { return; } if (!$modx->checkSiteStatus()) { return; } if (!($request_path = $modx->getOption('modxRepository.request_path', $scriptProperties, false))) { return; } $request = new modRequest($modx); $resourceIdentifier = $request->getResourceIdentifier("alias"); /* * Check for repository path */ if (strpos($resourceIdentifier, $request_path) !== 0) { return; } if (!($action = substr($resourceIdentifier, strlen($request_path)))) { return; } // Get processors path if (!($ns = $modx->getObject('modNamespace', 'modxrepository'))) { $modx->log(xPDO::LOG_LEVEL_ERROR, "Не было пролучено пространство имен modxrepository"); return; } $processors_path = $ns->getCorePath() . 'processors/';