本文整理汇总了PHP中FeedItem::xmlEncode方法的典型用法代码示例。如果您正苦于以下问题:PHP FeedItem::xmlEncode方法的具体用法?PHP FeedItem::xmlEncode怎么用?PHP FeedItem::xmlEncode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FeedItem
的用法示例。
在下文中一共展示了FeedItem::xmlEncode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
//.........这里部分代码省略.........
$wgMemc->set($key, $token, 3600);
}
}
else {
$token = $wgRequest->getVal('token');
if (!$token) {
$wgOut->addHTML(wfMsg('youtubeauthsub_authsubinstructions') .
"
<script type='text/javascript'>
var gYTAS_nokeywords = '" . wfMsg('youtubeauthsub_jserror_nokeywords') . "';
var gYTAS_notitle = '" . wfMsg('youtubeauthsub_jserror_notitle') . "';
</script>
<script type='text/javascript' src='/extensions/YouTubeAuthSub/youtubeauthsub.js'>
</script>
<form action='https://www.google.com/accounts/AuthSubRequest' method='POST' onsubmit='return checkYTASForm();' name='ytas_form'/>
<input type='hidden' name='next' value='{$spTitle()->getFullURL()}'/>
<input type='hidden' name='scope' value='http://gdata.youtube.com/feeds'/>
<input type='hidden' name='session' value='0'/>
<input type='hidden' name='secure' value='0'/>
<input type='submit' value='" . wfMsg('youtubeauthsub_clickhere') . "'/>"
);
return;
}
}
if ($wgRequest->wasPosted()) {
$url = "http://uploads.gdata.youtube.com/feeds/api/users/{$wgYTAS_User}/uploads";
$url = "http://gdata.youtube.com/action/GetUploadToken";
$data = "<?xml version='1.0'?>
<entry xmlns='http://www.w3.org/2005/Atom'
xmlns:media='http://search.yahoo.com/mrss/'
xmlns:yt='http://gdata.youtube.com/schemas/2007'>
<media:group>
<media:title type='plain'>" . FeedItem::xmlEncode($wgRequest->getVal('youtube_title')) . "</media:title>
<media:description type='plain'>" . FeedItem::xmlEncode($wgRequest->getVal('youtube_description')) . "</media:description>
<media:keywords>" . FeedItem::xmlEncode($wgRequest->getVal('youtube_keywords')) . "</media:keywords>
<media:category scheme='http://gdata.youtube.com/schemas/2007/categories.cat'>" .
FeedItem::xmlEncode($wgRequest->getVal('youtube_category')) . "</media:category>
</media:group>
</entry>
";
$headers = array (
"GData-Version: 2",
"X-GData-Client: key={$wgYTAS_ClientId}",
"X-GData-Key: key={$wgYTAS_DeveloperId}",
"Content-Type: application/atom+xml; charset=UTF-8",
"Content-Length: " . strlen($data),
);
if ($wgYTAS_UseClientLogin)
$headers[] = "Authorization: GoogleLogin auth=$token";
else
$headers[] = "Authorization: AuthSub token=$token";
$results = wfSpecialYouTubePost($url, $data, $headers);
$url = preg_replace("@.*<url>(.*)</url>.*@", "$1", $results);
$token = preg_replace("@.*<token>(.*)</token>.*@", "$1", $results);
if ($url == "") {
$wgOut->addHTML("Unable to extract URL, results where <pre>{$results}</pre>");
return;
}
// CAPTURE THE META INFO AND STORE IT
$meta_id = '';
$dbw = wfGetDB(DB_MASTER);
$fields = array (
示例2: ereg_replace
$summary = ereg_replace("\\[\\[.*\\]\\]", "", $summary);
$summary = ereg_replace("\\{\\{.*\\}\\}", "", $summary);
// split up the first setence of the summary into 3 chunks of less than $maxTextLength chars
$t_array = array('', '', '');
$s_index = 0;
//if (strpos($summary, ".") !== false)
// $summary = substr($summary, 0, strpos($summary, "."));
$s_array = split(" ", $summary);
for ($i = 0; $i < sizeof($t_array) && $s_index < sizeof($s_array); $i++) {
while (strlen($t_array[$i] . " " . FeedItem::xmlEncode($s_array[$s_index])) < $maxTextLength && $s_index < sizeof($s_array)) {
$t_array[$i] .= " " . FeedItem::xmlEncode($s_array[$s_index]);
$s_index++;
}
$t_array[$i] = trim($t_array[$i]);
/*
if ($i == sizeof($t_array) - 1 && $s_index < sizeof($s_array) - 1 ) {
if (strlen($t_array[$i]) < $maxTextLength - 3)
$t_array[$i] .= "...";
else
$t_array[$i] = substr($t_array[$i], 0, strlen($t_array[$i]) - 3) . "...";
} else {
}
*/
}
$key = FeedItem::xmlEncode($t->getPrefixedURL());
$query = FeedItem::xmlEncode(strtolower($t->getText()));
$title = FeedItem::xmlEncode(wfMsg('howto', $t->getText()));
echo "\n\t<ResultSpec id='{$key}'>\n\t<Query>{$query}</Query>\n \t<Response>\n \t\t<Output name='title'>{$title}</Output>\n \t\t<Output name='more_url'>{$t->getFullURL()}</Output>\n \t\t<Output name='text1'>{$t_array[0]}</Output>\n \t\t<Output name='text2'>{$t_array[1]}</Output>\n \t\t<Output name='text3'>{$t_array[2]}</Output>\n \t</Response>\n\t</ResultSpec>\t\t\n";
}
$dbr->freeResult($res);
echo "\n</Results>";