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


PHP PHPParser::LoadPHPFile方法代码示例

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


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

示例1: Load

 public static final function Load($path, $name)
 {
     if (class_exists($name)) {
         return true;
     }
     PHPParser::LoadPHPFile($path);
     if (!class_exists($name)) {
         throw new ApplicationException(sprintf(_("%s must contain %s class."), $path, $name), E_ERROR);
     }
     return true;
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:11,代码来源:class.ModuleFactory.php

示例2: DBPaymentObserver

	}
	
	//
	// Attach Global Payment observers
	//
	PaymentModuleFactory::AddModuleObserver(new DBPaymentObserver());
	
	
	//
	// Attach user observers
	//
	$observers = $db->Execute("SELECT * FROM eventhandlers WHERE enabled='1'");
	while ($observer = $observers->FetchRow())
	{
		// eval user class file
		PHPParser::LoadPHPFile(CONFIG::$PATH."/events/class.{$observer['name']}.php");
		// Check for config
		$config_items = $db->GetAll("SELECT COUNT(*) FROM eventhandlers_config WHERE handler_name=?", array($observer['name']));
		if (count($config_items) != 0)
		{
			//Config found
			
			eval("\$Config = {$observer['name']}::GetConfigurationForm();");
			if ($Config instanceof DataForm)
			{
				// Get fields values
				$fields = $Config->ListFields();
				foreach ($fields as &$field)
				{
					$val = $db->GetOne("
						SELECT `value` FROM eventhandlers_config 
开发者ID:rchicoria,项目名称:epp-drs,代码行数:31,代码来源:prepend.inc.php

示例3: array

<?php

require_once 'src/prepend.inc.php';
$display["help"] = "This page lists all custom event handlers. <a href=\"http://epp-drs.com/docs/wiki/event.handlers\">Click here</a> to learn how to add your own event handlers or configure existing ones.";
$supported_interfaces = array("IInvoiceObserver" => "invoice", "IRegistryObserver" => "registry", "IPaymentObserver" => "payment", "IGlobalObserver" => "app");
$rows = array();
// Create directory iterator for events directory
$DirIterator = new DirectoryIterator(CONFIG::$PATH . "/events");
foreach ($DirIterator as $item) {
    if ($item->isFile() && $item->isReadable() && preg_match("/^class.(.*).php\$/si", $item->getFilename(), $matches)) {
        // get class name
        $class_name = $matches[1];
        // eval user file if class not exists
        if (!class_exists($class_name)) {
            // eval file
            PHPParser::LoadPHPFile($item->getPathname());
            // Check for class existence
            if (!class_exists($class_name)) {
                throw new Exception(sprintf(_("%s must contain %s class."), $item->getPathname(), $class_name), E_ERROR);
            }
        }
        // Check class validity
        $ReflectionClass = new ReflectionClass($class_name);
        $interfaces = $ReflectionClass->getInterfaceNames();
        // Check for required interfaces
        $ints = array_intersect(array_keys($supported_interfaces), $interfaces);
        sort($ints);
        if (count($ints) != 1) {
            throw new Exception(sprintf(_("Class %s must implements one of the following interfases: %s"), $class_name, implode(", ", $supported_interfaces)), E_ERROR);
        }
        $enabled = $db->GetOne("SELECT enabled FROM eventhandlers WHERE name=?", array($class_name));
开发者ID:rchicoria,项目名称:epp-drs,代码行数:31,代码来源:custom_event_handlers.php


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