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


PHP Core::find_file方法代码示例

本文整理汇总了PHP中Core::find_file方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::find_file方法的具体用法?PHP Core::find_file怎么用?PHP Core::find_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core的用法示例。


在下文中一共展示了Core::find_file方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_default

 public function action_default()
 {
     $file = $this->file;
     $type = $this->type;
     if (!preg_match('#^([a-zA-Z0-9_/\\-\\.]+)$#', $file) || !preg_match('#(' . $this->allow_suffix . ')$#', $type)) {
         Core::show_404();
     }
     $file = Core::find_file('statics', $file, $type);
     if ($file) {
         if (in_array($type, array('jpg', 'gif', 'png'))) {
             header('Content-Type: image/' . $type);
         } elseif ($type == 'css') {
             header('Content-Type: text/css');
         } elseif ($type == 'js') {
             header('Content-Type: application/x-javascript');
         } elseif ($type == 'swf') {
             header('Content-Type: application/swf');
         }
         header('Cache-Control: max-age=604800');
         header('Last-Modified: ' . date('D, d M Y H:i:s \\G\\M\\T', filemtime($file)));
         header('Expires: ' . date('D, d M Y H:i:s \\G\\M\\T', TIME + 86400 * 30));
         header('Pragma: cache');
         readfile($file);
         exit;
     } else {
         Core::show_404();
     }
 }
开发者ID:google2013,项目名称:myqeecms,代码行数:28,代码来源:statics.controller.php

示例2: set_filename

 public function set_filename($file)
 {
     $realfile = Core::find_file('views', $file);
     if ($realfile) {
         $this->_file = $realfile;
     } else {
         throw new Exception('指定的视图“' . $file . '”不存在');
     }
 }
开发者ID:google2013,项目名称:myqeecms,代码行数:9,代码来源:View.class.php

示例3: set_filename

 /**
  * 设置视图文件名
  *
  *      $view = new View();
  *      $view->set_filename('test_view');
  *
  * @param string $file
  * @throws Exception
  * @return View
  */
 public function set_filename($file)
 {
     $realfile = Core::find_file('views', $file);
     if ($realfile) {
         $this->_file = $realfile;
     } else {
         throw new Exception(__('The view :file does not exist', array(':file' => $file)));
     }
     return $this;
 }
开发者ID:xiaodin1,项目名称:myqee,代码行数:20,代码来源:view.class.php

示例4: before

 public function before()
 {
     // Use customized Markdown parser
     define('MARKDOWN_PARSER_CLASS', 'Docs_Markdown');
     if (!function_exists('Markdown')) {
         // Load Markdown support
         require Core::find_file('markdown', 'markdown');
     }
     $this->view = new View('docs/frame_view');
     ob_start();
 }
开发者ID:google2013,项目名称:myqeecms,代码行数:11,代码来源:base.controller.php

示例5: action_default

 public function action_default()
 {
     $file = $this->file;
     $type = $this->type;
     if (!\preg_match('#^([a-zA-Z0-9_/\\-\\.@]+)$#', $file) || !\preg_match('#(' . $this->allow_suffix . ')$#', $type)) {
         \Core::show_404();
     }
     $file = \Core::find_file('statics', $file, $type);
     if ($file) {
         \Core::close_buffers(false);
         // 清理所有已输出的header
         \header_remove();
         if ($type == 'jpg') {
             \header('Content-Type: image/jpeg');
         } elseif (\in_array($type, array('gif', 'png'))) {
             \header('Content-Type: image/' . $type);
         } elseif ($type == 'css') {
             \header('Content-Type: text/css');
         } elseif ($type == 'js') {
             \header('Content-Type: application/x-javascript');
         } elseif ($type == 'swf') {
             \header('Content-Type: application/swf');
         }
         \header('Cache-Control: max-age=604800');
         \header('Expires: ' . \date('D, d M Y H:i:s \\G\\M\\T', \TIME + 86400 * 30));
         \header('Pragma: cache');
         $fun = '\\apache_get_modules';
         if (\function_exists($fun)) {
             if (\in_array('mod_xsendfile', $fun())) {
                 $slen = \strlen(\DIR_SYSTEM);
                 if (\substr($file, 0, $slen) == \DIR_SYSTEM) {
                     // 采用xsendfile发送文件
                     \header('X-Sendfile: ' . \substr($file, $slen));
                     exit;
                 }
             }
         } else {
             \header('Last-Modified: ' . \date('D, d M Y H:i:s \\G\\M\\T', \filemtime($file)));
         }
         \readfile($file);
         exit;
     } else {
         \Core::show_404();
     }
 }
开发者ID:google2013,项目名称:myqee,代码行数:45,代码来源:statics.controller.php

示例6: get

 /**
  * 获取IP地址
  *
  * @param string $ip 不传则为访客IP
  * @return string
  */
 public static function get($ip = null)
 {
     $ip or $ip = HttpIO::IP;
     if ($ip == '127.0.0.1' || $ip == '0.0.0.0') {
         return 'Local IP';
     }
     $return = '';
     if (preg_match('#^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$#', $ip)) {
         $iparray = explode('.', $ip);
         if ($iparray[0] == 10 || $iparray[0] == 127 || $iparray[0] == 192 && $iparray[1] == 168 || $iparray[0] == 172 && ($iparray[1] >= 16 && $iparray[1] <= 31)) {
             $return = 'LAN';
         } elseif ($iparray[0] > 255 || $iparray[1] > 255 || $iparray[2] > 255 || $iparray[3] > 255) {
             $return = 'Invalid IP Address';
         } else {
             if (true == ($tinyipfile = Core::find_file('data', 'tinyipdata', 'dat'))) {
                 $return = IpSource::_convertip_tiny($ip, $tinyipfile);
             } elseif (true == ($fullipfile = Core::find_file('data', 'wry', 'dat'))) {
                 $return = IpSource::_convertip_full($ip, $fullipfile);
             }
         }
     }
     return $return;
 }
开发者ID:xiaodin1,项目名称:myqee,代码行数:29,代码来源:ipsource.class.php

示例7: project_config

 /**
  * 获取指定项目的指定key的配置
  *
  * @param string $key
  * @param string $project 跨项目读取配置,若本项目内的不需要传
  * @return 返回配置
  */
 protected static function project_config($key, $project)
 {
     $c = explode('.', $key);
     $cname = array_shift($c);
     if (!isset(Core::$config_projects[$project]) || !array_key_exists($cname, Core::$config_projects[$project])) {
         $config = array();
         $thefiles = Core::find_file('config', $cname, null, false, $project);
         if (is_array($thefiles)) {
             if (count($thefiles) > 1) {
                 krsort($thefiles);
                 //逆向排序
             }
             foreach ($thefiles as $thefile) {
                 if ($thefile) {
                     include $thefile;
                 }
             }
         }
         if (!isset(Core::$config_projects[$project][$cname])) {
             Core::$config_projects[$project][$cname] = $config;
         }
     }
     $v = Core::$config_projects[$project][$cname];
     foreach ($c as $i) {
         if (!isset($v[$i])) {
             return null;
         }
         $v = $v[$i];
     }
     return $v;
 }
开发者ID:google2013,项目名称:myqeecms,代码行数:38,代码来源:Core.class.php

示例8: output_other_file

 /**
  * 输出非css,js文件
  *
  * @throws Exception
  */
 protected function output_other_file()
 {
     $file_name = $this->file . ($this->is_min ? '.min' : '');
     $found_file = Core::find_file('assets', $file_name, '.' . $this->suffix);
     if ($found_file) {
         $this->output_by_file($found_file);
     } else {
         $this->get_assets_dir_file();
     }
 }
开发者ID:xiaodin1,项目名称:myqee,代码行数:15,代码来源:assets-dev.controller.php

示例9:

<div><?php 
include Core::find_file('views', '/admin/desktop/default');
?>
</div>

开发者ID:google2013,项目名称:myqee,代码行数:4,代码来源:desktop.view.php

示例10: file

 public function file($page)
 {
     $file = Core::find_file('guide', strtolower($page), 'md');
     return $file;
 }
开发者ID:xiaodin1,项目名称:myqee,代码行数:5,代码来源:index.controller.php

示例11: before

 public function before()
 {
     # 记录访问日志
     if (HttpIO::METHOD == 'POST') {
         Database::instance(Model_Admin::DATABASE)->insert(Core::config('admin/log.tablename'), array('uri' => $_SERVER["REQUEST_URI"], 'type' => 'log', 'ip' => HttpIO::IP, 'referer' => $_SERVER["HTTP_REFERER"], 'post' => serialize($_POST), 'admin_id' => $this->session()->member()->id));
     }
     if (!is_file(DIR_DATA . Core::$project . '/install.lock') && ($install_file = Core::find_file('controllers', 'install'))) {
         self::message('为保证系统安全请在data目录下创建安装锁文件:' . Core::$project . '/install.lock<br><br>或删除后台安装文件:' . Core::debug_path($install_file) . '<br><br>设置完毕后方可进入后台', -1);
     }
     # 不允许非超管跨项目访问
     if ($this->session()->member()->project != Core::$project && !$this->session()->member()->is_super_admin) {
         self::message('通道受限,您不具备此项目的操作权限,请联系管理员', -1);
     }
     ob_start();
 }
开发者ID:google2013,项目名称:myqeecms,代码行数:15,代码来源:admin.controller.php

示例12: load

 /**
  * 加载语言包文件
  *
  * @link http://www.php.net/manual/en/function.parse-ini-file.php
  * @return Core_I18n
  */
 public function load()
 {
     $langdata = array();
     $files = Core::find_file('i18n', $this->lang, '.lang');
     if ($files) {
         $ext_len = strlen(EXT);
         if (count($files) > 1) {
             krsort($files);
             //逆向排序
         }
         foreach ($files as $langfile) {
             if (substr($langfile, -$ext_len) === EXT) {
                 $lang = Core_I18n::_include_lang_file($langfile);
             } else {
                 $lang = @parse_ini_file($langfile);
             }
             if (is_array($lang)) {
                 $langdata = array_merge($langdata, $lang);
             }
         }
     }
     Core_I18n::$data[$this->lang] = $langdata;
     return $this;
 }
开发者ID:google2013,项目名称:myqeecms,代码行数:30,代码来源:I18n.class.php

示例13: shutdown_handler

 /**
  * Catches errors that are not caught by the error handler, such as E_PARSE.
  *
  * @uses    self::exception_handler
  * @return  void
  */
 public static function shutdown_handler()
 {
     $error = error_get_last();
     if ($error) {
         static $run = null;
         if (true === $run) {
             return;
         }
         $run = true;
         if (((E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR) & $error['type']) !== 0) {
             $run = true;
             self::exception_handler(new ErrorException($error['message'], $error['type'], 0, $error['file'], $error['line']));
             exit(1);
         }
     }
     if (isset($_REQUEST['debug'])) {
         if (Core::debug()->profiler('output')->is_open()) {
             Core::debug()->profiler('output')->start('Views', 'Global Data');
             Core::debug()->profiler('output')->stop(array('Global Data' => View::get_global_data()));
         }
         // 输出debug信息
         $file = Core::find_file('views', IS_CLI ? 'debug/profiler_cli' : 'debug/profiler');
         if ($file) {
             ob_start();
             include $file;
             $out = ob_get_clean();
             if (stripos(Core::$output, '</body>') !== false) {
                 Core::$output = str_ireplace('</body>', $out . '</body>', Core::$output);
             } else {
                 Core::$output .= $out;
             }
         }
     }
 }
开发者ID:xiaodin1,项目名称:myqee,代码行数:40,代码来源:devexception.class.php

示例14: action_step_4

 public function action_step_4()
 {
     # 关闭ob_start
     Core::close_buffers(true);
     $this->step = 4;
     View::set_global('config', self::$config);
     View::set_global('step', $this->step);
     $view = new View('admin/install/header');
     $view->page_title = $this->page_title;
     $view->location = $this->location;
     $view->admin_menu = Core::config('admin/menu/install');
     $view->render(true);
     $view = new View('admin/install/step_4');
     $view->render();
     $view = new View('admin/install/bottom');
     $view->render(true);
     # 将页面内容输出
     flush();
     $sqlfile = Core::find_file('data', 'install', 'sql');
     if ($sqlfile) {
         $sql = file_get_contents($sqlfile);
         $sql = str_replace("\r\n", "\n", $sql);
         $database = Core::config('admin/core.database');
         if (!$database) {
             $database = 'default';
         }
         $db = Database::instance($database);
         $this->run_query($db, $sql);
     }
     if ($this->lock_install()) {
         $this->show_js_message('安装成功。');
     } else {
         $this->show_js_message('安装完毕。');
         $this->show_js_message('<br><font color="red">请注意:</font>系统无法创建安装锁文件,请在data目录“<font color="blue">' . Core::$project . '/</font>”下创建<font color="red">install.lock</font>文件,以防止再次安装,请手动创建此文件。');
     }
     $this->show_js_message('<br>安全起见,请删除本安装文件:' . __FILE__);
     $this->show_js_message('<br /><input type="button" value="进入后台" class="submit" onclick="document.location=\'' . Core::url('/') . '\'" /> 用户名:admin,密码:123456');
     # 强制结束
     exit;
 }
开发者ID:google2013,项目名称:myqeecms,代码行数:40,代码来源:install.controller.php

示例15: render

 /**
  * render image
  *
  * @param array $config
  * @return image
  */
 public static function render($config = false)
 {
     if (is_array($config)) {
         Captcha::$config = array_merge(Captcha::$config, $config);
     }
     if (empty(Captcha::$response)) {
         Captcha::generate_challenge();
     }
     // Creates Captcha::$image
     Captcha::image_create(Captcha::$config['background']);
     // Add a random gradient
     if (empty(Captcha::$config['background'])) {
         $color1 = imagecolorallocate(Captcha::$image, mt_rand(0, 100), mt_rand(0, 100), mt_rand(0, 100));
         $color2 = imagecolorallocate(Captcha::$image, mt_rand(0, 100), mt_rand(0, 100), mt_rand(0, 100));
         Captcha::image_gradient($color1, $color2);
     }
     // Add a few random circles
     for ($i = 0, $count = mt_rand(10, Captcha::$config['complexity'] * 3); $i < $count; $i++) {
         $color = imagecolorallocatealpha(Captcha::$image, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255), mt_rand(80, 120));
         $size = mt_rand(5, Captcha::$config['height'] / 3);
         imagefilledellipse(Captcha::$image, mt_rand(0, Captcha::$config['width']), mt_rand(0, Captcha::$config['height']), $size, $size, $color);
     }
     // Calculate character font-size and spacing
     $default_size = min(Captcha::$config['width'], Captcha::$config['height'] * 2) / strlen(Captcha::$response);
     $spacing = (int) (Captcha::$config['width'] * 0.9 / strlen(Captcha::$response));
     // Background alphabetic character attributes
     $color_limit = mt_rand(96, 160);
     $chars = 'ABEFGJKLPQRTVY';
     // Draw each captcha character with varying attributes
     for ($i = 0, $strlen = strlen(Captcha::$response); $i < $strlen; $i++) {
         // Use different fonts if available
         $font = Core::find_file('data', Captcha::$config['fonts'][array_rand(Captcha::$config['fonts'])], false);
         $angle = mt_rand(-40, 20);
         // Scale the character size on image height
         $size = $default_size / 10 * mt_rand(8, 12);
         if (!function_exists('imageftbbox')) {
             Core::show_500(__('function imageftbbox not exist.'));
         }
         $box = imageftbbox($size, $angle, $font, Captcha::$response[$i]);
         // Calculate character starting coordinates
         $x = $spacing / 4 + $i * $spacing;
         $y = Captcha::$config['height'] / 2 + ($box[2] - $box[5]) / 4;
         // Draw captcha text character
         // Allocate random color, size and rotation attributes to text
         $color = imagecolorallocate(Captcha::$image, mt_rand(150, 255), mt_rand(200, 255), mt_rand(0, 255));
         // Write text character to image
         imagefttext(Captcha::$image, $size, $angle, $x, $y, $color, $font, Captcha::$response[$i]);
         // Draw "ghost" alphabetic character
         $text_color = imagecolorallocatealpha(Captcha::$image, mt_rand($color_limit + 8, 255), mt_rand($color_limit + 8, 255), mt_rand($color_limit + 8, 255), mt_rand(70, 120));
         $char = substr($chars, mt_rand(0, 14), 1);
         imagettftext(Captcha::$image, $size * 1.4, mt_rand(-45, 45), $x - mt_rand(5, 10), $y + mt_rand(5, 10), $text_color, $font, $char);
     }
     // Output
     return Captcha::image_render();
 }
开发者ID:xiaodin1,项目名称:myqee,代码行数:61,代码来源:captcha.class.php


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