本文整理汇总了PHP中ClassLoader::getRealPath方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassLoader::getRealPath方法的具体用法?PHP ClassLoader::getRealPath怎么用?PHP ClassLoader::getRealPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassLoader
的用法示例。
在下文中一共展示了ClassLoader::getRealPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
parent::tearDown();
@unlink(ClassLoader::getRealPath('cache.') . 'currencies.php');
$this->setUpCurrency();
ActiveRecordModel::rollback();
}
示例2: getFilterUrlTemplate
private function getFilterUrlTemplate()
{
include_once ClassLoader::getRealPath('application.helper.smarty') . '/function.categoryUrl.php';
$params = array('filters' => array(new ManufacturerFilter(999, '___')), 'data' => Category::getRootNode()->toArray());
$templateUrl = createCategoryUrl($params, $this->application);
return strtr($templateUrl, array(999 => '#', '___' => '|'));
}
示例3: testSimpleImport
public function testSimpleImport()
{
$lv = ActiveRecordModel::getNewInstance('Language');
$lv->setID('xx');
$lv->save();
$profile = new CsvImportProfile('Product');
$profile->setField(0, 'Product.sku');
$profile->setField(1, 'Product.name', array('language' => 'en'));
$profile->setField(2, 'Product.name', array('language' => 'xx'));
$profile->setField(3, 'Product.shippingWeight');
$profile->setParam('delimiter', ';');
$csvFile = ClassLoader::getRealPath('cache.') . 'testDataImport.csv';
file_put_contents($csvFile, 'test; "Test Product"; "Parbaudes Produkts"; 15' . "\n" . 'another; "Another Test"; "Vel Viens"; 12.44');
$import = new ProductImport($this->getApplication());
$csv = $profile->getCsvFile($csvFile);
$cnt = $import->importFile($csv, $profile);
$this->assertEquals($cnt, 2);
$test = Product::getInstanceBySKU('test');
$this->assertTrue($test instanceof Product);
$this->assertEquals($test->shippingWeight->get(), '15');
$this->assertEquals($test->getValueByLang('name', 'en'), 'Test Product');
$another = Product::getInstanceBySKU('another');
$this->assertEquals($another->getValueByLang('name', 'xx'), 'Vel Viens');
unlink($csvFile);
}
示例4: notify
public function notify($requestArray)
{
$requestArray['version'] = '1.2open';
$keys = array('TPE', 'date', 'montant', 'reference', 'texte-libre', 'version', 'code-retour');
$values = array();
foreach (array('TPE', 'date', 'montant', 'reference', 'texte-libre', 'version', 'code-retour') as $key) {
$values[$key] = $requestArray[$key];
}
$macParams = array_combine($keys, $values);
$mac = $requestArray['retourPLUS'] . implode('+', $macParams) . '+';
$hash = strtoupper($this->CMCIC_hmac($mac));
ob_end_clean();
file_put_contents(ClassLoader::getRealPath('cache.') . get_class($this) . '.php', var_export($requestArray, true));
if ('annulation' == strtolower($requestArray['code-retour'])) {
printf("Pragma: no-cache \nContent-type: text/plain \nVersion: 1 %s", 'Annulation');
} else {
if ($hash == $requestArray['MAC']) {
$result = new TransactionResult();
$result->gatewayTransactionID->set($requestArray['reference']);
$result->amount->set(substr($requestArray['montant'], 0, -3));
$result->currency->set(substr($requestArray['montant'], -3));
$result->rawResponse->set($requestArray);
$result->setTransactionType(TransactionResult::TYPE_SALE);
printf("Pragma: no-cache \nContent-type: text/plain \nVersion: 1 %s", 'OK');
return $result;
} else {
printf("Pragma: no-cache \nContent-type: text/plain \nVersion: 1 %s", 'Document falsifie');
exit;
}
}
}
示例5: smarty_function_includeCss
/**
* ...
*
* @param array $params
* @param Smarty $smarty
* @return string
*
* @package application.helper.smarty
* @author Integry Systems
*/
function smarty_function_includeCss($params, LiveCartSmarty $smarty)
{
$fileName = $params['file'];
$filePath = substr($fileName, 0, 1) != '/' ? ClassLoader::getRealPath('public.stylesheet.') . $fileName : ClassLoader::getRealPath('public') . $fileName;
// fix slashes
$filePath = str_replace('\\', DIRECTORY_SEPARATOR, $filePath);
$filePath = str_replace('/', DIRECTORY_SEPARATOR, $filePath);
if (!is_file($filePath) && !isset($params['external']) || substr($filePath, -4) != '.css') {
return;
}
$css = CssFile::getInstanceFromPath($filePath, $smarty->getApplication()->getTheme());
$origFileName = $fileName;
if ($css->isPatched()) {
$filePath = $css->getPatchedFilePath();
$fileName = $css->getPatchedFileRelativePath();
}
if (isset($params['inline']) && $params['inline'] == 'true') {
$path = 'stylesheet/' . str_replace(DIRECTORY_SEPARATOR, '/', $fileName) . '?' . filemtime($filePath);
return '<link href="' . $path . '" media="screen" rel="Stylesheet" type="text/css" />' . "\n";
} else {
if (isset($params['external'])) {
$smarty->_smarty_vars['INCLUDED_STYLESHEET_FILES_EXTERNAL'][] = $fileName;
} else {
$includedStylesheetTimestamp = $smarty->_smarty_vars['INCLUDED_STYLESHEET_TIMESTAMP'];
if (!($includedStylesheetFiles = $smarty->_smarty_vars['INCLUDED_STYLESHEET_FILES'])) {
$includedStylesheetFiles = array();
}
if (in_array($filePath, $includedStylesheetFiles)) {
if (isset($params['front'])) {
unset($includedStylesheetFiles[array_search($filePath, $includedStylesheetFiles)]);
} else {
return;
}
}
$fileMTime = filemtime($filePath);
if ($fileMTime > (int) $includedStylesheetTimestamp) {
$smarty->_smarty_vars['INCLUDED_STYLESHEET_TIMESTAMP'] = $fileMTime;
}
if (isset($params['front'])) {
array_unshift($includedStylesheetFiles, $filePath);
} else {
if (isset($params['last'])) {
$includedStylesheetFiles['x' . (count($includedStylesheetFiles) + 200) * (int) $params['last']] = $filePath;
} else {
array_push($includedStylesheetFiles, $filePath);
}
}
$smarty->_smarty_vars['INCLUDED_STYLESHEET_FILES'] = $includedStylesheetFiles;
}
}
foreach ($smarty->getApplication()->getConfigContainer()->getFilesByRelativePath('public/stylesheet/' . $origFileName, true) as $file) {
if (realpath($file) == realpath($filePath)) {
continue;
}
$file = substr($file, strlen(ClassLoader::getRealPath('public')));
$params['file'] = $file;
smarty_function_includeCss($params, $smarty);
}
}
示例6: tearDown
public function tearDown()
{
parent::tearDown();
$dir = ClassLoader::getRealPath('storage.customize.view.theme.sometheme');
if (file_exists($dir)) {
rmdir($dir);
}
}
示例7: getFilePath
public function getFilePath()
{
if (is_array($this->params)) {
$hash = md5(implode('-', array_values($this->params)));
} else {
$hash = md5($this->params);
}
return ClassLoader::getRealPath('cache.output.' . $this->type . '.') . $hash;
}
示例8: getSmartyInstance
/**
* Gets a smarty instance
*
* @return Smarty
*/
public function getSmartyInstance()
{
if (!$this->tpl) {
$this->tpl = new Smarty();
$this->tpl->compile_dir = self::$compileDir;
$this->tpl->template_dir = ClassLoader::getRealPath("application.view");
}
return $this->tpl;
}
示例9: testGerRoleNames
public function testGerRoleNames()
{
$dumpControllerRoles = new RolesParser(ClassLoader::getRealPath("test.framework.roles.controllers.DumpController") . ".php", ClassLoader::getRealPath("test.framework.roles.cache.DumpControllerRoles") . ".php");
$roleNames = $dumpControllerRoles->getRolesNames();
$this->assertEqual(count($roleNames), 4);
$this->assertTrue(in_array('test', $roleNames));
$this->assertTrue(in_array('test.subtest', $roleNames));
$this->assertTrue(in_array('another', $roleNames));
$this->assertTrue(in_array('another.another', $roleNames));
}
示例10: smarty_function_includeJs
/**
* ...
*
* @param array $params
* @param Smarty $smarty
* @return string
*
* @package application.helper.smarty
* @author Integry Systems
*/
function smarty_function_includeJs($params, Smarty_Internal_Template $smarty)
{
static $jsPath;
if (!$jsPath) {
$jsPath = ClassLoader::getRealPath('public.javascript.');
}
$fileName = $params['file'];
$filePath = substr($fileName, 0, 1) != '/' ? $jsPath . $fileName : ClassLoader::getRealPath('public') . $fileName;
$fileName = substr($fileName, 0, 1) != '/' ? 'javascript/' . $fileName : substr($fileName, 1);
// fix slashes
$filePath = str_replace('\\', DIRECTORY_SEPARATOR, $filePath);
$filePath = str_replace('/', DIRECTORY_SEPARATOR, $filePath);
if (isset($params['path'])) {
$filePath = $params['path'];
}
if (!is_file($filePath) || substr($filePath, -3) != '.js') {
return;
}
if (isset($params['inline']) && $params['inline'] == 'true') {
return '<script src="' . str_replace(DIRECTORY_SEPARATOR, '/', $fileName) . '?' . filemtime($filePath) . '" type="text/javascript"></script>' . "\n";
} else {
$includedJavascriptTimestamp = $smarty->getGlobal("INCLUDED_JAVASCRIPT_TIMESTAMP");
if (!($includedJavascriptFiles = $smarty->getGlobal('INCLUDED_JAVASCRIPT_FILES'))) {
$includedJavascriptFiles = array();
}
if (isset($includedJavascriptFiles[$filePath])) {
if (!isset($params['front'])) {
return false;
} else {
unset($includedJavascriptFiles[$filePath]);
}
}
$fileMTime = filemtime($filePath);
if ($fileMTime > (int) $includedJavascriptTimestamp) {
$smarty->setGlobal('INCLUDED_JAVASCRIPT_TIMESTAMP', $fileMTime);
}
if (isset($params['front'])) {
$includedJavascriptFiles = array_merge(array($filePath => $fileName), $includedJavascriptFiles);
} else {
$includedJavascriptFiles[$filePath] = $fileName;
}
$smarty->setGlobal('INCLUDED_JAVASCRIPT_FILES', $includedJavascriptFiles);
}
foreach ($smarty->getApplication()->getConfigContainer()->getFilesByRelativePath('public/' . $fileName, true) as $file) {
if (realpath($file) == realpath($filePath)) {
continue;
}
$file = substr($file, strlen(ClassLoader::getRealPath('public')));
$params['file'] = $file;
smarty_function_includeJs($params, $smarty);
}
}
示例11: getDrivers
private function getDrivers()
{
$drivers = array();
foreach (new DirectoryIterator(ClassLoader::getRealPath('library.import.driver')) as $file) {
if (!$file->isDot()) {
include_once $file->getPathname();
$className = basename($file->getFileName(), '.php');
$drivers[$className] = call_user_func(array($className, 'getName'));
}
}
natcasesort($drivers);
return $drivers;
}
示例12: testPatching
function testPatching()
{
$file = 'stylesheet/backend/stat.css';
$path = ClassLoader::getRealPath('public.') . $file;
$css = new CssFile($file);
$css->clearPatchRules();
$css->deleteSelector('#stat table');
$css->save();
$this->assertTrue(strpos(file_get_contents($css->getPatchedFilePath()), '#stat table') == 0);
$css->deleteProperty('#stat .label', 'font-weight');
$css->save();
$this->assertTrue(strpos(file_get_contents($css->getPatchedFilePath()), 'font-weight') == 0);
$css->clearPatchRules();
}
示例13: ztestModelPlugins
public function ztestModelPlugins()
{
$this->getApplication()->registerPluginDirectory(ClassLoader::getRealPath('test.fixture.plugin'));
$currency = Currency::getNewInstance('ZZZ');
$currency->save();
$this->assertEquals($currency->rate->get(), 0.5);
$this->assertFalse((bool) $currency->isEnabled->get());
$currency->rate->set(0.6);
$currency->save();
$this->assertTrue((bool) $currency->isEnabled->get());
$array = $currency->toArray();
$this->assertTrue($array['testValue']);
$this->getApplication()->unregisterPluginDirectory(ClassLoader::getRealPath('test.fixture.plugin'));
}
示例14: smarty_function_compiledJs
/**
* ...
*
* @param array $params
* @param Smarty $smarty
* @return string
*
* @package application.helper.smarty
* @author Integry Systems
*/
function smarty_function_compiledJs($params, Smarty_Internal_Template $smarty)
{
$includedJavascriptTimestamp = $smarty->getGlobal("INCLUDED_JAVASCRIPT_TIMESTAMP");
$includedJavascriptFiles = $smarty->getGlobal("INCLUDED_JAVASCRIPT_FILES");
$app = $smarty->getApplication();
if ($includedJavascriptFiles && isset($params['glue']) && $params['glue'] == 'true' && !$smarty->getApplication()->isDevMode() && !$smarty->getApplication()->isTemplateCustomizationMode()) {
$request = $app->getRequest();
if (isset($params['nameMethod']) && 'hash' == $params['nameMethod']) {
$names = array_keys($includedJavascriptFiles);
sort($names);
$compiledFileName = md5(implode("\n", $names)) . '.js';
} else {
$compiledFileName = $request->getControllerName() . '-' . $request->getActionName() . '.js';
}
$compiledFilePath = ClassLoader::getRealPath('public.cache.javascript.') . $compiledFileName;
$baseDir = ClassLoader::getRealPath('public.javascript.');
$compiledFileTimestamp = 0;
if (!is_file($compiledFilePath) || filemtime($compiledFilePath) < $includedJavascriptTimestamp) {
if (!is_dir(ClassLoader::getRealPath('public.cache.javascript'))) {
mkdir(ClassLoader::getRealPath('public.cache.javascript'), 0777, true);
}
// compile
$compiledFileContent = "";
$compiledFilesList = array();
foreach ($includedJavascriptFiles as $jsFile => $fileName) {
$compiledFileContent .= "\n\n\n/***************************************************\n";
$compiledFileContent .= " * " . str_replace($baseDir, '', $jsFile) . "\n";
$compiledFileContent .= " ***************************************************/\n\n";
$compiledFileContent .= file_get_contents($jsFile);
$compiledFilesList[] = basename($jsFile);
}
file_put_contents($compiledFilePath, $compiledFileContent);
if (function_exists('gzencode')) {
file_put_contents($compiledFilePath . '.gz', gzencode($compiledFileContent, 9));
}
}
$compiledFileTimestamp = filemtime($compiledFilePath);
return '<script src="' . $app->getPublicUrl('gzip.php') . '?file=' . $compiledFileName . '&time=' . $compiledFileTimestamp . '" type="text/javascript"></script>';
} else {
if ($includedJavascriptFiles) {
$includeString = "";
$publicPath = ClassLoader::getRealPath('public.');
foreach ($includedJavascriptFiles as $path => $jsFile) {
$urlPath = str_replace('\\', '/', str_replace($publicPath, '', $jsFile));
$includeString .= '<script src="' . $app->getPublicUrl($urlPath) . '?' . filemtime($path) . '" type="text/javascript"></script>' . "\n";
}
return $includeString;
}
}
}
示例15: smarty_function_img
/**
* ...
*
* @param array $params
* @param Smarty $smarty
* @return string
*
* @package application.helper.smarty
* @author Integry Systems
*/
function smarty_function_img($params, LiveCartSmarty $smarty)
{
if (isset($params['src']) && (substr($params['src'], 0, 6) == 'image/' || substr($params['src'], 0, 7) == 'upload/')) {
if (is_file($params['src'])) {
$imageTimestamp = @filemtime(ClassLoader::getRealPath('public.') . str_replace('/', DIRECTORY_SEPARATOR, $params['src']));
$params['src'] .= '?' . $imageTimestamp;
}
}
$content = "<img ";
foreach ($params as $name => $value) {
$content .= $name . '="' . $value . '" ';
}
$content .= "/>";
return $content;
}