示例#1
0
 /**
  * start test
  *
  * @return void
  **/
 public function setUp()
 {
     $this->Version = new MigrationVersion(array('connection' => 'test'));
     $plugins = $this->plugins = App::path('plugins');
     $plugins[] = dirname(dirname(dirname(__FILE__))) . DS . 'test_app' . DS . 'Plugin' . DS;
     App::build(array('plugins' => $plugins), true);
     CakePlugin::loadAll();
 }
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     App::build(array('plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), 'Console/Command' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Console' . DS . 'Command' . DS)), true);
     CakePlugin::loadAll();
     $out = new TestStringOutput();
     $in = $this->getMock('ConsoleInput', array(), array(), '', false);
     $this->Shell = $this->getMock('CommandListShell', array('in', '_stop', 'clear'), array($out, $out, $in));
 }
示例#3
0
 /**
  * setup
  *
  * @return void
  */
 public function setUp()
 {
     App::build(array('plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)));
     CakePlugin::loadAll();
     $reporter = new CakeBaseReporter();
     $reporter->params = array('app' => false, 'plugin' => false, 'group' => false);
     $coverage = array();
     $this->Coverage = new HtmlCoverageReport($coverage, $reporter);
 }
示例#4
0
文件: Mwb.php 项目: asper/mwb
 public function listFiles()
 {
     $paths = array('app' => APP . 'Config' . DS . 'Schema' . DS);
     $plugins = App::objects('plugin');
     CakePlugin::loadAll();
     foreach ($plugins as $plugin) {
         $paths[$plugin] = App::pluginPath($plugin) . 'Config' . DS . 'Schema' . DS;
     }
     $fileList = array();
     $folder = new Folder();
     foreach ($paths as $plugin => $path) {
         if ($folder->cd($path)) {
             $files = $folder->find('.*\\.mwb');
             if (!empty($files)) {
                 foreach ($files as $file) {
                     $pathinfo = pathinfo($file);
                     $fileList[] = array('name' => $plugin . '/' . $pathinfo['filename']);
                 }
             }
         }
     }
     return $fileList;
 }
示例#5
0
<?php

/* 注意这里的插件加载必须在DbLog配置前调用, 否则会出现错误 */
CakePlugin::loadAll(array('Media' => array('bootstrap' => true)));
/* 配置LogStream Writer */
App::uses('CakeLog', 'Log');
CakeLog::config('DbLog', array('engine' => 'DbLog', 'model' => 'Log'));
示例#6
0
 /**
  * test requestAction() with arrays.
  *
  * @return void
  */
 public function testRequestActionArray()
 {
     App::build(array('models' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS), 'views' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS), 'controllers' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Controller' . DS), 'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)), true);
     CakePlugin::loadAll();
     $result = $this->object->requestAction(array('controller' => 'request_action', 'action' => 'test_request_action'));
     $expected = 'This is a test';
     $this->assertEqual($expected, $result);
     $result = $this->object->requestAction(array('controller' => 'request_action', 'action' => 'another_ra_test'), array('pass' => array('5', '7')));
     $expected = 12;
     $this->assertEqual($expected, $result);
     $result = $this->object->requestAction(array('controller' => 'tests_apps', 'action' => 'index'), array('return'));
     $expected = 'This is the TestsAppsController index view ';
     $this->assertEqual($expected, $result);
     $result = $this->object->requestAction(array('controller' => 'tests_apps', 'action' => 'some_method'));
     $expected = 5;
     $this->assertEqual($expected, $result);
     $result = $this->object->requestAction(array('controller' => 'request_action', 'action' => 'normal_request_action'));
     $expected = 'Hello World';
     $this->assertEqual($expected, $result);
     $result = $this->object->requestAction(array('controller' => 'request_action', 'action' => 'paginate_request_action'));
     $this->assertTrue($result);
     $result = $this->object->requestAction(array('controller' => 'request_action', 'action' => 'paginate_request_action'), array('pass' => array(5), 'named' => array('param' => 'value')));
     $this->assertTrue($result);
 }
示例#7
0
 /**
  * Setup paths to test_app
  */
 protected function _setupPaths()
 {
     App::build(array('Model' => App::pluginPath('Oven') . 'Test' . DS . 'test_app' . DS . 'Model' . DS, 'Controller' => App::pluginPath('Oven') . 'Test' . DS . 'test_app' . DS . 'Controller' . DS, 'View' => App::pluginPath('Oven') . 'Test' . DS . 'test_app' . DS . 'View' . DS), App::RESET);
     CakePlugin::loadAll();
 }
示例#8
0
 /**
  * test that the required default routes are connected.
  *
  * @return void
  */
 public function testConnectDefaultRoutes()
 {
     App::build(array('plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)), true);
     CakePlugin::loadAll();
     Router::reload();
     require CAKE . 'Config' . DS . 'routes.php';
     $result = Router::url(array('plugin' => 'plugin_js', 'controller' => 'js_file', 'action' => 'index'));
     $this->assertEquals($result, '/plugin_js/js_file');
     $result = Router::parse('/plugin_js/js_file');
     $expected = array('plugin' => 'plugin_js', 'controller' => 'js_file', 'action' => 'index', 'named' => array(), 'pass' => array());
     $this->assertEquals($expected, $result);
     $result = Router::url(array('plugin' => 'test_plugin', 'controller' => 'test_plugin', 'action' => 'index'));
     $this->assertEquals($result, '/test_plugin');
     $result = Router::parse('/test_plugin');
     $expected = array('plugin' => 'test_plugin', 'controller' => 'test_plugin', 'action' => 'index', 'named' => array(), 'pass' => array());
     $this->assertEquals($expected, $result, 'Plugin shortcut route broken. %s');
 }
 /**
  * testConnectionData method
  *
  * @return void
  */
 public function testConnectionData()
 {
     App::build(array('plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), 'Model/Datasource' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS)), App::RESET);
     CakePlugin::loadAll();
     $expected = array('datasource' => 'Test2Source');
     ConnectionManager::create('connection1', array('datasource' => 'Test2Source'));
     $connections = ConnectionManager::enumConnectionObjects();
     $this->assertEqual($expected, $connections['connection1']);
     ConnectionManager::drop('connection1');
     ConnectionManager::create('connection2', array('datasource' => 'Test2Source'));
     $connections = ConnectionManager::enumConnectionObjects();
     $this->assertEqual($expected, $connections['connection2']);
     ConnectionManager::drop('connection2');
     ConnectionManager::create('connection3', array('datasource' => 'TestPlugin.TestSource'));
     $connections = ConnectionManager::enumConnectionObjects();
     $expected['datasource'] = 'TestPlugin.TestSource';
     $this->assertEqual($expected, $connections['connection3']);
     ConnectionManager::drop('connection3');
     ConnectionManager::create('connection4', array('datasource' => 'TestPlugin.TestSource'));
     $connections = ConnectionManager::enumConnectionObjects();
     $this->assertEqual($expected, $connections['connection4']);
     ConnectionManager::drop('connection4');
     ConnectionManager::create('connection5', array('datasource' => 'Test2OtherSource'));
     $connections = ConnectionManager::enumConnectionObjects();
     $expected['datasource'] = 'Test2OtherSource';
     $this->assertEqual($expected, $connections['connection5']);
     ConnectionManager::drop('connection5');
     ConnectionManager::create('connection6', array('datasource' => 'Test2OtherSource'));
     $connections = ConnectionManager::enumConnectionObjects();
     $this->assertEqual($expected, $connections['connection6']);
     ConnectionManager::drop('connection6');
     ConnectionManager::create('connection7', array('datasource' => 'TestPlugin.TestOtherSource'));
     $connections = ConnectionManager::enumConnectionObjects();
     $expected['datasource'] = 'TestPlugin.TestOtherSource';
     $this->assertEqual($expected, $connections['connection7']);
     ConnectionManager::drop('connection7');
     ConnectionManager::create('connection8', array('datasource' => 'TestPlugin.TestOtherSource'));
     $connections = ConnectionManager::enumConnectionObjects();
     $this->assertEqual($expected, $connections['connection8']);
     ConnectionManager::drop('connection8');
 }
 /**
  * reset environment.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     App::build(array('plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), 'Controller' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Controller' . DS), 'Model' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS), 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)), App::RESET);
     CakePlugin::loadAll();
     $this->Case = $this->getMockForAbstractClass('ControllerTestCase');
     Router::reload();
 }
示例#11
0
CakePlugin::load('UrlCache');
/**
 * Uncomment the following line to enable client SSL certificate authentication.
 * It's also necessary to configure the plugin — for more information, please read app/Plugin/CertAuth/reame.md
 */
// CakePlugin::load('CertAuth');
/**
 * You can attach event listeners to the request lifecyle as Dispatcher Filter . By Default CakePHP bundles two filters:
 *
 * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins
 * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers
 *
 * Feel free to remove or add filters as you see fit for your application. A few examples:
 *
 * Configure::write('Dispatcher.filters', array(
 *		'MyCacheFilter', //  will use MyCacheFilter class from the Routing/Filter package in your app.
 *		'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin.
 * 		array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch
 *		array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch
 *
 * ));
 */
Configure::write('Dispatcher.filters', array('AssetDispatcher', 'CacheDispatcher'));
/**
 * Configures default file logging options
 */
App::uses('CakeLog', 'Log');
CakeLog::config('debug', array('engine' => 'FileLog', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug'));
CakeLog::config('error', array('engine' => 'FileLog', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), 'file' => 'error'));
CakePlugin::loadAll(array('CakeResque' => array('bootstrap' => true)));
示例#12
0
 public function install($id)
 {
     $entry = $this->getEntry($id);
     if ($entry && !empty($entry['url'])) {
         App::uses('File', 'Utility');
         copy($entry['url'], TMP . DS . $id);
         App::import('Vendor', 'PclZip', array('file' => 'pclzip-2-8-2/pclzip.lib.php'));
         $zip = new PclZip(TMP . DS . $id);
         $list = $zip->listContent();
         $zip->extract(TMP);
         unlink(TMP . DS . $id);
         rename(TMP . DS . $list[0]['filename'], APP . 'Plugin' . DS . Inflector::camelize($id));
         Cache::clear(false, '_cake_core_');
         CakePlugin::loadAll();
         return true;
     }
     return false;
 }
示例#13
0
/**
 * Custom Inflector rules can be set to correctly pluralize or singularize table, model, controller names or whatever other
 * string is passed to the inflection functions
 *
 * Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
 * Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
 */
/**
 * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
 * Uncomment one of the lines below, as you need. Make sure you read the documentation on CakePlugin to use more
 * advanced ways of loading plugins
 *
 * CakePlugin::loadAll(); // Loads all plugins at once
 * CakePlugin::load('DebugKit'); // Loads a single plugin named DebugKit
 */
CakePlugin::loadAll(array('Users' => array('routes' => true)));
/**
 * To prefer app translation over plugin translation, you can set
 *
 * Configure::write('I18n.preferApp', true);
 */
/**
 * You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters:
 *
 * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins
 * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers
 *
 * Feel free to remove or add filters as you see fit for your application. A few examples:
 *
 * Configure::write('Dispatcher.filters', array(
 *		'MyCacheFilter', //  will use MyCacheFilter class from the Routing/Filter package in your app.
 /**
  * Test connecting the default routes with i18n
  * 
  * @return false
  * @access public
  */
 public function testConnectDefaultRoutes()
 {
     App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)), APP::RESET);
     CakePlugin::loadAll();
     Configure::write('Routing.prefixes', array('admin'));
     Router::reload();
     include CakePlugin::path('I18n') . 'Config' . DS . 'routes.php';
     $result = Router::url(array('plugin' => 'plugin_js', 'controller' => 'js_file', 'action' => 'index'));
     $this->assertEquals($result, '/spa/plugin_js/js_file');
     $result = Router::url(array('plugin' => 'plugin_js', 'controller' => 'js_file', 'action' => 'index', 'admin' => true));
     $this->assertEquals($result, '/spa/admin/plugin_js/js_file');
     $result = Router::parse('/plugin_js/js_file');
     $expected = array('plugin' => 'plugin_js', 'controller' => 'js_file', 'action' => 'index', 'named' => array(), 'pass' => array(), 'lang' => $this->__defaultLang);
     $this->assertEquals($result, $expected);
     $result = Router::parse('/admin/plugin_js/js_file');
     $expected['prefix'] = 'admin';
     $expected['admin'] = true;
     $expected['action'] = 'admin_index';
     $this->assertEquals($result, $expected);
     $result = Router::parse('/spa/admin/plugin_js/js_file');
     $expected['lang'] = 'spa';
     $this->assertEquals($result, $expected);
     $result = Router::parse('/spa/plugin_js/js_file');
     unset($expected['admin'], $expected['prefix']);
     $expected['action'] = 'index';
     $this->assertEquals($result, $expected);
 }
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     App::build(array('plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), 'Console/Command' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Console' . DS . 'Command' . DS)), true);
     CakePlugin::loadAll();
 }
示例#16
0
 *
 * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'home', 'action' => 'index'));
/**
 * ...and connect the rest of 'Pages' controller's urls.
 */
//Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
Router::connect("/theberrics.ics", array("controller" => "dashboard", "action" => "cal"));
Router::connect("/dashboard/reports", array("plugin" => "bq_reports", "controller" => "dashboard"));
Router::connect("/dashboard/reports/:controller/:action/*", array("plugin" => "bq_reports"));
/**
 * Load all plugin routes.  See the CakePlugin documentation on 
 * how to customize the loading of plugin routes.
 */
CakePlugin::loadAll(array("Unified" => array("routes" => true)));
CakePlugin::routes('Unified');
/**
 * Load the CakePHP default routes. Remove this if you do not want to use
 * the built-in default routes.
 */
require CAKE . 'Config' . DS . 'routes.php';
示例#17
0
 */
Configure::write('Dispatcher.filters', array('AssetDispatcher'));
Configure::load('company');
Configure::load('marketing');
Configure::load('permission');
Configure::write('App.default_meta_title_prefix', __('Fyooz CRM | '));
Configure::write('App.default_meta_title_surfix', __(' - www.fyooz.com'));
Configure::write('App.default_meta_keywords', __('Fyooz, CRM'));
Configure::write('App.default_meta_description', __('Fyooz CRM - Developed by www.onlinebizsoft.com'));
/**
 * Configures default file logging options
 */
App::uses('CakeLog', 'Log');
CakeLog::config('debug', array('engine' => 'File', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug'));
CakeLog::config('error', array('engine' => 'File', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), 'file' => 'error'));
CakePlugin::loadAll(array('Permissionable' => array('bootstrap' => true), 'DebugKit', 'Client' => array('bootstrap' => true), 'Company' => array('bootstrap' => true), 'Marketing' => array('bootstrap' => true), 'Accounting' => array('bootstrap' => true), 'Project' => array('bootstrap' => true)));
define('PAGE_NAME', 'Fyooz CRM');
define('UPLOAD_PATH', WWW_ROOT . 'uploads');
define('UPLOAD_TEMP', UPLOAD_PATH . DS . 'tmp');
define('ROWPERPAGE', 10);
define('FULL_PATH_DOMAIN', 'http://crm.demoserver.sg/');
function formatDate($date)
{
    if (empty($date)) {
        return;
    }
    $timezone = Configure::read('Config.timezone');
    $timezone = empty($timezone) ? 'Asia/Singapore' : Configure::read('Config.timezone');
    $format = Configure::read('Settings.Formats.date_format');
    $date = new DateTime($date, new DateTimeZone('UTC'));
    $date->setTimezone(new DateTimeZone($timezone));
示例#18
0
/**
 * Tests that the automatic class loader will also find in "libs" folder for both
 * app and plugins if it does not find the class in other configured paths
 *
 */
	public function testLoadClassInLibs() {
		App::build(array(
			'libs' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Lib' . DS),
			'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
		), App::RESET);
		CakePlugin::loadAll();

		$this->assertFalse(class_exists('CustomLibClass', false));
		App::uses('CustomLibClass', 'TestPlugin.Custom/Package');
		$this->assertTrue(class_exists('CustomLibClass'));

		$this->assertFalse(class_exists('TestUtilityClass', false));
		App::uses('TestUtilityClass', 'Utility');
		$this->assertTrue(class_exists('CustomLibClass'));
	}
示例#19
0
 /**
  * test loading a plugin helper.
  *
  * @return void
  */
 public function testLoadPluginHelper()
 {
     App::build(array('plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)));
     CakePlugin::loadAll();
     $result = $this->Helpers->load('TestPlugin.OtherHelper');
     $this->assertInstanceOf('OtherHelperHelper', $result, 'Helper class is wrong.');
     $this->assertInstanceOf('OtherHelperHelper', $this->Helpers->OtherHelper, 'Class is wrong');
     App::build();
 }
示例#20
0
 /**
  * reset environment.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     App::build(array('plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), 'Controller' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Controller' . DS), 'Model' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS), 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)));
     CakePlugin::loadAll();
     $this->Case = new ControllerTestCase();
     Router::reload();
 }
示例#21
0
 /**
  * Tests that CakePlugin::loadAll() will load all plugins in the configured folder with defaults
  * and overrides for a plugin
  *
  * @return void
  */
 public function testLoadAllWithDefaultsAndOverrideComplex()
 {
     CakePlugin::loadAll(array(array('bootstrap' => true), 'TestPlugin' => array('routes' => true, 'bootstrap' => false)));
     CakePlugin::routes();
     $expected = array('PluginJs', 'TestPlugin', 'TestPluginTwo');
     $this->assertEquals($expected, CakePlugin::loaded());
     $this->assertEquals('loaded js plugin bootstrap', Configure::read('CakePluginTest.js_plugin.bootstrap'));
     $this->assertEquals('loaded plugin routes', Configure::read('CakePluginTest.test_plugin.routes'));
     $this->assertEquals(null, Configure::read('CakePluginTest.test_plugin.bootstrap'));
     $this->assertEquals('loaded plugin two bootstrap', Configure::read('CakePluginTest.test_plugin_two.bootstrap'));
 }
示例#22
0
<?php

require APP . 'Vendor' . DS . 'autoload.php';
CakePlugin::loadAll(array('Tools' => array('bootstrap' => true)));
App::uses('Auth', 'Tools.Lib');
Configure::load('configs');
// to define own parameters
Configure::load('configs_private');
// to define own non-version-controlled parameters
// see: http://nik.chankov.net/2007/12/20/using-different-date-format-in-cakephp-12/
Configure::write('DateBehaviour.dateFormat', 'dd.mm.yyyy');
Configure::write('DateBehaviour.delimiterDateFormat', '.');
Configure::write('DatePicker.format', '%d.%m.%Y');
define('WEBSERVICES', 'on');
define('PAGINATOR_SEPARATOR', ' | ');
define('ICON_ORDER', 'order.gif');
示例#23
0
 * Uncomment one of the lines below, as you need. Make sure you read the documentation on CakePlugin to use more
 * advanced ways of loading plugins
 *
 * CakePlugin::loadAll(); // Loads all plugins at once
 * CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit
 *
 */
/**
 * You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters:
 *
 * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins
 * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers
 *
 * Feel free to remove or add filters as you see fit for your application. A few examples:
 *
 * Configure::write('Dispatcher.filters', array(
 *		'MyCacheFilter', //  will use MyCacheFilter class from the Routing/Filter package in your app.
 *		'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin.
 * 		array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch
 *		array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch
 *
 * ));
 */
CakePlugin::loadAll(array('Facebook' => array('bootstrap' => true)));
Configure::write('Dispatcher.filters', array('AssetDispatcher', 'CacheDispatcher'));
/**
 * Configures default file logging options
 */
App::uses('CakeLog', 'Log');
CakeLog::config('debug', array('engine' => 'File', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug'));
CakeLog::config('error', array('engine' => 'File', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), 'file' => 'error'));
 * string is passed to the inflection functions
 *
 * Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
 * Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
 *
 */
/**
 * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
 * Uncomment one of the lines below, as you need. Make sure you read the documentation on CakePlugin to use more
 * advanced ways of loading plugins
 *
 * CakePlugin::loadAll(); // Loads all plugins at once
 * CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit
 *
 */
CakePlugin::loadAll(array('Paszport' => array('routes' => true), 'KodyPocztowe' => array('routes' => true), 'KRS' => array('routes' => true), 'NGO' => array('routes' => true), 'Administracja' => array('routes' => true), 'Geo' => array('routes' => true), 'Prawo' => array('routes' => true), 'Sejmometr' => array('routes' => true), 'PanstwoInternet' => array('routes' => true), 'Media' => array('routes' => true), 'MapaPrawa' => array('routes' => true), 'ZamowieniaPubliczne' => array('routes' => true), 'Finanse' => array('routes' => true), 'OAuth' => array('routes' => true, 'bootstrap' => false), 'Obszary' => array('routes' => true, 'bootstrap' => false), 'Pisma' => array('routes' => true), 'BDL' => array('routes' => true), 'Dane' => array('routes' => true), 'Kultura' => array('routes' => true), 'WyjazdyPoslow' => array('routes' => true), 'WydatkiPoslow' => array('routes' => true), 'Admin' => array('routes' => true), 'Survey' => array('routes' => true), 'MapaKrakow' => array('routes' => true), 'Collections' => array('routes' => true), 'Mapa' => array('routes' => true)));
/**
 * You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters:
 *
 * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins
 * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers
 *
 * Feel free to remove or add filters as you see fit for your application. A few examples:
 *
 * Configure::write('Dispatcher.filters', array(
 *        'MyCacheFilter', //  will use MyCacheFilter class from the Routing/Filter package in your app.
 *        'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin.
 *        array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch
 *        array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch
 *
 * ));
示例#25
0
 /**
  * Proves that it is possible to load plugin libraries in top
  * level Lib dir for plugins
  *
  * @return void
  */
 public function testPluginLibClasses()
 {
     App::build(array('plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)), App::RESET);
     CakePlugin::loadAll();
     $this->assertFalse(class_exists('TestPluginOtherLibrary', false));
     App::uses('TestPluginOtherLibrary', 'TestPlugin.Lib');
     $this->assertTrue(class_exists('TestPluginOtherLibrary'));
 }
示例#26
0
 /**
  * test lazy loading helpers is seamless
  *
  * @return void
  */
 public function testLazyLoadingHelpers()
 {
     App::build(array('plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)));
     CakePlugin::loadAll();
     $Helper = new TestHelper($this->View);
     $this->assertInstanceOf('OtherHelperHelper', $Helper->OtherHelper);
     $this->assertInstanceOf('HtmlHelper', $Helper->Html);
     App::build();
 }
示例#27
0
<?php

define('CANDYCANE_VERSION', '0.9.0');
Configure::write('app_title', 'Candycane');
setlocale(LC_CTYPE, 'C');
App::import('Vendor', 'candycane/MenuContainer');
App::import('Vendor', 'candycane/HookContainer');
App::import('Vendor', 'candycane/PluginContainer');
App::import('Vendor', 'candycane/SettingContainer');
$menu_container = new MenuContainer();
$hookContainer = new HookContainer();
$pluginContainer = new PluginContainer();
$settingContainer = new SettingContainer();
App::uses('ClassRegistry', 'Utility');
CakePlugin::loadAll(array());
ClassRegistry::addObject('HookContainer', $hookContainer);
ClassRegistry::addObject('MenuContainer', $menu_container);
ClassRegistry::addObject('PluginContainer', $pluginContainer);
ClassRegistry::addObject('SettingContainer', $settingContainer);
foreach (glob(APP . 'Plugin/Cc*/init.php') as $val) {
    include_once realpath($val);
}
// by PHP_Compat 1.6.0a2
function php_compat_http_build_query($formdata, $numeric_prefix = null)
{
    // If $formdata is an object, convert it to an array
    if (is_object($formdata)) {
        $formdata = get_object_vars($formdata);
    }
    // Check we have an array to work with
    if (!is_array($formdata)) {
示例#28
0
 * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins
 * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers
 *
 * Feel free to remove or add filters as you see fit for your application. A few examples:
 *
 * Configure::write('Dispatcher.filters', array(
 *        'MyCacheFilter', //  will use MyCacheFilter class from the Routing/Filter package in your app.
 *        'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin.
 *        array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch
 *        array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch
 *
 * ));
 */
Configure::write('Dispatcher.filters', array('AssetDispatcher', 'CacheDispatcher'));
$plugin_definitions = array(array('routes' => true, 'bootstrap' => true), 'DebugKit' => array('routes' => false), 'UserBar' => array('routes' => false, 'bootstrap' => true), 'BoostCake' => array('bootstrap' => false, 'routes' => false), 'Administracja' => array('routes' => false, 'bootstrap' => false), 'Composer' => array('routes' => false), 'Less' => array('routes' => false, 'bootstrap' => false), 'Facebook' => array('routes' => false, 'bootstrap' => false), 'Expandable' => array('routes' => false, 'bootstrap' => false), 'Upload' => array('routes' => false, 'bootstrap' => false), 'Api' => array('routes' => true, 'bootstrap' => false), 'Pisma' => array('routes' => true, 'bootstrap' => false), 'MojaGmina' => array('routes' => true, 'bootstrap' => false), 'Powiadomienia' => array('routes' => true, 'bootstrap' => false), 'Orzecznictwo' => array('routes' => true, 'bootstrap' => false), 'Ngo' => array('routes' => true, 'bootstrap' => false), 'Media' => array('routes' => true, 'bootstrap' => false), 'OAuth' => array('bootstrap' => false, 'routes' => true), 'Combinator' => array('bootstrap' => false, 'routes' => false), 'Mapaprawa' => array('routes' => true, 'bootstrap' => false), 'Kultura' => array('routes' => true, 'bootstrap' => false), 'Finanse' => array('routes' => true, 'bootstrap' => false), 'Sentry' => array('routes' => false, 'bootstrap' => false), 'Widgets' => array('routes' => true, 'bootstrap' => false), 'Collections' => array('routes' => true, 'bootstrap' => true));
CakePlugin::loadAll($plugin_definitions);
/**
 * Configures default file logging options
 */
App::uses('CakeLog', 'Log');
CakeLog::config('debug', array('engine' => 'File', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug'));
CakeLog::config('error', array('engine' => 'File', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), 'file' => 'error'));
//setlocale(LC_ALL, 'pl_PL');
require_once 'endpoints.php';
// Load Composer autoload.
require APP . 'Vendor/autoload.php';
// Remove and re-prepend CakePHP's autoloader as Composer thinks it is the
// most important.
// See: http://goo.gl/kKVJO7
spl_autoload_unregister(array('App', 'load'));
spl_autoload_register(array('App', 'load'), true, true);
示例#29
0
/**
 * Custom Inflector rules can be set to correctly pluralize or singularize table, model, controller names or whatever other
 * string is passed to the inflection functions
 *
 * Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
 * Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
 */
/**
 * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
 * Uncomment one of the lines below, as you need. Make sure you read the documentation on CakePlugin to use more
 * advanced ways of loading plugins
 *
 * CakePlugin::loadAll(); // Loads all plugins at once
 * CakePlugin::load('DebugKit'); // Loads a single plugin named DebugKit
 */
CakePlugin::loadAll();
// Loads all plugins at once
CakePlugin::load('DebugKit');
// Loads a single plugin named DebugKit
/**
 * To prefer app translation over plugin translation, you can set
 *
 * Configure::write('I18n.preferApp', true);
 */
/**
 * You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters:
 *
 * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins
 * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers
 *
 * Feel free to remove or add filters as you see fit for your application. A few examples:
示例#30
0
 /**
  * Test assets
  *
  * @dataProvider assetProvider
  * @outputBuffering enabled
  * @return void
  */
 public function testAsset($url, $file)
 {
     Router::reload();
     App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), 'Vendor' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor' . DS), 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)));
     CakePlugin::loadAll();
     $Dispatcher = new TestDispatcher();
     $response = $this->getMock('CakeResponse', array('_sendHeader'));
     $Dispatcher->dispatch(new CakeRequest($url), $response);
     $result = ob_get_clean();
     $path = CAKE . 'Test' . DS . 'test_app' . DS . str_replace('/', DS, $file);
     $file = file_get_contents($path);
     $this->assertEquals($file, $result);
     $expected = filesize($path);
     $headers = $response->header();
     $this->assertEquals($expected, $headers['Content-Length']);
 }