本文整理汇总了PHP中Character::IsValid方法的典型用法代码示例。如果您正苦于以下问题:PHP Character::IsValid方法的具体用法?PHP Character::IsValid怎么用?PHP Character::IsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Character
的用法示例。
在下文中一共展示了Character::IsValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_autodetect_failed
// Attempt to apply a specific format.
// Obtain the import script for the format.
$res = $rpgDB->query(sprintf("SELECT imp_file, title FROM %s WHERE id = %d", $TABLE_SERIALIZE, (int) $format));
if (!$res) {
__printFatalErr("Failed to query database.", __LINE__, __FILE__);
}
if ($rpgDB->num_rows() != 1) {
__printFatalErr("Failed to obtain import script location.", __FILE__, __LINE__);
}
$row = $rpgDB->fetch_row($res);
}
// Include the proper script.
include_once "{$INCLUDE_PATH}/serialization/" . $row['imp_file'];
// Call the import routine.
$char = new Character($id);
if (!$char->IsValid()) {
__printFatalErr("Failed to obtain current character data.");
}
if (import_character($contents, $char)) {
if ($char->Save($sid)) {
print_upload_success($sid);
}
}
// By now, we've failed if we got here.
print_upload_failed($sid, $row['title']);
////////////////////////////////////////////////////////////////////////
// Helper functions
// Show that the autodetect has failed.
function print_autodetect_failed($sid, $id)
{
global $title, $formats;
示例2: RespawnSession
include_once "{$INCLUDE_PATH}/engine/character.class.php";
include_once "{$INCLUDE_PATH}/engine/campaign.class.php";
include_once "{$INCLUDE_PATH}/engine/templates.php";
include_once "{$INCLUDE_PATH}/engine/serialization.php";
$sid = RespawnSession(__LINE__, __FILE__);
// Validate permission for the requested character.
$id = (int) $_POST['id'];
if (!$id) {
$id = (int) $_GET['id'];
}
if (!$sid->HasAccessTo($id)) {
__printFatalErr("Access denied.");
}
// Get character details.
$character = new Character($id);
if (!$character->IsValid()) {
__printFatalErr("Failed to retrieve character data.", __LINE__, __FILE__);
}
// Perform any simple actions that are requested.
if (isset($_POST['public'])) {
$public_updated = apply_public($sid, $character, $_POST['public'] == 'true') ? 'Updated!' : 'Update Failed!';
}
if (isset($_POST['inactive'])) {
$inactive_updated = apply_inactive($sid, $character, $_POST['inactive'] == 'true') ? 'Updated!' : 'Update Failed!';
}
if (isset($_POST['add_profile'])) {
$profiles_updated = apply_add_profile($character, $_POST['add_profile']) ? 'Updated!' : 'Update Failed!';
}
if (isset($_POST['tid'])) {
$template_updated = apply_template($sid, $character, (int) $_POST['tid']) ? 'Updated!' : 'Update Failed!';
}