本文整理汇总了PHP中PluginRegistry::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginRegistry::getInstance方法的具体用法?PHP PluginRegistry::getInstance怎么用?PHP PluginRegistry::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginRegistry
的用法示例。
在下文中一共展示了PluginRegistry::getInstance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
/**
* Logs in to the system
*
* @param $username string The username
* @param $password strint The password
* @return string
*/
public function login($username, $password)
{
@session_destroy();
@session_start();
$password = md5($password);
$msg = "";
$pru = PluginRegistry::getInstance();
$login = $pru->getPlugin("Login Plugin");
$result = $login->SOAPLogin($username, $password);
return session_id();
switch ($result) {
case 200:
$msg = "Logged in successfully";
break;
case 402:
$msg = "There was an error while trying to login; your username is blocked";
break;
case 403:
$msg = "Incorrect username/password combination";
break;
case 500:
$msg = "There was an error on the server, please try later";
break;
default:
$msg = "Incorrect username/password combination";
break;
}
return $msg;
}
示例2: hasPlugin
public function hasPlugin($pname)
{
$def = $this->_getPluginsDef();
if (array_key_exists($pname, $def)) {
return true;
}
if (in_array(PluginRegistry::getInstance($pname, 'DB'), $this->_listeners)) {
return true;
}
return false;
}
示例3: _restLogin
/**
* REST service to login into the system
* to use a REST service that needs authentication
*
* @param $params array Array of params
* @return void
*/
private function _restLogin($params)
{
if (count($params) == 4) {
$username = $params[1];
$password = $params[3];
} else {
$this->unauthorized();
}
$password = md5($password);
$pru = PluginRegistry::getInstance();
$login = $pru->getPlugin("Login Plugin");
$result = $login->restLogin($username, $password);
header("Content-type: text/xml");
print '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
if ($result == 200) {
print "<result>Logged in succesfully</result>";
} else {
print "<error>Incorrect user or password combination</error>";
}
}