本文整理汇总了PHP中Feed::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Feed::add方法的具体用法?PHP Feed::add怎么用?PHP Feed::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feed
的用法示例。
在下文中一共展示了Feed::add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addItem
/**
* Adds an Item to the feed
*
* @param \SimpleXMLElement $element
* @param \Nekland\FeedBundle\Feed $feed
* @return void
*/
protected function addItem(\SimpleXMLElement $element, Feed $feed)
{
$item = new GenericItem();
foreach ($element as $subElement) {
$method = isset(self::$methodMapping[$subElement->getName()]) ? self::$methodMapping[$subElement->getName()] : 'setFeed' . ucfirst($subElement->getName());
if ($subElement->getName() == 'link') {
if (($routes = $item->getFeedRoutes()) == null) {
$routes = array();
}
$i = count($routes);
foreach ($subElement->attributes() as $attrName => $attrValue) {
if ($attrName == 'href') {
$routes[$i]['url'] = $attrValue;
} else {
$routes[$i][$attrName] = $attrValue;
}
}
$item->setFeedRoutes($routes);
} else {
if (count($subElement) === 0) {
if ($subElement->getName() == 'content' || $subElement->getName() == 'title' || $subElement->getName() == 'summary') {
$typemethod = 'setAtom' . $subElement->getName() . 'Type';
$attributes = $subElement->attributes();
if (isset($attributes['type'])) {
$item->{$typemethod}($attributes['type']);
}
if (isset($attributes['xml:lang']) && $subElement->getName() == 'content') {
$item->setAtomContentLanguage($attributes['xml:lang']);
}
}
$item->{$method}((string) $subElement);
} else {
$item->{$method}($this->extractParam($subElement));
}
}
}
$feed->add($item);
}
示例2: substr
if($addUser == '-1') {
// 회원 추가
$password = substr(md5(mktime()), 0, 10);
$name = _f('임시 비밀번호 : %1', $password);
$email = 'user@fotowall.net';
if(!User::add($username, $password, $name, $email)) {
$add_user_error = $username;
} else {
$addUser = User::getId($username);
}
}
if(!$add_user_error) {
$id = $event->on('Add.addFeed', array($_POST['feedURL'], $visibility, $filter, $filterType, $group, $addUser));
if($id === false || !is_numeric($id) || empty($id)) {
$id = Feed::add($_POST['feedURL'], $visibility, $filter, $filterType, $group, $addUser);
}
addAppMessage(_t('블로그를 추가했습니다.'));
if(Validator::getBool($config->useVerifier) && !isAdmin()) {
$targetURL = "http://{$_SERVER['HTTP_HOST']}{$service['path']}/admin/blog/add?feedId={$id}&feedURL=".$_POST['feedURL'].'&verifyMode=true';
} else {
$targetURL = "http://{$_SERVER['HTTP_HOST']}{$service['path']}/admin/blog/list?id={$id}";
}
header("Location: $targetURL");
exit;
}
}
}
示例3: importer
function importer($path, $node, $line)
{
global $blogid, $migrational, $items, $item;
switch ($path) {
case '/blog/setting':
setProgress($item++ / $items * 100, _t('블로그 설정을 복원하고 있습니다.'));
$setting = new BlogSetting();
if (isset($node['title'][0]['.value'])) {
$setting->title = $node['title'][0]['.value'];
}
if (isset($node['description'][0]['.value'])) {
$setting->description = $node['description'][0]['.value'];
}
if (isset($node['banner'][0]['name'][0]['.value'])) {
$setting->banner = $node['banner'][0]['name'][0]['.value'];
}
if (isset($node['useSloganOnPost'][0]['.value'])) {
$setting->useSloganOnPost = $node['useSloganOnPost'][0]['.value'];
}
if (isset($node['postsOnPage'][0]['.value'])) {
$setting->postsOnPage = $node['postsOnPage'][0]['.value'];
}
if (isset($node['postsOnList'][0]['.value'])) {
$setting->postsOnList = $node['postsOnList'][0]['.value'];
}
if (isset($node['postsOnFeed'][0]['.value'])) {
$setting->postsOnFeed = $node['postsOnFeed'][0]['.value'];
}
if (isset($node['publishWholeOnFeed'][0]['.value'])) {
$setting->publishWholeOnFeed = $node['publishWholeOnFeed'][0]['.value'];
}
if (isset($node['acceptGuestComment'][0]['.value'])) {
$setting->acceptGuestComment = $node['acceptGuestComment'][0]['.value'];
}
if (isset($node['acceptcommentOnGuestComment'][0]['.value'])) {
$setting->acceptcommentOnGuestComment = $node['acceptcommentOnGuestComment'][0]['.value'];
}
if (isset($node['language'][0]['.value'])) {
$setting->language = $node['language'][0]['.value'];
}
if (isset($node['timezone'][0]['.value'])) {
$setting->timezone = $node['timezone'][0]['.value'];
}
if (!$setting->save()) {
user_error(__LINE__ . $setting->error);
}
if (!empty($setting->banner) && !empty($node['banner'][0]['content'][0]['.stream'])) {
Attachment::confirmFolder();
Utils_Base64Stream::decode($node['banner'][0]['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $setting->banner));
Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $setting->banner));
fclose($node['banner'][0]['content'][0]['.stream']);
unset($node['banner'][0]['content'][0]['.stream']);
}
return true;
case '/blog/category':
setProgress($item++ / $items * 100, _t('분류를 복원하고 있습니다.'));
$category = new Category();
$category->name = $node['name'][0]['.value'];
$category->priority = $node['priority'][0]['.value'];
if (isset($node['root'][0]['.value'])) {
$category->id = 0;
}
if (!$category->add()) {
user_error(__LINE__ . $category->error);
}
if (isset($node['category'])) {
for ($i = 0; $i < count($node['category']); $i++) {
$childCategory = new Category();
$childCategory->parent = $category->id;
$cursor =& $node['category'][$i];
$childCategory->name = $cursor['name'][0]['.value'];
$childCategory->priority = $cursor['priority'][0]['.value'];
if (!$childCategory->add()) {
user_error(__LINE__ . $childCategory->error);
}
}
}
return true;
case '/blog/post':
setProgress($item++ / $items * 100, _t('글을 복원하고 있습니다.'));
$post = new Post();
$post->id = $node['id'][0]['.value'];
$post->slogan = @$node['.attributes']['slogan'];
$post->visibility = $node['visibility'][0]['.value'];
if (isset($node['starred'][0]['.value'])) {
$post->starred = $node['starred'][0]['.value'];
} else {
$post->starred = 0;
}
$post->title = $node['title'][0]['.value'];
$post->content = $node['content'][0]['.value'];
$post->contentformatter = isset($node['content'][0]['.attributes']['formatter']) ? $node['content'][0]['.attributes']['formatter'] : 'ttml';
$post->contenteditor = isset($node['content'][0]['.attributes']['editor']) ? $node['content'][0]['.attributes']['editor'] : 'modern';
$post->location = $node['location'][0]['.value'];
$post->password = isset($node['password'][0]['.value']) ? $node['password'][0]['.value'] : null;
$post->acceptcomment = $node['acceptComment'][0]['.value'];
$post->accepttrackback = $node['acceptTrackback'][0]['.value'];
$post->published = $node['published'][0]['.value'];
if (isset($node['longitude'][0]['.value'])) {
$post->longitude = $node['longitude'][0]['.value'];
//.........这里部分代码省略.........
示例4: function
$sitemap->add(URL::to('contact'), '2012-12-16T19:45:53+00:00', '0.6', 'monthly');
$sitemap->add(URL::to('sitemap'), '2012-12-16T19:45:53+00:00', '0.4', 'daily');
$sitemap->add(URL::to('voorwaarden'), '2012-12-16T19:45:53+00:00', '0.3', 'yearly');
// show your sitemap (options: 'xml' (default), 'html', 'txt', 'ror-rss', 'ror-rdf')
return $sitemap->render('xml');
});
Route::get('feed', function () {
$posts = DB::table('users')->order_by('created_at', 'desc')->get();
$feed = new Feed();
$feed->title = 'Your title';
$feed->description = 'Your description';
$feed->link = URL::to('feed');
$feed->pubdate = '12-12-12';
$feed->lang = 'en';
foreach ($posts as $post) {
$feed->add($post->email, $post->email, $post->name, $post->created_at, $post->created_at);
}
return $feed->render('atom');
});
Route::controller(array('admin.room', 'admin.photo', 'admin'));
/* Admin */
Route::filter('pattern: admin/*', 'auth');
Route::get('login', 'admin@login');
Route::post('login', 'admin@login');
/*
|--------------------------------------------------------------------------
| Application 404 & 500 Error Handlers
|--------------------------------------------------------------------------
|
| To centralize and simplify 404 handling, Laravel uses an awesome event
| system to retrieve the response. Feel free to modify this function to
示例5: XMLStruct
$request = new HTTPRequest;
if (!$cont = $request->getPage($_POST['importURL'])) {
echo '<script type="text/javascript">alert("'._t('파일을 가져올 수 없습니다.\n정확한 주소가 맞는지 확인해 주세요.').'");</script>';
exit;
}
$xmls = new XMLStruct();
$xmls->open($cont, true);
if (!$n = $xmls->getNodeCount("/opml/body/outline")) {
echo '<script type="text/javascript">alert("'._t('바른 형식의 OPML 파일이 아닙니다.').'");</script>';
exit;
}
echo '<script type="text/javascript">"'._t('피드를 추가하고 있습니다').'";</script>';
flush();
$_feeder = new Feed;
for ($i=1; $i <= $n; $i++) {
$xmlURL = $xmls->getAttribute("/opml/body/outline[$i]", "xmlUrl");
if (empty($xmlURL)) continue;
$_feeder->add($xmlURL);
}
}
?>
<script type="text/javascript">
parent.document.location.reload();
</script>
</body>
</html>
示例6: create
private function create($fields, $requiredFields, $forbidden)
{
global $con, $available_condition, $available_category;
$fields["citytown"] = "Worcester";
$fields["state"] = "MA";
$fields["stadd2"] = "100 Institute Road";
$pass = true;
$hasforbidden = false;
foreach ($requiredFields as $v) {
if (!array_key_exists($v, $fields)) {
return 401;
} else {
if (trim($fields[$v]) == "") {
return 401;
}
}
}
foreach ($forbidden as $v) {
if (array_key_exists($v, $fields)) {
return 402;
}
}
$userInfo = array();
if (!isset($_SESSION["userid"])) {
return 403;
} else {
$curUser = new User(array("action" => "get", "id" => $_SESSION["userid"]));
$userInfo = $curUser->run(true);
}
if ($userInfo[0]["status"] != "2") {
return 403;
} else {
$itemid = random_key(256);
$fields["adddate"] = time();
$emv = $this->calculateEMV($fields["name"]);
$fields["emv"] = $emv;
$base_array = array("usr" => trim($_SESSION["userid"]), "id" => $itemid);
if (isset($fields) && is_array($fields)) {
$item_fields = array_merge($base_array, $fields);
} else {
$item_fields = $base_array;
}
addRow($con, "item", $item_fields);
$pronoun = "his/her";
switch (intval($userInfo[0]["gender"])) {
case 1:
$pronoun = "his";
break;
case 2:
$pronoun = "her";
break;
}
$feed = new Feed();
$feed->add($_SESSION["userid"], "posted {$pronoun} item: {$item_fields["name"]}", time(), "/view.php?itemid={$itemid}&userid={$_SESSION["userid"]}");
return $itemid;
}
}