本文整理汇总了PHP中config::getFilename方法的典型用法代码示例。如果您正苦于以下问题:PHP config::getFilename方法的具体用法?PHP config::getFilename怎么用?PHP config::getFilename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类config
的用法示例。
在下文中一共展示了config::getFilename方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findAll
public function findAll()
{
$ret = array();
if ($handle = opendir(config::getFilename("data/contests/"))) {
while (false !== ($file = readdir($handle))) {
$info = pathinfo($file);
if (!isset($info['extension']) || $info['extension'] != 'xml') {
continue;
}
$name = $info['filename'];
$contest = Contest::factory($name);
if ($contest) {
array_push($ret, $contest);
}
}
closedir($handle);
}
return $ret;
}
示例2: codeHighlight
public function codeHighlight($source, $lang)
{
Zend_Loader::loadFile("geshi.php", array(config::getFilename("geshi/"), "/usr/share/php-geshi"), true);
if ($lang == "cpp") {
$lang = "C++";
}
if ($lang == "gcj") {
$lang = "Java";
}
if (!class_exists("GeSHi")) {
return "<!-- GeSHi disabled --> <pre>" . htmlspecialchars($source) . "</pre>";
}
$geshi = new GeSHi($source, $lang);
$geshi->set_header_type(GESHI_HEADER_PRE_TABLE);
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
$geshi->set_overall_class("geshi");
$code = $geshi->parse_code();
return $code;
}
示例3: indexAction
public function indexAction()
{
$page = $this->getRequest()->get("page");
$contest = Contest::factory(webconfig::getContestId());
if (!$contest) {
return;
}
$xp = $contest->getXPath();
$res = $xp->query("/contest/frontend/page[@id='{$page}']/@href");
$href = $res->item(0)->nodeValue;
if (substr($href, 0, 5) == "http:" or substr($href, 0, 6) == "https:") {
$this->_redirect($href);
}
$file = config::getFilename("data/contests/" . $res->item(0)->nodeValue);
if (!is_file($file)) {
echo "Please edit '{$file}' to view this page.";
} else {
echo file_get_contents($file);
}
}
示例4: indexAction
public function indexAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$file = $this->_request->get("file");
$details = pathinfo($file);
$path = $details['dirname'];
$filename = "public." . $details['basename'];
$finalFile = config::getFilename("data/" . $path . "/{$filename}");
if (is_file($finalFile)) {
$response = $this->getResponse();
$response->setHeader('Cache-Control', 'public', true)->setHeader('Content-Description', 'File Transfer', true)->setHeader('Content-Type', $this->getContentType($details['extension']), true)->setHeader('Content-Transfer-Encoding', 'binary', true)->setBody(file_get_contents($finalFile));
$response->sendResponse();
//$this->setResponse($response);
return;
}
echo "File not found";
/* else send a 404 error */
$response = $this->getResponse();
$response->setHttpResponseCode(404);
}
示例5: fileAction
public function fileAction()
{
if (!$this->validateProblemAccess()) {
return;
}
$prob = $this->_request->get("probid");
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$file = $this->_request->get("file");
if (strstr($file, "/") || strstr($file, "\\")) {
$this->_forward("illegal", "error");
return;
}
$details = pathinfo($file);
$contentType = $this->getContentType($details['extension']);
if (empty($contentType)) {
$this->_forward("illegal", "error");
return;
}
$finalFile = config::getFilename("data/problems/{$prob}/{$file}");
if (is_file($finalFile)) {
$response = $this->getResponse();
$response->setHeader('Cache-Control', 'public', true)->setHeader('Content-Description', 'File Transfer', true)->setHeader('Content-Type', $contentType, true)->setHeader('Content-Transfer-Encoding', 'binary', true)->setBody(file_get_contents($finalFile));
return;
}
echo "File ({$finalFile}, {$contentType}) not found";
/* else send a 404 error */
$response = $this->getResponse();
$response->setHttpResponseCode(404);
}