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


PHP App::load方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     // construct controller
     parent::__construct();
     // set urls
     $this->data['project_url'] = Router::getProjectUrl();
     $this->data['current_url'] = Router::getUrl();
     // set date format
     $this->data['date_format'] = App::load()->date_format;
     //set admin nav
     App::load()->register('nav', array(" \n  <div class='list-group panel'> \n    <a href='#post' class='list-group-item list-group-item-info' data-toggle='collapse'>" . i18n::get('POST_HEADER', 'post') . "</a> \n    <div class='collapse' id='post'> \n       <a href='" . $this->data['project_url'] . "admin/read/post/article/' class='list-group-item'>" . i18n::get('POST_SUB_HEADER', 'post') . "</a> \n      <a href='" . $this->data['project_url'] . "admin/create/post/article/' class='list-group-item'>" . i18n::get('POST_CREATE', 'post') . "</a> \n    </div> \n  </div>"));
     // set default includes
     $this->header = PATH_APP_VIEWS . 'admin/default/assets/inc/_header';
     $this->sidebar = PATH_APP_VIEWS . 'admin/default/assets/inc/_sidebar';
     $this->footer = PATH_APP_VIEWS . 'admin/default/assets/inc/_footer';
 }
开发者ID:peterbrinck,项目名称:PHPMvcCms,代码行数:16,代码来源:AdminController.php

示例2: index

 /**
  * Loop through active controllers and generate sitemap data.
  */
 public function index()
 {
     $controllers = App::objects('Controller');
     $sitemap = array();
     // Fetch sitemap data
     foreach ($controllers as $controller) {
         App::uses($controller, 'Controller');
         // Don't load AppController's, SitemapController or Controller's who can't be found
         if (strpos($controller, 'AppController') !== false || $controller === 'SitemapController' || !App::load($controller)) {
             continue;
         }
         $instance = new $controller($this->request, $this->response);
         $instance->constructClasses();
         if (method_exists($instance, '_generateSitemap')) {
             if ($data = $instance->_generateSitemap()) {
                 $sitemap = array_merge($sitemap, $data);
             }
         }
     }
     // Cleanup sitemap
     if ($sitemap) {
         foreach ($sitemap as &$item) {
             if (is_array($item['loc'])) {
                 if (!isset($item['loc']['plugin'])) {
                     $item['loc']['plugin'] = false;
                 }
                 $item['loc'] = h(Router::url($item['loc'], true));
             }
             if (array_key_exists('lastmod', $item)) {
                 if (!$item['lastmod']) {
                     unset($item['lastmod']);
                 } else {
                     $item['lastmod'] = CakeTime::format(DateTime::W3C, $item['lastmod']);
                 }
             }
         }
     }
     // Disable direct linking
     if (empty($this->request->params['ext'])) {
         throw new NotFoundException();
     }
     // Render view and don't use specific view engines
     $this->RequestHandler->respondAs($this->request->params['ext']);
     $this->set('sitemap', $sitemap);
 }
开发者ID:alescx,项目名称:cakephp-utils,代码行数:48,代码来源:SitemapController.php

示例3: attach

 /**
  * Attaches $adapter and inits it
  *
  * @param string $adapter
  * @param array $config
  * @return boolean
  */
 function attach($adapter, $config)
 {
     $class = $adapter . 'MediaAdapter';
     $file = 'media' . DS . 'adapter' . DS . Inflector::underscore($adapter) . '.php';
     App::uses($class, 'Media.Libs/Media/Adapter');
     if (!class_exists($class)) {
         App::load($class);
         $message = "MediaAdapterCollection::attach() - Adapter `{$adapter}` not found!";
         $this->__errors[] = $message;
         return false;
     }
     $this->{$adapter} = new $class();
     $this->_attached[] = $adapter;
     return true;
 }
开发者ID:razzman,项目名称:media,代码行数:22,代码来源:Media.php

示例4: array

 */
App::uses('FixtureInjector', 'Environment.TestSuite/Fixture');
if (!class_exists('FixtureInjector', false)) {
    App::load('FixtureInjector');
}
App::uses('CakeTestRunner', 'Environment.TestSuite');
if (!class_exists('CakeTestRunner', false)) {
    App::load('CakeTestRunner');
}
App::uses('CakeTestSuiteCommand', 'Environment.TestSuite');
if (!class_exists('CakeTestSuiteCommand', false)) {
    App::load('CakeTestSuiteCommand');
}
App::uses('HHVMTestSuiteDispatcher', 'Environment.TestSuite');
if (!class_exists('HHVMTestSuiteDispatcher', false)) {
    App::load('HHVMTestSuiteDispatcher');
}
App::uses('CakeBaseReporter', 'Environment.TestSuite/Reporter');
if (!class_exists('CakeBaseReporter', false)) {
    App::load('CakeBaseReporter');
}
App::uses('CakeHtmlReporter', 'Environment.TestSuite/Reporter');
if (!class_exists('CakeHtmlReporter', false)) {
    App::load('CakeHtmlReporter');
}
if (!class_exists('Hash')) {
    $merge = array('Set', 'merge');
} else {
    $merge = array('Hash', 'mergeDiff');
}
Configure::write('Environment', call_user_func($merge, array('console' => array('handler' => 'hhvm'), 'xhprof' => array('host' => 'http://xhprof.dev/', 'utils' => '/var/www/xhprof.dev/xhprof_lib/utils/', 'storage' => '/var/www/profiler/xhprof/', 'tag' => 'xhprof'), 'scripts' => array('webroot' => array('index.php', 'test.php'), 'console' => array('cake.php', 'cakehhvm', 'cakephp', 'cakeprofiler', 'caketrace', 'cakexhprof', 'cakexhprof.php'))), Configure::read('Environment')));
开发者ID:imsamurai,项目名称:cakephp-environment,代码行数:31,代码来源:bootstrap.php

示例5: ob_start

<?php

ob_start();
//session_set_cookie_params(172800);
include_once MAIN_DIR . DS . ENGINE_DIR_PREFIX . 'core/defines.php';
include_once CLASS_DIR . DS . 'Load.class.php';
Load::file(array('Temp.class.php', 'File.class.php'), CLASS_DIR);
spl_autoload_register('Load::autoLoadClasses');
register_shutdown_function('Core::shutDown');
//Debug::start();
//$GLOBALS['_SESSION'] = new SessionArray();
Load::getClasses();
Route::init();
App::load(Request::get('app'));
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:14,代码来源:init.php

示例6: handleError

 /**
  * Set as the default error handler by CakePHP. Use Configure::write('Error.handler', $callback), to use your own
  * error handling methods. This function will use Debugger to display errors when debug > 0. And
  * will log errors to CakeLog, when debug == 0.
  *
  * You can use Configure::write('Error.level', $value); to set what type of errors will be handled here.
  * Stack traces for errors can be enabled with Configure::write('Error.trace', true);
  *
  * @param int $code Code of error
  * @param string $description Error description
  * @param string $file File on which error occurred
  * @param int $line Line that triggered the error
  * @param array $context Context
  * @return bool true if error was handled
  */
 public static function handleError($code, $description, $file = null, $line = null, $context = null)
 {
     if (error_reporting() === 0) {
         return false;
     }
     $errorConfig = Configure::read('Error');
     list($error, $log) = static::mapErrorCode($code);
     if ($log === LOG_ERR) {
         return static::handleFatalError($code, $description, $file, $line);
     }
     $debug = Configure::read('debug');
     if ($debug) {
         $data = array('level' => $log, 'code' => $code, 'error' => $error, 'description' => $description, 'file' => $file, 'line' => $line, 'context' => $context, 'start' => 2, 'path' => Debugger::trimPath($file));
         return Debugger::getInstance()->outputError($data);
     }
     $message = $error . ' (' . $code . '): ' . $description . ' in [' . $file . ', line ' . $line . ']';
     if (!empty($errorConfig['trace'])) {
         // https://bugs.php.net/bug.php?id=65322
         if (version_compare(PHP_VERSION, '5.4.21', '<')) {
             if (!class_exists('Debugger')) {
                 App::load('Debugger');
             }
             if (!class_exists('CakeText')) {
                 App::uses('CakeText', 'Utility');
                 App::load('CakeText');
             }
         }
         $trace = Debugger::trace(array('start' => 1, 'format' => 'log'));
         $message .= "\nTrace:\n" . $trace . "\n";
     }
     return CakeLog::write($log, $message);
 }
开发者ID:angel-mendoza,项目名称:proyecto-pasantia,代码行数:47,代码来源:ErrorHandler.php

示例7: array

<?php

/**
 * This file is loaded automatically by the app/webroot/bancha.php file after core.php
 *
 * This file should load/create any application wide configuration settings.
 *
 * Bancha Project : Combining Ext JS and CakePHP (http://banchaproject.org)
 * Copyright 2011-2012 StudioQ OG
 *
 * @package       Bancha.Config
 * @copyright     Copyright 2011-2012 StudioQ OG
 * @link          http://banchaproject.org Bancha Project
 * @since         Bancha v 0.9.0
 * @author        Roland Schuetz <mail@rolandschuetz.at>
 */
// load exceptionhandler
App::uses('BanchaExceptionHandler', 'Bancha.Bancha/ExceptionHandler');
App::load('BanchaExceptionHandler');
// register exceptionhandler
Configure::write('Exception.handler', array('BanchaExceptionHandler', 'handleException'));
// load helper classes for the dispatcher
App::uses('BanchaDispatcher', 'Bancha.Bancha/Routing');
App::uses('BanchaRequestCollection', 'Bancha.Bancha/Network');
// this shouldn't be necessary, but sometime it is.. maybe becaue of the caching?!
App::import('Controller', 'Bancha.Bancha');
开发者ID:rolandschuetz,项目名称:Bancha,代码行数:26,代码来源:bancha-dispatcher-bootstrap.php

示例8: _getErrorMessage

 /**
  * Generate the string to use to describe the error.
  *
  * @param string $error The error type (e.g. "Warning")
  * @param int $code Code of error
  * @param string $description Error description
  * @param string $file File on which error occurred
  * @param int $line Line that triggered the error
  * @return string
  */
 protected static function _getErrorMessage($error, $code, $description, $file, $line)
 {
     $errorConfig = Configure::read('Error');
     $message = $error . ' (' . $code . '): ' . $description . ' in [' . $file . ', line ' . $line . ']';
     if (!empty($errorConfig['trace'])) {
         // https://bugs.php.net/bug.php?id=65322
         if (version_compare(PHP_VERSION, '5.4.21', '<')) {
             if (!class_exists('Debugger')) {
                 App::load('Debugger');
             }
             if (!class_exists('CakeText')) {
                 App::uses('CakeText', 'Utility');
                 App::load('CakeText');
             }
         }
         $trace = Debugger::trace(array('start' => 1, 'format' => 'log'));
         $message .= "\nTrace:\n" . $trace . "\n";
     }
     return $message;
 }
开发者ID:hodrigohamalho,项目名称:cakephp-ex,代码行数:30,代码来源:ErrorHandler.php

示例9: define

<?php

require_once "classes/App.php";
define('HOME_DIR', dirname(__FILE__));
if (file_exists('config.json')) {
    $config = json_decode(file_get_contents('config.json'));
    foreach ($config->constants as $constant => $value) {
        define($constant, $value);
    }
    App::load($config->app);
    unset($config);
    date_default_timezone_set(App::get('timezone'));
} else {
    throw new Exception("Config file doesn't exist!");
}
开发者ID:jankal,项目名称:mvc,代码行数:15,代码来源:config.php

示例10: beforeFilter

<?php

App::uses('Resize', 'Lib');
App::load("Resize");
class DashboardController extends AppController
{
    function beforeFilter()
    {
        $this->layout = 'admin';
        if (!$this->Session->read('admin')) {
            $this->redirect('/admin');
        }
    }
    function index()
    {
    }
    function news()
    {
        $this->loadModel('Categorymanager');
        $q = $this->Categorymanager->find('all', array('order' => array('display_order' => 'asc')));
        $this->set('order', $q);
        $this->loadModel('Newsmanager');
        $a = $this->Newsmanager->find('all');
        $this->set('list', $a);
    }
    function addNews()
    {
        // debug($_POST);die();
        $error = 0;
        if (isset($_POST)) {
            $dateObject = new DateTime(date('Y-m-d G:i:s'));
开发者ID:kodiary,项目名称:hamroawaz,代码行数:31,代码来源:DashboardController.php

示例11: dirname

<?php

require_once dirname(__FILE__) . DS . 'models.php';
App::uses('LikeableBehavior', 'Like.Model/Behavior');
App::load('LikeableBehavior');
class LikeableBehaviorTest extends CakeTestCase
{
    public $fixtures = array('plugin.like.like', 'plugin.like.post', 'plugin.like.user');
    /**
     * Method executed before each test
     *
     */
    public function setUp()
    {
        parent::setUp();
        $this->User = ClassRegistry::init('User');
        $this->Post = ClassRegistry::init('Post');
        $this->User->bindModel(array('hasMany' => array('Post')), false);
        $this->Post->bindModel(array('belongsTo' => array('User')), false);
        $this->Post->Behaviors->attach('Likeable');
    }
    /**
     * Method executed after each test
     *
     */
    public function tearDown()
    {
        unset($this->Post);
        unset($this->User);
        parent::tearDown();
    }
开发者ID:ryuzee,项目名称:cakephp-like-plugin,代码行数:31,代码来源:LikeableBehaviorTest.php

示例12: setupAdminMenus

 public function setupAdminMenus()
 {
     if (Auth::load()->role('broker')) {
         //set posts menu
         App::load()->register('nav', array(" \n  <div class='list-group panel'> \n    <a href='#posts' class='list-group-item list-group-item-info' data-toggle='collapse'>" . I18n::get('POSTS_HEADER') . "</a> \n    <div class='collapse' id='posts'> \n       <a href='" . $this->data['project_url'] . "admin/read/posts/house/' class='list-group-item'>" . I18n::get('POSTS_SUB_HEADER') . "</a> \n      <a href='" . $this->data['project_url'] . "admin/create/posts/house/' class='list-group-item'>" . I18n::get('POSTS_CREATE') . "</a> \n    </div> \n  </div>"));
     }
     //set uplo
 }
开发者ID:WebSupport-DK,项目名称:php-mvc-cms,代码行数:8,代码来源:AdminController.php

示例13: beforeFilter

<?php

App::uses('Rsize', 'Lib');
App::load("Rsize");
class DashboardController extends AppController
{
    function beforeFilter()
    {
        $this->layout = 'admin';
        if (!$this->Session->read('admin')) {
            $this->redirect('/admin');
        }
    }
    function index()
    {
    }
    function logout()
    {
        $this->Session->delete('admin');
        $this->redirect('/admin');
    }
    function pages()
    {
        $this->loadModel('Page');
        $q = $this->Page->find('all', array('conditions' => array('parent' => 0)));
        $this->set('pages', $q);
    }
    function getChild($id)
    {
        $this->loadModel('Page');
        return $this->Page->find('all', array('conditions' => array('parent' => $id)));
开发者ID:kodiary,项目名称:shh,代码行数:31,代码来源:DashboardController.php

示例14:

<!-- Sidebar --> 
<div id="sidebar-wrapper"> 
    <ul class="sidebar-nav"> 
        <li class="sidebar-brand"> 
            <a href="<?php 
echo $this->project_url;
?>
"> 
                MVC CMS
            </a> 
        </li> 
        <?php 
App::load()->get('nav');
?>
 
    </ul> 
</div> 
<!-- /#sidebar-wrapper --> 
<!-- Page Content --> 
<div id="page-content-wrapper"> 
    <div class="container-fluid"> 
        <div class="row"> 
            <div class="col-lg-12"> 
                <a href="#menu-toggle" class="btn btn-default" id="menu-toggle"> 
                    Menu 
                </a> 
                <?php 
$this->renderFeedback(PATH_APP_VIEWS . 'templates/system/feedback.php');
开发者ID:peterbrinck,项目名称:PHPMvcCms,代码行数:28,代码来源:_sidebar.php

示例15: define

<?php

define('APP_ROOT', realpath(__DIR__ . '/../'));
include '../core/helpers.php';
include '../core/autoload.php';
App::load();
开发者ID:ramee,项目名称:alien-framework,代码行数:6,代码来源:index.php


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