Ejemplo n.º 1
0
 public static function createModuleSite($name)
 {
     $classname = "{$name}ModuleSite";
     if (!class_exists($classname)) {
         $file = WeUtility::rootPath() . "/{$name}/site.php";
         if (!is_file($file)) {
             trigger_error('ModuleSite Definition File Not Found ' . $file, E_USER_WARNING);
             return null;
         }
         require $file;
     }
     if (!class_exists($classname)) {
         trigger_error('ModuleSite Definition Class Not Found', E_USER_WARNING);
         return null;
     }
     $o = new $classname();
     $o->module = $GLOBALS['_W']['account']['modules'][$GLOBALS['_W']['modules'][$name]['mid']];
     $o->weid = $GLOBALS['_W']['weid'];
     $o->inMobile = defined('IN_MOBILE');
     if ($o instanceof WeModuleSite) {
         return $o;
     } else {
         trigger_error('ModuleReceiver Class Definition Error', E_USER_WARNING);
         return null;
     }
 }
Ejemplo n.º 2
0
	public static function createModuleProcessor($name) {
		$classname = "{$name}ModuleProcessor";
		if(!class_exists($classname)) {
			$file = WeUtility::rootPath() . "/{$name}/processor.php";
			if(!is_file($file)) {
				trigger_error('ModuleProcessor Definition File Not Found '.$file, E_USER_ERROR);
				return null;
			}
			require $file;
		}
		if(!class_exists($classname)) {
			trigger_error('ModuleProcessor Definition Class Not Found', E_USER_ERROR);
			return null;
		}
		$o = new $classname();
		if($o instanceof WeModuleProcessor) {
			return $o;
		} else {
			trigger_error('ModuleProcessor Class Definition Error', E_USER_ERROR);
			return null;
		}
	}