当前位置: 首页>>代码示例>>PHP>>正文


PHP config::getFilename方法代码示例

本文整理汇总了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;
 }
开发者ID:rajatkhanduja,项目名称:opc,代码行数:19,代码来源:ContestModel.php

示例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;
 }
开发者ID:rajatkhanduja,项目名称:opc,代码行数:19,代码来源:CodeHighlight.php

示例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);
     }
 }
开发者ID:rajatkhanduja,项目名称:opc,代码行数:20,代码来源:PagesController.php

示例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);
 }
开发者ID:rajatkhanduja,项目名称:opc,代码行数:21,代码来源:DataController.php

示例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);
 }
开发者ID:rajatkhanduja,项目名称:opc,代码行数:30,代码来源:ProblemsController.php


注:本文中的config::getFilename方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。