本文整理汇总了PHP中AutoLoader::addFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP AutoLoader::addFolder方法的具体用法?PHP AutoLoader::addFolder怎么用?PHP AutoLoader::addFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoLoader
的用法示例。
在下文中一共展示了AutoLoader::addFolder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(&$page, $params)
{
/* Parent behaviours seem to be automatically executed. Bug or feature? */
/* Execute this behaviour only if page equals the current page. */
$check_url = '/' . str_replace(URL_PUBLIC, '', $page->url());
if ($check_url == $_SERVER['REQUEST_URI']) {
/* Workaround for Behaviour::loadPageHack() throwing errors. */
if (class_exists('AutoLoader')) {
AutoLoader::addFolder(dirname(__FILE__));
}
unset($params);
$params['limit'] = 1;
if ($child = $page->children($params)) {
/* For Toad see http://github.com/tuupola/toad */
if (defined('TOAD')) {
header('Location: ' . $child[0]->url());
} else {
header('Location: ' . $child->url());
}
die;
}
}
}
示例2: define
echo '<p>Wolf CMS has been disabled as a security precaution.</p>';
echo '<p><strong>Reason:</strong> the configuration file was found to be writable.</p>';
echo '<p>The broadest rights Wolf CMS allows for config.php are: -rwxr-xr-x</p>';
echo '</body></html>';
exit;
}
}
// Init --------------------------------------------------------------------
define('SESSION_LIFETIME', 3600);
define('REMEMBER_LOGIN_LIFETIME', 1209600);
// two weeks
define('DEFAULT_CONTROLLER', 'page');
define('DEFAULT_ACTION', 'index');
require CORE_ROOT . DS . 'Framework.php';
AutoLoader::register();
AutoLoader::addFolder(array(APP_PATH . DIRECTORY_SEPARATOR . 'models', APP_PATH . DIRECTORY_SEPARATOR . 'controllers'));
try {
$__CMS_CONN__ = new PDO(DB_DSN, DB_USER, DB_PASS);
} catch (PDOException $error) {
die('DB Connection failed: ' . $error->getMessage());
}
$driver = $__CMS_CONN__->getAttribute(PDO::ATTR_DRIVER_NAME);
if ($driver === 'mysql') {
$__CMS_CONN__->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
}
if ($driver === 'sqlite') {
// Adding date_format function to SQLite 3 'mysql date_format function'
if (!function_exists('mysql_date_format_function')) {
function mysql_function_date_format($date, $format)
{
return strftime($format, strtotime($date));
示例3:
* Funky Cache plugin for Wolf CMS. <http://www.wolfcms.org>
*
* Copyright (C) 2012 Martijn van der Kleijn <martijn.niji@gmail.com>
* Copyright (c) 2008-2009 Mika Tuupola
*
* This file is part of the Funky Cache plugin for Wolf CMS. It is licensed
* under the MIT license.
*
* For details, see: http://www.opensource.org/licenses/mit-license.php
*/
//require_once 'models/FunkyCachePage.php';
Plugin::setInfos(array('id' => 'funky_cache', 'title' => 'Funky Cache', 'description' => 'Enables funky caching, making your site ultra fast.', 'version' => '0.4.1', 'license' => 'MIT', 'author' => 'Mika Tuupola & Martijn van der Kleijn', 'require_wolf_version' => '0.7.5+', 'website' => 'http://vanderkleijn.net/'));
AutoLoader::addFolder(PLUGINS_ROOT . '/funky_cache/models');
/* Stuff for backend. */
if (defined('CMS_BACKEND')) {
AutoLoader::addFolder(dirname(__FILE__) . '/lib');
Plugin::addController('funky_cache', __('Cache'), "admin_view", true);
#Observer::observe('page_edit_after_save', 'funky_cache_delete_one');
Observer::observe('page_edit_after_save', 'funky_cache_delete_all');
Observer::observe('page_add_after_save', 'funky_cache_delete_all');
Observer::observe('page_delete', 'funky_cache_delete_all');
Observer::observe('view_page_edit_plugins', 'funky_cache_show_select');
Observer::observe('comment_after_add', 'funky_cache_delete_all');
Observer::observe('comment_after_edit', 'funky_cache_delete_all');
Observer::observe('comment_after_delete', 'funky_cache_delete_all');
Observer::observe('comment_after_approve', 'funky_cache_delete_all');
Observer::observe('comment_after_unapprove', 'funky_cache_delete_all');
Observer::observe('layout_after_edit', 'funky_cache_delete_all');
Observer::observe('snippet_after_edit', 'funky_cache_delete_all');
/* TODO Fix this to work with configurable cache folder. */
function funky_cache_delete_one($page)
示例4: foreach
return;
} else {
foreach (self::$folders as $folder) {
$file = $folder . $class_name . '.php';
if (file_exists($file)) {
require $file;
return;
}
}
}
throw new Exception("Class '{$class_name}' not found!");
}
}
// end AutoLoader class
if (!function_exists('__autoload')) {
AutoLoader::addFolder(array(APPPATH . '/models/', APPPATH . '/controllers/'));
function __autoload($class_name)
{
AutoLoader::load($class_name);
}
}
/*
Function: use_helper
Load all classes and/or functions from the helper file(s)
example:
use_helper('I18n', 'Pagination');
*/
function use_helper()
{
static $helpers = array();
示例5:
<?php
if (!defined('IN_CMS')) {
exit;
}
// Provide the neccessary plugin information for Wolf.
Plugin::setInfos(array('id' => 'ssp', 'title' => 'Slide Show Pro', 'description' => 'Slide Show Pro integration for Wolf', 'version' => '1.5.0', 'author' => 'Arik Savage', 'website' => 'http://www.example.com', 'require_wolf_version' => '0.5.5'));
/**
* Load the plugin controller.
*
* addController explained:
* 'menu' => The plugin ID.
* 'Menu' => The plugin tab label.
* 'administrator' => permission name or group name - restricts who can access the controller.
* 'true' => If set to true, a plugin tab is displayed in the backend navigation menu (default = false).
*/
Plugin::addController('ssp', 'SlideShow Pro', 'administrator', true);
Filter::add('slideshow', 'ssp/filter_slideshow.php');
// Load the plugin models.
AutoLoader::addFolder(PLUGINS_ROOT . DS . 'ssp' . DS . 'models');
//load javascript for backend
Plugin::addJavascript('ssp', 'js/ssp_scripts.js');
Plugin::addJavascript('ssp', 'js/slideshow.js');
示例6: strtolower
<?php
// Included?
if (!defined('IN_FROG')) {
exit;
}
AutoLoader::addFolder(dirname(__FILE__) . '/models');
$table_name = TABLE_PREFIX . PagePartForm::TABLE_NAME;
// Connection
$pdo = Record::getConnection();
$driver = strtolower($pdo->getAttribute(Record::ATTR_DRIVER_NAME));
if ($driver == 'mysql') {
// Create table
$pdo->exec("CREATE TABLE {$table_name} (\n id int(11) unsigned NOT NULL AUTO_INCREMENT,\n name varchar(255) NOT NULL,\n definition TEXT,\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
} else {
if ($driver == 'sqlite') {
// Create table
$pdo->exec("CREATE TABLE {$table_name} (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(255) NOT NULL,\n definition TEXT\n )");
}
}