本文整理汇总了PHP中PluginRegistry::ForEachBinding方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginRegistry::ForEachBinding方法的具体用法?PHP PluginRegistry::ForEachBinding怎么用?PHP PluginRegistry::ForEachBinding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginRegistry
的用法示例。
在下文中一共展示了PluginRegistry::ForEachBinding方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initBindings
public static function initBindings()
{
$NativeBinding = new NativeBinding();
self::$Bindings = array($NativeBinding);
self::$BindingsByName[$NativeBinding->getName()] = $NativeBinding;
PluginRegistry::ForEachBinding(function ($PluginInstance) {
UserProxy::registerInstance($PluginInstance);
});
}
示例2: header
<?php
header("Content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
echo "<bindings>";
define("LOCALE_SETUP", true);
require_once "../../lib/private/connector.class.php";
require_once "../../lib/private/userproxy.class.php";
PluginRegistry::ForEachBinding(function ($PluginInstance) {
$Binding = $PluginInstance->getName();
$Version = intval($_REQUEST[$Binding . "_ver_major"]) * 10000 + intval($_REQUEST[$Binding . "_ver_minor"]) * 100 + intval($_REQUEST[$Binding . "_ver_patch"]);
$PluginInstance->writeConfig($_REQUEST[$Binding . "_allow"] == "true", $_REQUEST[$Binding . "_database"], $_REQUEST[$Binding . "_prefix"], $_REQUEST[$Binding . "_user"], $_REQUEST[$Binding . "_password"], $_REQUEST[$Binding . "_autologin"] == "true", $_REQUEST[$Binding . "_postto"], $_REQUEST[$Binding . "_postas"], $_REQUEST[$Binding . "_member"], $_REQUEST[$Binding . "_raidlead"], $_REQUEST[$Binding . "_cookie"], $Version);
});
echo "</bindings>";
示例3: msgRaidCreate
function msgRaidCreate($aRequest)
{
if (validRaidlead()) {
global $gGame;
loadGameSettings();
$Connector = Connector::getInstance();
$LocationId = $aRequest['locationId'];
// Create location
if ($LocationId == 0) {
$NewLocationQuery = $Connector->prepare('INSERT INTO `' . RP_TABLE_PREFIX . 'Location`' . '(Game, Name, Image) VALUES (:Game, :Name, :Image)');
$NewLocationQuery->bindValue(':Name', requestToXML($aRequest['locationName'], ENT_COMPAT, 'UTF-8'), PDO::PARAM_STR);
$NewLocationQuery->bindValue(':Image', $aRequest['raidImage'], PDO::PARAM_STR);
$NewLocationQuery->bindValue(':Game', $gGame['GameId'], PDO::PARAM_STR);
if (!$NewLocationQuery->execute()) {
return;
}
// ### return, location could not be created ###
$LocationId = $Connector->lastInsertId();
}
// Create raid
if ($LocationId != 0) {
// First raid time calculation
$StartHour = intval($aRequest['startHour']);
$StartMinute = intval($aRequest['startMinute']);
$StartDay = intval($aRequest['startDay']);
$StartMonth = intval($aRequest['startMonth']);
$StartYear = intval($aRequest['startYear']);
$EndHour = intval($aRequest['endHour']);
$EndMinute = intval($aRequest['endMinute']);
$EndDay = intval($aRequest['endDay']);
$EndMonth = intval($aRequest['endMonth']);
$EndYear = intval($aRequest['endYear']);
// Get users on vacation
$UserSettingsQuery = $Connector->prepare('SELECT UserId, Name, IntValue, TextValue FROM `' . RP_TABLE_PREFIX . 'UserSetting` ' . 'WHERE Name = "VacationStart" OR Name = "VacationEnd" OR Name = "VacationMessage" ORDER BY UserId');
$VactionUsers = array();
$UserSettingsQuery->loop(function ($Settings) use(&$VactionUsers) {
if (!isset($VactionUsers[$Settings['UserId']])) {
$VactionUsers[$Settings['UserId']] = array('Message' => '');
}
switch ($Settings['Name']) {
case 'VacationStart':
$VactionUsers[$Settings['UserId']]['Start'] = $Settings['IntValue'];
break;
case 'VacationEnd':
$VactionUsers[$Settings['UserId']]['End'] = $Settings['IntValue'];
break;
case 'VacationMessage':
$VactionUsers[$Settings['UserId']]['Message'] = $Settings['TextValue'];
break;
default:
break;
}
});
// Prepare posting raids to forum
$PostTargets = array();
PluginRegistry::ForEachBinding(function ($PluginInstance) use(&$PostTargets) {
if ($PluginInstance->isActive() && $PluginInstance->postRequested()) {
array_push($PostTargets, $PluginInstance);
}
});
$LocationData = null;
if (count($PostTargets) > 0) {
loadSiteSettings();
$LocationQuery = $Connector->prepare('SELECT * FROM `' . RP_TABLE_PREFIX . 'Location` WHERE LocationId = :LocationId LIMIT 1');
$LocationQuery->bindValue(':LocationId', $LocationId, PDO::PARAM_INT);
$LocationData = $LocationQuery->fetchFirst();
}
// Get opt-out list or auto attend users
$AutoAttendUsers = array();
if (strtolower($aRequest['mode'] == 'optout')) {
$UserQuery = $Connector->prepare('SELECT UserId, CharacterId, Class, Role1 FROM `' . RP_TABLE_PREFIX . 'User` ' . 'LEFT JOIN `' . RP_TABLE_PREFIX . 'Character` USING(UserId) ' . 'WHERE Mainchar="true" AND Game=:Game');
$UserQuery->bindValue(':Game', $gGame['GameId'], PDO::PARAM_STR);
$UserQuery->loop(function ($aUser) use(&$AutoAttendUsers) {
array_push($AutoAttendUsers, $aUser);
});
} else {
$UserQuery = $Connector->prepare('SELECT UserId, CharacterId, Class, Role1 FROM `' . RP_TABLE_PREFIX . 'UserSetting` ' . 'LEFT JOIN `' . RP_TABLE_PREFIX . 'Character` USING(UserId) ' . 'WHERE `' . RP_TABLE_PREFIX . 'UserSetting`.Name="AutoAttend" AND Mainchar="true" AND Game=:Game');
$UserQuery->bindValue(':Game', $gGame['GameId'], PDO::PARAM_STR);
$UserQuery->loop(function ($aUser) use(&$AutoAttendUsers) {
array_push($AutoAttendUsers, $aUser);
});
}
// Create raids(s)
$Repeat = max(0, intval($aRequest['repeat'])) + 1;
// repeat at least once
$GroupInfo = $gGame['Groups'][$aRequest['locationSize']];
$SlotRoles = implode(':', array_keys($GroupInfo));
$SlotCount = implode(':', $GroupInfo);
$RaidMode = $aRequest['mode'] == 'optout' ? 'manual' : $aRequest['mode'];
for ($rc = 0; $rc < $Repeat; ++$rc) {
$NewRaidQuery = $Connector->prepare('INSERT INTO `' . RP_TABLE_PREFIX . 'Raid` ' . '(LocationId, Size, Start, End, Mode, Description, SlotRoles, SlotCount ) ' . 'VALUES (:LocationId, :Size, FROM_UNIXTIME(:Start), FROM_UNIXTIME(:End), :Mode, :Description, ' . ':SlotRoles, :SlotCount)');
$StartDateTime = mktime($StartHour, $StartMinute, 0, $StartMonth, $StartDay, $StartYear);
$EndDateTime = mktime($EndHour, $EndMinute, 0, $EndMonth, $EndDay, $EndYear);
// Convert to UTC
$StartDateTime += $aRequest['startOffset'] * 60;
$EndDateTime += $aRequest['endOffset'] * 60;
$NewRaidQuery->bindValue(':LocationId', $LocationId, PDO::PARAM_INT);
$NewRaidQuery->bindValue(':Size', $aRequest['locationSize'], PDO::PARAM_INT);
$NewRaidQuery->bindValue(':Start', $StartDateTime, PDO::PARAM_INT);
$NewRaidQuery->bindValue(':End', $EndDateTime, PDO::PARAM_INT);
//.........这里部分代码省略.........
示例4: use
} else {
if ($_REQUEST["user"] == "") {
$Out->pushError(L($LocalePrefix . "UserEmpty"));
} else {
if ($_REQUEST["password"] == "") {
$Out->pushError(L($LocalePrefix . "PasswordEmpty"));
} else {
PluginRegistry::ForEachBinding(function ($PluginInstance) use($BindingName, $Out) {
if ($PluginInstance->getName() == $BindingName) {
$Config = $PluginInstance->getConfig();
try {
if ($Config->HasGroupConfig) {
$Groups = $PluginInstance->getGroups($_REQUEST["database"], $_REQUEST["prefix"], $_REQUEST["user"], $_REQUEST["password"], true);
$Out->pushValue("groups", $Groups);
}
if ($Config->HasForumConfig) {
$Forums = $PluginInstance->getForums($_REQUEST["database"], $_REQUEST["prefix"], $_REQUEST["user"], $_REQUEST["password"], true);
$Out->pushValue("forums", $Forums);
$Users = $PluginInstance->getUsers($_REQUEST["database"], $_REQUEST["prefix"], $_REQUEST["user"], $_REQUEST["password"], true);
$Out->pushValue("users", $Users);
}
} catch (PDOException $Exception) {
$Out->pushError($Exception->getMessage());
}
return false;
}
});
}
}
}
$Out->flushJSON();
示例5: define
<?php
define("LOCALE_SETUP", true);
require_once dirname(__FILE__) . "/../lib/private/locale.php";
require_once dirname(__FILE__) . "/../lib/config/config.php";
require_once dirname(__FILE__) . "/../lib/private/userproxy.class.php";
// Load bindings
$gBindings = array();
PluginRegistry::ForEachBinding(function ($PluginInstance) use(&$gBindings) {
array_push($gBindings, $PluginInstance);
});
readfile("layout/header.html");
?>
<?php
if (isset($_REQUEST["single"])) {
?>
<script type="text/javascript">
$(document).ready( function() {
$(".button_back").click( function() { open("index.php"); });
$(".button_next").click( function() { CheckBindingForm("index.php"); });
});
</script>
<?php
} else {
?>
<script type="text/javascript">
$(document).ready( function() {
$(".button_back").click( function() { open("install_password.php"); });
$(".button_next").click( function() { CheckBindingForm("install_done.php"); });
});
示例6: header
<?php
header("Content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
define("LOCALE_SETUP", true);
require_once dirname(__FILE__) . "/../../lib/config/config.php";
require_once "../../lib/private/connector.class.php";
require_once "../../lib/private/userproxy.class.php";
$Out = Out::getInstance();
echo "<test>";
PluginRegistry::ForEachBinding(function ($PluginInstance) use($Out) {
$Binding = $PluginInstance->getName();
if ($_REQUEST[$Binding . "_check"] == "true") {
echo "<name>" . $Binding . "</name>";
try {
$PluginInstance->getGroups($_REQUEST[$Binding . "_database"], $_REQUEST[$Binding . "_prefix"], $_REQUEST[$Binding . "_user"], $_REQUEST[$Binding . "_password"], true);
} catch (PDOException $Exception) {
$Out->pushError($Exception->getMessage());
}
$Out->FlushXML("");
}
});
echo "</test>";
示例7: L
echo "<span class=\"check_result\" style=\"color: red\">" . L("NotWriteable") . " (lib/config)</span>";
}
// Main config file check
echo "<br/><span class=\"check_field\">" . L("MainConfigFile") . "</span>";
$ConfigFileState = !file_exists("../lib/config/config.php") && $ConfigFolderState || is_writable("../lib/config/config.php");
if ($ConfigFileState) {
echo "<span class=\"check_result\" style=\"color: green\">" . L("Ok") . "</span>";
} else {
++$TestsFailed;
echo "<span class=\"check_result\" style=\"color: red\">" . L("NotWriteable") . " (lib/config/config.php)</span>";
}
// Plugin config files check
PluginRegistry::ForEachBinding(function ($PluginInstance) use(&$TestsFailed) {
$Binding = $PluginInstance->getName();
if (!$PluginInstance->isConfigWriteable()) {
++$TestsFailed;
echo "<br/><span class=\"check_field\">" . L($Binding . "_ConfigFile") . "</span>";
echo "<span class=\"check_result\" style=\"color: red\">" . L("NotWriteable") . " (lib/config/config." . $Binding . ".php)</span>";
}
});
?>
</div>
<div class="bottom_navigation">
<div class="button_back" style="background-image: url(layout/install_white.png)"><?php
echo L("Back");
?>
</div>
<?php
if ($TestsFailed == 0) {
?>
<div class="button_next" style="background-image: url(layout/config_white.png)"><?php
echo L("Continue");
示例8: define
<?php
define("LOCALE_SETUP", true);
require_once dirname(__FILE__) . "/../../lib/config/config.php";
require_once dirname(__FILE__) . "/../../lib/private/connector.class.php";
require_once dirname(__FILE__) . "/../../lib/private/userproxy.class.php";
require_once dirname(__FILE__) . "/../../lib/private/out.class.php";
$Out = Out::getInstance();
header("Content-type: application/json");
header("Cache-Control: no-cache, max-age=0, s-maxage=0");
// Check fields
$BindingName = $_REQUEST["binding"];
$LocalePrefix = $BindingName . "_";
$Out->pushValue("binding", $BindingName);
PluginRegistry::ForEachBinding(function ($PluginInstance) use($BindingName, $Out) {
if ($PluginInstance->getName() == $BindingName) {
$Value = $PluginInstance->getExternalConfig($_REQUEST["path"]);
if ($Value != null) {
$Out->pushValue("settings", $Value);
}
return false;
}
});
$Out->flushJSON();