本文整理汇总了PHP中Pluf::fileExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Pluf::fileExists方法的具体用法?PHP Pluf::fileExists怎么用?PHP Pluf::fileExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pluf
的用法示例。
在下文中一共展示了Pluf::fileExists方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFile
public static function loadFile($file)
{
if (false === ($ffile = Pluf::fileExists($file))) {
throw new Exception(sprintf(__('Fixture file not found: %s.'), $file));
}
return self::load(file_get_contents($ffile));
}
示例2: url
public static function url($file = '')
{
if ($file !== '' && Pluf::f('last_update_file', false) && false !== ($last_update = Pluf::fileExists(Pluf::f('last_update_file')))) {
$file = $file . '?' . substr(md5(filemtime($last_update)), 0, 5);
}
return Pluf::f('url_media', Pluf::f('app_base') . '/media') . $file;
}
示例3: loadSetLocale
public static function loadSetLocale($lang)
{
$GLOBALS['_PX_current_locale'] = $lang;
setlocale(LC_TIME, array($lang . '.UTF-8', $lang . '_' . strtoupper($lang) . '.UTF-8'));
if (isset($GLOBALS['_PX_locale'][$lang])) {
return;
// We consider that it was already loaded.
}
$GLOBALS['_PX_locale'][$lang] = array();
foreach (Pluf::f('installed_apps') as $app) {
if (false != ($pofile = Pluf::fileExists($app . '/locale/' . $lang . '/' . strtolower($app) . '.po'))) {
$GLOBALS['_PX_locale'][$lang] += Pluf_Translation::readPoFile($pofile);
}
}
}
示例4: findMigrations
/**
* Find the migrations for the current app.
*
* @return array Migrations names indexed by order.
*/
public function findMigrations()
{
$migrations = array();
if (false !== ($mdir = Pluf::fileExists($this->app . '/Migrations'))) {
$dir = new DirectoryIterator($mdir);
foreach ($dir as $file) {
$matches = array();
if (!$file->isDot() && !$file->isDir() && preg_match('#^(\\d+)#', $file->getFilename(), $matches)) {
$info = pathinfo($file->getFilename());
$migrations[(int) $matches[1]] = $info['filename'];
}
}
}
return $migrations;
}
示例5: testFileExists
public function testFileExists()
{
$this->assertEquals(true, Pluf::fileExists('Pluf.php'));
$this->assertEquals(true, Pluf::fileExists('PEAR.php'));
$this->assertEquals(false, Pluf::fileExists('Pluf-dummy.php'));
}
示例6: loadFunction
/**
* Load a function depending on its name.
*
* The implementation file of the function
* MyApp_Youpla_Boum_Stuff() is MyApp/Youpla/Boum.php That way it
* is possible to group all the related function in one file.
*
* Throw an exception if not possible to load the function.
*
* @param string Function to load.
*/
public static function loadFunction($function)
{
if (function_exists($function)) {
return;
}
$elts = explode('_', $function);
array_pop($elts);
$file = implode(DIRECTORY_SEPARATOR, $elts) . '.php';
if (false !== ($file = Pluf::fileExists($file))) {
include $file;
}
if (!function_exists($function)) {
throw new Exception('Impossible to load the function: ' . $function);
}
}