本文整理汇总了PHP中base::expand方法的典型用法代码示例。如果您正苦于以下问题:PHP base::expand方法的具体用法?PHP base::expand怎么用?PHP base::expand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类base
的用法示例。
在下文中一共展示了base::expand方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadView
function loadView($view)
{
$path = base::expand($view, '/views');
Console::debugEx(LOG_BASIC, __CLASS__, "Attempting to invoke view from %s", $path);
if (file_exists($path)) {
Console::debugEx(LOG_BASIC, __CLASS__, "Invoking as Pure PHP View");
$this->path = $path;
} else {
throw new ViewNotFoundException("The view " . $view . " could not be found");
}
}
示例2: expandpath
function expandpath($path)
{
return base::expand($path);
}
示例3: embed
/**
* @brief Embed a view inside another one
*
* @param string $view The view to embed
* @param array $data Optional data to pass to the view
*/
static function embed($view, $data = null)
{
$vp = base::expand($view, '/views/');
if (file_exists($vp)) {
if (is_array($data)) {
View::set($data);
}
View::load($view);
} else {
if (config::get(self::KEY_EMBED_EXCEPTION, false) == true) {
throw new ViewException("Embedded view " . $view . " not found");
}
printf('<div style="display:block;"><div style="color:white; background-color:red; border:dotted 1px white; padding:5px; margin:1px;">View %s not found</div></div>', $view);
}
}
示例4: updateActiveCountries
public static function updateActiveCountries(callback $callback = null)
{
self::updateCache($callback);
$db = new DatabaseConnection();
$cache = base::expand('app:/cache/geonames/');
// Update hierarchy
cb($callback, 'Importing hierarchy ...', 1);
$fin = fopen('compress.zlib://' . $cache . 'hierarchy.gz', 'r');
$rows = 0;
$ltime = 0;
while (!feof($fin)) {
$fd = trim(fgets($fin));
$ds = explode("\t", $fd . "\t\t");
$db->updateRow("REPLACE INTO geonames_hierarchy " . "(parentid,geoid,htype) " . "VALUES " . "(%d,%d,%s)", $ds[0], $ds[1], $ds[2]);
if (microtime(true) > $ltime + 1) {
cb($callback, 'Importing hierarchy ... ' . $rows . " records imported", 1);
$ltime = microtime(true);
}
$rows++;
}
cb($callback, 'Imported hierarchy (' . $rows . ' records)');
fclose($fin);
// Pull the list of countries to import
$rs = $db->getRows("SELECT * FROM geonames_datasets WHERE active=1");
foreach ($rs as $ci) {
cb($callback, 'Importing ' . $ci['setkey'] . ' ...', 1);
$fin = fopen('compress.zlib://' . $cache . $ci['setkey'] . '.gz', 'r');
$rows = 0;
$ltime = 0;
while (!feof($fin)) {
$dl = fgets($fin);
if (trim($dl) != '') {
$ds = explode("\t", $dl);
$db->updateRow('REPLACE INTO geonames ' . '(geoid,name,asciiname,alternatenames,' . 'latitude,longitude,featureclass,featurecode,' . 'countrycode,countrycodealt,admin1code,admin2code,' . 'admin3code,admin4code,population,elevation,' . 'gtopo30,timezone,modificationdate) ' . 'VALUES ' . '(%d,%s,%s,%s, %.5f,%.5f,%s,%s,' . '%s,%s,%s,%s, %s,%s,%d,%d,' . '%d,%s,%s)', $ds[0], $ds[1], $ds[2], $ds[3], $ds[4], $ds[5], $ds[6], $ds[7], $ds[8], $ds[9], $ds[10], $ds[11], $ds[12], $ds[13], $ds[14], $ds[15], $ds[16], $ds[17], $ds[18]);
}
if (microtime(true) > $ltime + 1) {
cb($callback, 'Importing ' . $ci['setkey'] . ' ... ' . $rows . " records imported", 1);
$ltime = microtime(true);
}
$rows++;
}
fclose($fin);
cb($callback, 'Imported ' . $ci['setkey'] . " (" . $rows . " records)");
}
}