本文整理汇总了PHP中Core::loadClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::loadClass方法的具体用法?PHP Core::loadClass怎么用?PHP Core::loadClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::loadClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: contact
private function contact()
{
$isSent = Request::get(0, VAR_URI) == 'send';
$options = array('name' => array(Validator::MESSAGE => 'Der Name muss mindestens 5 und darf maximal 150 Zeichen lang sein.', Validator::MIN_LENGTH => 5, Validator::MAX_LENGTH => 150), 'email' => array(Validator::MESSAGE => 'Die E-Mail-Adresse ist nicht korrekt.', Validator::CALLBACK => Validator::CB_MAIL), 'message' => array(Validator::MESSAGE => 'Die Nachricht entspricht nicht den Vorgaben (mindestens 10 Zeichen, maximal 1000 Zeichen).', Validator::MIN_LENGTH => 10, Validator::MAX_LENGTH => 1000), 'title' => array(Validator::MESSAGE => 'Der Titel entspricht nicht den Vorgaben (mindestens 5 Zeichen, maximal 100 Zeichen).', Validator::MIN_LENGTH => 5, Validator::MAX_LENGTH => 100));
$this->enableClientFormValidation($options);
// Don't validate the captcha via ajax as the session would end
if (Config::get('captcha.enable')) {
Core::loadClass('Core.Security.ReCaptcha');
$options['recaptcha_response_field'] = array(Validator::MESSAGE => 'Der Sicherheitscode wurde nicht korrekt eingegeben.', Validator::CALLBACK => 'cb_captcha_check');
}
$data = array_fill_keys(array_keys($options), '');
$data['name'] = iif(Me::get()->loggedIn(), Me::get()->getName());
$data['email'] = iif(Me::get()->loggedIn(), Me::get()->getEmail());
$this->breadcrumb->add('Kontakt');
$this->header();
if ($isSent) {
extract(Validator::checkRequest($options));
if (count($error) > 0) {
CmsPage::error($error);
} else {
CmsTools::sendMail(Config::get('general.email'), $data['title'], $data['message'], $data['email'], $data['name']);
CmsPage::ok('Die Anfrage wurde erfolgreich verschickt. Vielen Dank!');
$data['title'] = '';
$data['message'] = '';
}
}
$tpl = Response::getObject()->appendTemplate('Cms/contact/contact');
$tpl->assign('data', $data);
if (Config::get('captcha.enable')) {
$tpl->assign('captcha', recaptcha_get_html(Config::get('captcha.public_key')), false);
}
$tpl->output();
$this->footer();
}
示例2: sendMail
public static function sendMail($to, $title, $message, $from = null, $fromName = null, $attachments = array())
{
Core::loadClass('Core.Net.Mail.PHPMailer');
$mail = new PHPMailer();
$mail->AddAddress($to);
$mail->Body = $message;
$mail->CharSet = Config::get('intl.charset');
$mail->Subject = $title;
if ($from != null) {
$mail->From = $from;
} else {
$mail->From = Config::get('general.email');
}
if ($fromName != null) {
$mail->FromName = $fromName;
} else {
$mail->FromName = Config::get('general.title');
}
if (count($attachments) > 0) {
foreach ($attachments as $file) {
$mail->AddAttachment($file);
}
}
if (Config::get('core.debug') == 1) {
var_dump($to, $title, $message, $from, $fromName, $attachments);
} else {
$mail->Send();
}
}
示例3: getInstance
public static final function getInstance() {
$class = get_called_class();
if (empty(self::$objects[$class])) {
Core::loadClass('Core.Util.Utility');
self::$objects[$class] = Utility::createClassInstance($class, func_get_args());
}
return self::$objects[$class];
}
示例4:
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package Core
* @subpackage Kernel
* @author Matthias Mohr
* @copyright Copyright (c) 2004-2010, Viscacha.org
* @license http://www.gnu.org/licenses/lgpl-2.1.txt GNU Lesser General Public License
*/
Core::loadClass('Core.Kernel.InfoException');
/**
* Exception for Core class.
*
* @package Core
* @subpackage Kernel
* @author Matthias Mohr
* @copyright Copyright (c) 2004-2010, Viscacha.org
* @since 1.0
*/
class CoreException extends InfoException {
private $data;
/**
示例5: __construct
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* For any suggestions or bug report please contact me: guinux@cosmoplazza.com
*
* @package Core
* @subpackage Net
* @author GuinuX <guinux@cosmoplazza.com>
* @author Matthias Mohr
* @copyright Copyright (C) 2002 - 2003 by GuinuX
* @version 1.1 (Released: 06-20-2002, Last Modified: 06-10-2003)
* @license http://www.gnu.org/licenses/lgpl-2.1.txt GNU Lesser General Public License
*/
Core::loadClass('Core.Net.HTTP.HTTPClientHeader');
/**
* A HTTP client class - HTTPClientResponseHeader
*
* @package Core
* @subpackage Net
* @author GuinuX <guinux@cosmoplazza.com>
* @author Matthias Mohr
* @since 1.0
*/
class HTTPClientResponseHeader extends HTTPClientHeader {
protected $cookiesHeaders;
public function __construct() {
示例6: __construct
<?php
Core::loadClass('Core.Cache.CacheItem');
/**
* The CacheServer manages the CacheItems.
*
* @package Core
* @subpackage Cache
* @author Matthias Mohr
* @since 1.0
*/
class CacheServer
{
private $cachedir;
private $sourcedir;
private $data;
/**
* Constructs a new Cache Manager. In this class all loaded CacheItems will be cached.
*
* @param string Path to the cache data folder
* @param string Path to the cache source folder {@see CacheServer::setSourceDir()}
**/
public function __construct($cachedir = 'data/cache/', $sourcedir = 'Core.Cache.Items')
{
$this->cachedir = $cachedir;
$this->data = array();
$this->setSourceDir($sourcedir);
}
/**
* Sets the default source diretory for cache files.
*
示例7: loadFile
/**
* Loads the class with the given class name from the index.
*
* @param string Class Name
* @param boolean Try to rebuild on failure
* @throws ClassManagerException
*/
public function loadFile($className, $rebuildOnError = true) {
if (array_key_exists($className, $this->index) == true) {
$filename = $this->index[$className];
if(file_exists($filename) == true) {
include_once($filename);
}
else {
// Class name is indexed, but no source file available
$error = array(
"ClassManager index seems to be outdated. ".
"File for class '{$className}' not found: ".$filename,
1
);
}
}
else {
// No class with this name indexed
$error = array("ClassManager has no class with name {$className} indexed.", 2);
}
if ($rebuildOnError == true) {
// Force a rebuild as the index seems to be invalid
$this->deleteCache();
$this->loadIndex();
$this->loadFile($className, false);
}
else {
// Rebuild failed, throw exception
Core::loadClass('Core.Kernel.ClassManagerException');
$e = new ClassManagerException($error[0], $error[1]);
$e->setIndex($this->index);
throw $e;
}
}
示例8: __construct
<?php
Core::loadClass('Cms.CmsModuleObject');
/**
* This is a general Admin module object. All admin modules should extend it.
*
* @package Cms
* @author Matthias Mohr
* @since 1.0
* @abstract
*/
abstract class AdminModuleObject extends CmsModuleObject
{
const MENU_FILE = './data/admincp.php';
protected $menu;
public function __construct($package = 'Cms')
{
parent::__construct($package);
$this->scriptFiles[URI::build('client/scripts/jquery/jquery.admin.js')] = 'text/javascript';
$this->scriptFiles[URI::build('client/scripts/admin.js')] = 'text/javascript';
$this->cssFiles[URI::build('client/styles/admin.css')] = 'all';
$this->loadMenu();
$this->breadcrumb->add('Administrationsbereich', URI::build('cms/admin'));
}
protected function header()
{
parent::header();
$tpl = Response::getObject()->appendTemplate("/Cms/admin/header");
$tpl->assign('menu', $this->menu, false);
$tpl->output();
}
示例9: __construct
<?php
Core::loadClass("Cms.Auth.GuestUser");
/**
* This is a registered user.
*
* @package Cms
* @subpackage Auth
* @author Matthias Mohr
* @since 1.0
*/
class User
{
protected $data;
protected $acl;
public function __construct(array $data)
{
$fields = UserUtils::getTableFields();
foreach ($fields as $f => $default) {
if (!isset($data[$f])) {
Core::throwError("User data is incomplete. Field {$f} is missing.");
$data[$f] = $default;
}
}
// Special case: Birthday -> Parse it into chunks
if (strpos($data['birth'], '-') === false) {
$data['birth'] = '0000-00-00';
}
$bday = explode('-', $data['birth']);
$data['birthday'] = intval($bday[2]);
$data['birthmonth'] = intval($bday[1]);
示例10: getObject
<?php
Core::loadClass("Cms.Auth.Authentication");
/**
* Session handling and more.
*
* @package Cms
* @subpackage Auth
* @author Matthias Mohr
* @since 1.0
*/
class Session
{
private $sid;
private $ip;
private $auth;
private $settings;
private $me;
// Singleton
private static $instance = NULL;
public static function getObject()
{
if (self::$instance === NULL) {
self::$instance = new self();
}
return self::$instance;
}
private function __clone()
{
}
private function __construct()
示例11: is_id
$file = $classManager->loadFile($className);
if ($file == null) {
Core::throwError('Class "{$className}" not found', INTERNAL_ERROR);
}
}
// Load class Config
Core::loadClass('Core.Util.Config');
// Load class validator (for SystemEnvironment)
Core::loadClass('Core.Security.Validator');
// Load class SystemEnvironment
Core::loadClass('Core.System.SystemEnvironment');
// Load classes for Files and Folders (often used)
Core::loadClass('Core.FileSystem.File');
Core::loadClass('Core.FileSystem.Folder');
// Load ModuleObject class (each module needs it)
Core::loadClass('Core.ModuleObject');
/**
* Checks whether the specified number is a natural number (or an id).
*
* An natural number is an integer greater than 0. (1,2,3,4,5,...,100,...)
*
* @param int Number to check
* @return boolean true if the parameter is an id, false if not.
**/
function is_id($x)
{
return is_numeric($x) == true && $x > 0 ? intval($x) == $x : false;
}
/**
* Chacks a comparison and returns the first parameter for true, the second parameter for false.
*
示例12:
<?php
Core::loadClass('Core.System.SystemEnvironment');
/**
* Some static utilities for the file system.
*
* @package Core
* @subpackage FileSystem
* @author Matthias Mohr
* @since 1.0
*/
class FileSystem
{
/**
* Returns canonicalized absolute pathname to a file or directory.
*
* This works with non-existant paths. For directories there won't be a trailing slash.
*
* LICENSE:
* This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @author Michael Wallner <mike@php.net>
* @copyright 2004-2005 Michael Wallner
* @license PHP License 3.0 http://www.php.net/license/3_0.txt
* @link http://pear.php.net/package/File
* @param string Path to canonicalize to absolute path
* @param string Directory Seperator (default: Value from DIRECTORY_SEPERATOR)
示例13: setCookie
<?php
Core::loadClass('Core.Security.Hash');
Core::loadClass('Cms.Auth.User');
/**
* Authentication (login / logout)
*
* @package Cms
* @subpackage Auth
* @author Matthias Mohr
* @since 1.0
*/
class Authentication
{
protected function setCookie($email = '', $pw = '')
{
if (empty($email) || empty($pw)) {
Response::getObject()->sendCookie('udata', "", 0, true);
} else {
// Cookie-Laufzeit: 365 Tage
Response::getObject()->sendCookie('udata', "{$email}|{$pw}", 60 * 60 * 24 * 365, true);
}
}
private function loginAsGuest()
{
return new GuestUser();
}
public function loginWithCookies()
{
// Try to login with user data from cookie
$udata = Request::getObject()->getCookie('udata');
示例14: normalizeHost
<?php
Core::loadClass('Core.Net.IDNA');
/**
* Class to validate several types of data.
*
* @package Core
* @subpackage Net
* @author Matthias Mohr
* @since 1.0
*/
class NetTools
{
public static function normalizeHost($host)
{
$idna = new IDNA();
$host = SystemEnvironment::toUtf8($host);
$host = $idna->encode($host);
return $host;
}
public static function fsockopen($host, $port, $timeout)
{
$host = self::normalizeHost($host);
$fp = @fsockopen($host, $port, $errno, $errstr, $timeout);
return array($fp, $errno, $errstr, $host);
}
public static function checkMX($host)
{
if (empty($host)) {
return false;
}
示例15: getTypeName
<?php
/**
* Simple text implementation for custom fields.
*
* @package Cms
* @subpackage DataFields
* @author Matthias Mohr
* @since 1.0
*/
Core::loadClass('Core.Security.ReCaptcha');
class CustomCaptcha extends CustomField
{
public function getTypeName()
{
return 'Captcha';
}
public function getClassPath()
{
return 'Cms.DataFields.Types.CustomCaptcha';
}
public function getDbDataType()
{
return null;
}
public function getInputCode($data = null)
{
return recaptcha_get_html(Config::get('captcha.public_key'));
}
public function getOutputCode($data = null)
{