本文整理汇总了PHP中Core::Load方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::Load方法的具体用法?PHP Core::Load怎么用?PHP Core::Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetAdapter
/**
* Set current Adapter
*
* @param string $adapterName
* @param string $append
* @static
* @return bool
*/
static public function SetAdapter($adapterName, $append = false)
{
if (!class_exists("{$adapterName}ScriptingAdapter"))
Core::Load("NET/ScriptingClient/Adapters/{$adapterName}ScriptingAdapter");
$reflect = new ReflectionClass("{$adapterName}ScriptingAdapter");
if ($reflect && $reflect->isInstantiable())
{
if ($append)
$args[] = $append;
if (count($args) > 0)
self::$Adapter = $reflect->newInstanceArgs($args);
else
self::$Adapter = $reflect->newInstance(true);
}
else
Core::RaiseError(_("Object '{$type}ScriptingAdapter' not instantiable."));
if (self::$Adapter)
return true;
else
return false;
}
示例2: __construct
function __construct($process_classes_folder)
{
$processes = @glob("{$process_classes_folder}/class.*Process.php");
$jobs = array();
if (count($processes) > 0)
{
foreach ($processes as $process)
{
$filename = basename($process);
$directory = dirname($process);
Core::Load($filename, $directory);
preg_match("/class.(.*)Process.php/s", $filename, $tmp);
$process_name = $tmp[1];
if (class_exists("{$process_name}Process"))
{
$reflect = new ReflectionClass("{$process_name}Process");
if ($reflect)
{
if ($reflect->implementsInterface("IProcess"))
{
$job = array(
"name" => $process_name,
"description" => $reflect->getProperty("ProcessDescription")->getValue($reflect->newInstance())
);
array_push($jobs, $job);
}
else
Core::RaiseError("Class '{$process_name}Process' doesn't implement 'IProcess' interface.", E_ERROR);
}
else
Core::RaiseError("Cannot use ReflectionAPI for class '{$process_name}Process'", E_ERROR);
}
else
Core::RaiseError("'{$process}' does not contain definition for '{$process_name}Process'", E_ERROR);
}
}
else
Core::RaiseError(_("No job classes found in {$ProcessClassesFolder}"), E_ERROR);
$options = array();
foreach($jobs as $job)
$options[$job["name"]] = $job["description"];
$options["help"] = "Print this help";
$Getopt = new Getopt($options);
$opts = $Getopt->getOptions();
if (in_array("help", $opts) || count($opts) == 0 || !$options[$opts[0]])
{
print $Getopt->getUsageMessage();
exit();
}
else
{
$this->ProcessName = $opts[0];
}
}
示例3: testIO_Logging_Log
function testIO_Logging_Log()
{
Core::Load("IO/Logging/Log");
// message to log
$message = "Some Message";
$level = 1;
$file = "/tmp/logger.txt";
$tablename = "temp";
// register logger for screen log
Log::RegisterLogger("Console", "ScreenLog");
// register logger for file log
Log::RegisterLogger("File", "FileLog", $file);
// register logger for db log
Log::RegisterLogger("DB", "DBLog", $tablename);
// register Null log
Log::RegisterLogger("Null", "NullLog");
// register Email log
Log::RegisterLogger("EMail", "EmailLog", "sergey@local.webta.net");
//
// Logging to screen
//
ob_start();
Log::Log($message, $level, "ScreenLog");
Log::Log($message, $level, "ScreenLog");
$content = ob_get_contents();
ob_end_clean();
$this->asserttrue(stristr($content, "Some Message "), "Log To console returned true.");
//
// Loggin to File
//
@unlink($file);
Log::Log($message, $level, "FileLog");
$content = @file_get_contents($file);
$this->assertEqual($content, "{$message}, {$level}\n", "Log To File returned true.");
//
// Logging to DB
//
/*
$db = Core::GetDBInstance();
$db->Execute("CREATE TABLE IF NOT EXISTS `$tablename` (`message` TEXT NOT NULL DEFAULT '', `level` INT(3) NOT NULL DEFAULT 0);");
Log::Log($message, $level, "DBLog");
$content = $db->GetOne("SELECT `message` FROM `$tablename` WHERE `level` = ?", array($level));
$db->Execute("DROP TABLE `$tablename`");
$this->assertEqual($content, $message, "Log To DB returned true. Content '$content'");
*/
//
// Logging to null
//
ob_start();
Log::Log($message, $level, "NullLog");
$content = ob_get_contents();
ob_end_clean();
$this->assertEqual($content, "", "Log To Null Dev returned true.");
//
// Logging to Email
//
//$result = Log::Log($message, $level, "EmailLog");
//$this->assertTrue($result, "Logging To Email returned true");
}
示例4: __construct
function __construct()
{
$this->UnitTestCase('PE test');
Core::Load("PE/ManagedProcess");
Core::Load("PE/PipedChain");
}
示例5: GetShellInstance
/**
* Return shell insrtance
*
* @static
* @return object
*/
public static function GetShellInstance()
{
// Yeah, no much stuff here now
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
Core::Load("System/Windows/Shell/Shell");
return new WinShell();
} else {
Core::Load("System/Unix/Shell/Shell");
return new Shell();
}
}
示例6: __construct
function __construct()
{
$this->ImageDir = dirname(__FILE__) . "/tests";
$this->UnitTestCase('ImageMagick Core test');
// Go hellaz
Core::Load("Graphics/ImageMagick/ImageMagickLite");
Core::Load("Graphics/ImageMagick/PhotoFilter");
$this->ImageMagickLite = new ImageMagickLite();
}
示例7: GetAvaiableTransports
/**
* Return all avaiable transports
*
* @static
* @return array
*/
public static function GetAvaiableTransports()
{
$retval = array();
$transports = glob(dirname(__FILE__) . "/Transports/class.*Transport.php");
foreach ((array) $transports as $transport) {
$pi = pathinfo($transport);
Core::Load($pi["basename"], $pi["dirname"]);
preg_match("/class\\.([A-Za-z0-9_]+)\\.php/si", $pi["basename"], $matches);
if (class_exists($matches[1]) && self::IsTransport($matches[1])) {
$retval[] = substr($matches[1], 0, -9);
}
}
return $retval;
}
示例8: testCore_Test_Core
function testCore_Test_Core()
{
//
// Core load() function
//
// Load single class
Core::Load("Core");
$this->assertTrue(class_exists("Core"), "Core class is loaded");
// Load single class
Core::Load("NET/API/WHM");
$this->assertTrue(class_exists("WHM") && class_exists("CPanel"), "WHM and CPanel classes loaded");
$memory_start = @memory_get_usage();
//Check GetInstance
$class = Core::GetInstance("WHM", array("hostname" => "test", "login" => "login"));
$this->assertTrue($class instanceof WHM && $class->Host == "test", "WHM instance created");
for ($i = 0; $i < 5000; $i++) {
$class = Core::GetInstance("WHM", array("hostname" => "test", "login" => "login"));
}
$memory_end = @memory_get_usage();
$change = abs(round(($memory_start - $memory_end) / $memory_start * 100, 2));
$this->assertTrue($change < 50, "No memory leaks detected. Memory before test {$memory_start}, after test {$memory_end}");
}
示例9: GetValidatorInstance
/**
* Get Validator instance
* @return Validator
* @static
*/
public static function GetValidatorInstance()
{
if (!class_exists("Validator")) {
Core::Load("Data/Validation");
}
if (!self::$Validator) {
self::$Validator = new Validator();
}
return self::$Validator;
}
示例10: testDNSZone2
function testDNSZone2()
{
Core::Load("NET/DNS/class.DNSZone2.php");
Core::Load("NET/DNS/class.DNSRecord.php");
$dnszone = new DNSZone();
/////
// Test SOA DNS Record
//
Core::Load("NET/DNS/class.SOADNSRecord.php");
// Valid SOA
$SOA = new SOADNSRecord("test.com","ns.hostdad.com", "test@test.com");
$this->assertWantedPattern("/@\s+IN\s+SOA[\s\t]+/msi", $SOA->__toString(), "Generated SOA Record");
$dnszone->AddRecord($SOA);
// Invalid SOA
$soa = new SOADNSRecord("test", "ns.hostdad.com", "test@test.com");
$this->assertFalse($soa->__toString(), "SOA Record NOT generated with invalid params");
/////
// Test A DNS Record
//
Core::Load("NET/DNS/class.ADNSRecord.php");
// subdomain record
$a1 = new ADNSRecord("test", "192.168.1.1");
$this->assertWantedPattern("/[A-Za-z0-9]+\s+IN\s+A[\s\t]+/msi", $a1->__toString(), "Generated A Record");
$dnszone->AddRecord($a1);
//domain record
$a2 = new ADNSRecord("test.com", "192.168.1.2");
$this->assertWantedPattern("/[A-Za-z0-9\.]+\s+IN\s+A[\s\t]+/msi", $a2->__toString(), "Generated A Record");
$dnszone->AddRecord($a2);
//dottify domain record
$a3 = new ADNSRecord("test.com.", "192.168.1.3");
$this->assertWantedPattern("/[A-Za-z0-9\.]+\s+IN\s+A[\s\t]+/msi", $a3->__toString(), "Generated A Record");
$dnszone->AddRecord($a3);
//@ domain record
$a4 = new ADNSRecord("@", "192.168.1.100");
$this->assertWantedPattern("/@\s+[0-9]*\sIN\s+A[\s\t]+/msi", $a4->__toString(), "Generated A Record");
$dnszone->AddRecord($a4);
//invalid record
$record = new ADNSRecord("-1test.com", "192.168.1");
$this->assertFalse($record->__toString(), "A Record NOT generated with invalid params");
//////
// Test MX DNS Record
//
Core::Load("NET/DNS/class.MXDNSRecord.php");
//domain record
$record = new MXDNSRecord("mail", "test.com");
$this->assertWantedPattern("/[A-Za-z0-9\.]+\s+IN\s+MX[\s\t]+/msi", $record->__toString(), "Generated MX Record");
$dnszone->AddRecord($record);
//dottify domain record
$record = new MXDNSRecord("test.com.", "mailtest.com");
$this->assertWantedPattern("/[A-Za-z0-9\.]+\s+IN\s+MX[\s\t]+/msi", $record->__toString(), "Generated MX Record");
$dnszone->AddRecord($record);
//@ domain record
$record = new MXDNSRecord("@", "mail2.test.com");
$this->assertWantedPattern("/@\s+[0-9]*\sIN\s+MX[\s\t]+/msi", $record->__toString(), "Generated MX Record");
$dnszone->AddRecord($record);
//invalid record
$record = new MXDNSRecord("-1test.com", "test2");
$this->assertFalse($record->__toString(), "MX Record NOT generated with invalid params");
///////
// Test NS DNS Record
//
Core::Load("NET/DNS/class.NSDNSRecord.php");
// subdomain record
//domain record
$record = new NSDNSRecord("test.com", "ns1.test.com");
$this->assertWantedPattern("/[A-Za-z0-9\.]+\s+IN\s+NS[\s\t]+/msi", $record->__toString(), "Generated NS Record");
$dnszone->AddRecord($record);
//dottify domain record
$record = new NSDNSRecord("test.com.", "ns2.test.com");
$this->assertWantedPattern("/[A-Za-z0-9\.]+\s+IN\s+NS[\s\t]+/msi", $record->__toString(), "Generated NS Record");
$dnszone->AddRecord($record);
//sub domain record
$record = new NSDNSRecord("name.com", "ns1");
$this->assertWantedPattern("/[A-Za-z0-9\.]+\s+[0-9]*\sIN\s+NS[\s\t]+/msi", $record->__toString(), "Generated NS Record");
$dnszone->AddRecord($record);
//invalid record
$record = new NSDNSRecord("-1test.com", "asdasda");
$this->assertFalse($record->__toString(), "NS Record NOT generated with invalid params");
//.........这里部分代码省略.........
示例11:
* Any other uses are strictly prohibited without the written permission
* of "Webta" and all other rights are reserved.
* This notice may not be removed from this source code file.
* This source file is subject to version 1.1 of the license,
* that is bundled with this package in the file LICENSE.
* If the backage does not contain LICENSE file, this source file is
* subject to general license, available at http://webta.net/license.html
*
* @category LibWebta
* @package NET_API
* @subpackage Google
* @copyright Copyright (c) 2003-2009 Webta Inc, http://webta.net/copyright.html
* @license http://webta.net/license.html
*/
Core::Load("NET/API/Google/class.GoogleService.php");
/**
* @name GoogleCalendar
* @category LibWebta
* @package NET_API
* @subpackage Google
* @version 1.0
* @author Igor Savchenko <http://webta.net/company.html>
*/
class GoogleCalendar extends GoogleService
{
/**
* Constuct
*
示例12:
* of "Webta" and all other rights are reserved.
* This notice may not be removed from this source code file.
* This source file is subject to version 1.1 of the license,
* that is bundled with this package in the file LICENSE.
* If the backage does not contain LICENSE file, this source file is
* subject to general license, available at http://webta.net/license.html
*
* @category LibWebta
* @package NET
* @subpackage Mail
* @copyright Copyright (c) 2003-2009 Webta Inc, http://webta.net/copyright.html
* @license http://webta.net/license.html
*/
Core::Load("NET/Mail/PHPMailer");
Core::Load("Observable");
/**
* @name PHPSmartyMailer
* @category LibWebta
* @package NET
* @subpackage Mail
* @todo Enable in HTTP Client socket connections if curl functions are disabled
* @author Igor Savchenko <http://webta.net/company.html>
*/
class PHPSmartyMailer extends PHPMailer
{
/**
* Sets the Body of the message. This can be either an HTML or text body.
* If HTML then run IsHTML(true).
示例13: toJson
/**
* Return the current set of options and parameters seen in Json format.
*
* @return string
*/
public function toJson()
{
if (!$this->_parsed) {
$this->parse();
}
$j = array();
foreach ($this->_options as $flag => $value) {
$j['options'][] = array('option' => array('flag' => $flag, 'parameter' => $value));
}
Core::Load("Data/JSON/JSON.php");
if (class_exists("Services_JSON")) {
$json = new Services_JSON();
return $json->encode($j);
} else {
return false;
}
}
示例14:
* Any other uses are strictly prohibited without the written permission
* of "Webta" and all other rights are reserved.
* This notice may not be removed from this source code file.
* This source file is subject to version 1.1 of the license,
* that is bundled with this package in the file LICENSE.
* If the backage does not contain LICENSE file, this source file is
* subject to general license, available at http://webta.net/license.html
*
* @category LibWebta
* @package NET
* @subpackage NNTP
* @copyright Copyright (c) 2003-2009 Webta Inc, http://webta.net/copyright.html
* @license http://webta.net/license.html
*/
Core::Load("NET/NNTP/NNTPClient");
/**
* @name NNTPServerStatus
* @category LibWebta
* @package NET
* @subpackage NNTP
* @version 1.0
* @author Igor Savchenko <http://webta.net/company.html>
*/
class NNTPServerStatus extends NNTPClient
{
/**
* Constructor
*
示例15: testSystemStats
* Any other uses are strictly prohibited without the written permission
* of "Webta" and all other rights are reserved.
* This notice may not be removed from this source code file.
* This source file is subject to version 1.1 of the license,
* that is bundled with this package in the file LICENSE.
* If the backage does not contain LICENSE file, this source file is
* subject to general license, available at http://webta.net/license.html
*
* @category LibWebta
* @package System_Unix
* @subpackage Stats
* @copyright Copyright (c) 2003-2009 Webta Inc, http://webta.net/copyright.html
* @license http://webta.net/license.html
* @filesource
*/
Core::Load("/System/Unix/Stats/SystemStats");
/**
* @category LibWebta
* @package System_Unix
* @subpackage Stats
* @name System_Unix_Stats_Test
*
*/
class System_Unix_Stats_Test extends UnitTestCase
{
function System_Unix_Stats_Test()
{
$this->UnitTestCase('System/Unix/Stats Test');
}
function testSystemStats()
{