本文整理汇总了PHP中Normalizer::transformToDoc方法的典型用法代码示例。如果您正苦于以下问题:PHP Normalizer::transformToDoc方法的具体用法?PHP Normalizer::transformToDoc怎么用?PHP Normalizer::transformToDoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Normalizer
的用法示例。
在下文中一共展示了Normalizer::transformToDoc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: success_page
function success_page()
{
global $script_url, $login_uid;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>PeopleAggregator SXIP Profile Import</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en-us" />
<link rel="shortcut icon" href="<? echo PA::$theme_url ?>/favicon.ico" type="image/x-icon" />
<link rel="icon" href="<? echo PA::$theme_url ?>/favicon.ico" type="image/x-icon" />
<script src="<? echo PA::$theme_url ?>/javascript/prototype.js" type="text/javascript"></script>
<link rel="stylesheet" href="<? echo PA::$theme_url ?>/style.css" type="text/css" />
<style>
.profilediff {
background-color: black;
}
.profilediff td {
background-color: white;
margin:1px;
}
.profilediff .action {
background-color: black;
color: white;
font-weight: bold;
font-size: 1.1em;
}
.profilediff .section {
background-color: lightgrey;
font-weight: bold;
}
</style>
</head>
<body style="background-color: white;">
<image name="dix:/membersite-logo-url" src="<?php
echo PA::$theme_url;
?>
/images/sxipms-logo.jpg" />
<h1>PeopleAggregator SXIP Profile Import</h1>
<h2>The following data was imported into your User Profile</h2>
<?php
// load empty sxip properties XML
$sxip = DOMDocument::load("api/ProfileIO/xml/sxipProperties.xml");
// stick the POSTed data into our DOM
foreach ($sxip->getElementsByTagName('property') as $prop) {
$label = urlencode($prop->getAttribute('label'));
if ($_POST[$label] && $_POST[$label] != '') {
$prop->setAttribute('value', $_POST[$label]);
}
}
$homesite = $_REQUEST['dix:/homesite'];
// echo "<hr><b>Input DOM:</b>
// <br><pre>".htmlspecialchars($sxip->saveXML())."</pre>";
require_once "api/ProfileIO/ProfileIO.php";
$normalizer = new Normalizer("sxip");
$normalizer->setParameter('', 'nameSection', $homesite);
$paDOM = $normalizer->transformToDoc($sxip);
// echo "<hr><b>PA DOM:</b> <br><pre>".htmlspecialchars($paDOM->saveXML())."</pre>";
require_once "api/User/User.php";
$user = new User();
try {
$user->load((int) $login_uid);
} catch (PAException $e) {
throw new PAException(USER_INVALID, $e->message);
}
$merger = new ProfileMerger($user, $paDOM);
$merger->diff();
// here we might include another step with user interction!!
// actualy SAVE the new profile
print "<hr>saving to " . print_r($homesite, true) . "<hr>";
$merger->saveProfile($homesite);
$diff = $merger->diffProfileSXML;
// echo "<hr><b>PA DOM:</b> <br><pre>".htmlspecialchars($diff->asXML())."</pre>";
function tr($f)
{
?>
<tr>
<td><b><? echo $f['name']; ?></b>
</td>
<td>
<? echo $f['value']; ?>
<? if($f['oldvalue']) echo "<br>was: ".$f['oldvalue']; ?>
</td>
</tr>
<?php
}
?>
<table class=profilediff>
<?php
foreach (array('update', 'create') as $action) {
?>
<tr><td colspan=2 class=action>
<? echo $action ?>-ing these fields:</td>
</tr>
<?php
$sections = array('core') + array_keys($merger->userSections);
foreach ($sections as $section) {
if ($diff->xpath("//field[@action='{$action}'][@section='{$section}']")) {
//.........这里部分代码省略.........
示例2: isset
/*
values currently used in PA
Nobody="0"
Everybody="1"
Immediate Relations="2"
so to show all info a friend would see
we need to allow perms 1 AND 2
while friends only would be 2
*/
$perms = isset($_POST['perms']) ? $_POST['perms'] : "1,2";
$filter = new Normalizer('filterPerms');
foreach (preg_split('/,\\s*/', $perms) as $p) {
$parr[] = "perm" . $p;
}
$filter->setParams($parr, TRUE);
$filteredDOM = $filter->transformToDoc($merger->currentProfileDOM);
$exps = array();
foreach ($_POST as $k => $v) {
if (preg_match('/^expose/', $k)) {
$exps[] = $k;
}
}
if (!count($exps)) {
$exps = $allExposes;
foreach ($exps as $e) {
$_POST[$e] = 1;
}
}
// generate the hCard
displayNone($normalizer, $allExposes);
$normalizer->setParams($exps, TRUE);