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


PHP kohana::find_file方法代码示例

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


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

示例1: action_login

 public function action_login()
 {
     if ($this->_auth->logged_in()) {
         // redirect to the user account
         $this->request->redirect(Route::get('admin')->uri(), 200);
     }
     // Disable sidebars on login page
     $this->_sidebars = FALSE;
     $this->title = __('Sign In');
     $user = ORM::factory('user');
     // Create form action
     $destination = isset($_GET['destination']) ? $_GET['destination'] : 'admin';
     $params = array('action' => 'login');
     $action = Route::get('admin/login')->uri($params) . URL::query(array('destination' => $destination));
     if ($layout = kohana::find_file('views', 'layouts/login')) {
         $this->template->set_filename('layouts/login');
     }
     $view = View::factory('admin/login')->set('use_username', Config::get('auth.username'))->set('post', $user)->set('action', $action)->bind('errors', $this->_errors);
     if ($this->valid_post('login')) {
         try {
             // Check Auth
             $user->login($this->request->post());
             // If the post data validates using the rules setup in the user model
             Message::success(__('Welcome, %title!', array('%title' => $user->nick)));
             Log::info('User :name logged in.', array(':name' => $user->name));
             // redirect to the user account
             $this->request->redirect(isset($_GET['destination']) ? $_GET['destination'] : 'admin', 200);
         } catch (Validation_Exception $e) {
             $this->_errors = $e->array->errors('login', TRUE);
         }
     }
     $this->response->body($view);
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:33,代码来源:admin.php

示例2: before

 public function before()
 {
     parent::before();
     $lang = $this->request->param('lang');
     // Make sure we have a valid language
     if (!in_array($lang, array_keys(Kohana::config('kohana')->languages))) {
         $this->request->action = 'error';
         throw new Kohana_Request_Exception('Unable to find a route to match the URI: :uri (specified language was not found in config)', array(':uri' => $this->request->uri));
     }
     I18n::$lang = $lang;
     if (isset($this->page_titles[$this->request->action])) {
         // Use the defined page title
         $title = $this->page_titles[$this->request->action];
     } else {
         // Use the page name as the title
         $title = ucwords(str_replace('_', ' ', $this->request->action));
     }
     $this->template->title = $title;
     if (!kohana::find_file('views', 'pages/' . $this->request->action)) {
         $this->request->action = 'error';
     }
     $this->template->content = View::factory('pages/' . $this->request->action);
     $this->template->set_global('request', $this->request);
     $this->template->meta_tags = array();
 }
开发者ID:bluehawk,项目名称:kohanaphp.com,代码行数:25,代码来源:page.php

示例3: index

 public function index($file)
 {
     if (empty($file)) {
         die('no file');
     }
     header("Content-type: text/css");
     header("Pragma: public");
     header("Cache-Control: no-cache, must-revalidate");
     header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
     $file = kohana::find_file('views', "sass/{$file}", false, 'sass');
     # public_blog/blogs/stock
     if (!file_exists($file)) {
         die('invalid file');
     }
     # echo kohana::debug(file($file)); die();
     #$files = 'advanced';
     #if (!is_array($files)) $files = array($files);
     echo Kosass::factory('compact')->compile(file($file));
     # output directly to battle-test this sucka
     # echo sass::stylesheet('advanced', 'compact');
     die;
 }
开发者ID:plusjade,项目名称:plusjade,代码行数:22,代码来源:sass.php

示例4: css

 /**
  * Compiles .less files, joins and serves CSS.
  * @param Array css files.
  * @param bool Cache the files?
  */
 public static function css(array $files, $cache = true)
 {
     require_once kohana::find_file('vendor', 'lessphp/lessc.inc', 'php');
     $cssname = md5(implode('', $files)) . '.css';
     if ($cache && !file_exists(url::site('media/cache/' . $cssname, 'http')) || !$cache) {
         $content = '';
         foreach ($files as $file) {
             if (strpos($file, 'http') !== false || file_exists($file)) {
                 if (strpos($file, '.less') !== false) {
                     // It's a LESS file that we need to compile
                     $less = @file_get_contents($file);
                     $compiler = new lessc();
                     $content .= $compiler->parse($less);
                 } else {
                     $content .= @file_get_contents($file);
                 }
             }
         }
         file_put_contents('media/cache/' . $cssname, $content);
         unset($content);
     }
     return HTML::style('media/cache/' . $cssname);
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:28,代码来源:site.php

示例5: defined

<?php

defined('SYSPATH') or die('No direct script access.');
require_once kohana::find_file('helpers', 'response');
class NonLoginController_Core extends Controller
{
    function __construct()
    {
        parent::__construct();
        $this->session = Session::instance();
    }
}
?>


开发者ID:easthero,项目名称:kohana,代码行数:13,代码来源:NonLoginController.php

示例6:

<?php

$view_file = kohana::find_file('views/fields', $column->get_type());
if ($view_file) {
    $field_view = View::factory('fields/' . $column->get_type());
} else {
    $field_view = View::factory('fields/varchar');
}
$field_view->column = $column;
$field_view->row = $row;
$field_view->edit = $edit;
$field_view->form_field_name = $form_field_name;
echo $field_view->render();
开发者ID:halka139,项目名称:kohana_webdb,代码行数:13,代码来源:field.php


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