本文整理汇总了PHP中Normalizer::setParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP Normalizer::setParameter方法的具体用法?PHP Normalizer::setParameter怎么用?PHP Normalizer::setParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Normalizer
的用法示例。
在下文中一共展示了Normalizer::setParameter方法的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: unset
} else {
unset($_POST['exposePersonal']);
// we don't need the Personal interests in Professional profile
$companyType = isset($_POST['exposeCompany']) ? $_POST['exposeCompany'] : '0';
/* '0'=Current; '1'=Prior; '-1'=No company info */
}
} else {
$profileType = '0';
// default: 0-Personal!
}
//--------------------------------------------------------------------------------------------
$merger = new ProfileMerger(PA::$login_user, NULL);
$sections = array_merge(array('core'), array_keys($merger->userSections));
$normalizer = new Normalizer('pa2hcard');
// setting parameters for the XSLT to include/exclude sections etc
$normalizer->setParameter('', 'paUid', PA::$login_user->user_id);
$normalizer->setParameter('', 'paUrl', PA::$url);
//---- profile and compyny types: added by Zoran Hron -----
$normalizer->setParameter('', 'paType', $profileType);
$normalizer->setParameter('', 'paCompanyType', $companyType);
//---------------------------------------------------------
/* ------------------------ old code ------------------------
$allExposes = array(
'exposeCore', 'exposeAddress',
'exposeSummary', 'exposePersonal',
'exposeEducation', 'exposeCompany', 'exposePriorCompany',
'exposeEducation',
'exposeFlickrFriends', 'exposeFacebookFriends'
);
------------------------------------------------------------ */