本文整理汇总了PHP中News::addNews方法的典型用法代码示例。如果您正苦于以下问题:PHP News::addNews方法的具体用法?PHP News::addNews怎么用?PHP News::addNews使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类News
的用法示例。
在下文中一共展示了News::addNews方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addAction
/** Add and geocode a news story
* @access public
* @return void
*/
public function addAction()
{
$form = new NewsStoryForm();
$form->submit->setLabel('Add story');
$this->view->form = $form;
if ($this->getRequest()->isPost()) {
if ($form->isValid($this->_request->getPost())) {
$insert = $this->_news->addNews($form->getValues());
$this->_helper->solrUpdater->update('content', $insert, 'news');
$this->getFlash()->addMessage('News story created!');
$this->redirect(self::REDIRECT);
} else {
$form->populate($this->_request->getPost());
}
}
}
示例2: actionAdd
function actionAdd()
{
$this->view->generate('news/add.php', 'template.php');
if (isset($_POST['submit'])) {
// Если форма отправлена
// Получаем данные из формы
$values['title'] = $_POST['title'];
$values['announce'] = $_POST['announce'];
$values['full_news'] = $_POST['full_news'];
// Флаг ошибок в форме
$errors = false;
// Если не заполнена форма
if (!isset($values['title']) & !isset($values['announce']) & !isset($values['full_news'])) {
$errors[] = 'Заполните поля';
echo $errors[0];
}
if ($errors == false) {
// Если ошибок нет
// Добавляем новую новость
$id = News::addNews($values);
}
header("Location: /");
exit;
}
}
示例3: testDeletingCustomNewsCategoryWithPosts
public function testDeletingCustomNewsCategoryWithPosts()
{
$news = News::addNews(StringMocks::SampleTitleOne, StringMocks::LargeContent, $this->player_with_create_perms->getId(), $this->newsCategory->getId());
$this->assertArrayLengthEquals($this->newsCategory->getNews(), 1);
$this->newsCategory->delete();
$this->assertEquals('enabled', $this->newsCategory->getStatus());
$this->assertArrayContainsModel($this->newsCategory, NewsCategory::getCategories());
$this->wipe($news);
}
示例4: world
$conversation->sendMessage($kierra, "I had a page. No addon, plugin to windows it...");
$conversation->sendMessage($allejo, "so I'm the world (which was amazing :)");
$event = new ConversationKickEvent($conversation, $lweak, $alezakos);
ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_KICK);
$event = new ConversationKickEvent($conversation, $brad, $alezakos);
ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_KICK);
$conversation->sendMessage($autoreport, "she also going to essential command and to https://github Releases?\" \"No!\" \"STOP! IT!\" \"*pbbbttt*\" \"That's interesting I want help");
$conversation->sendMessage($autoreport, "I wonder 600KB) screenshot here. but how much I know all I was doing to debug, visual studio");
$conversation->sendMessage($autoreport, "and night night!");
echo " done!";
echo "\nAdding bans...";
Ban::addBan($snake->getId(), $alezakos->getId(), "2014-09-15", "Snarke 12534 has been barned again", "Cuz you're snake", "256.512.104.1");
Ban::addBan($allejo->getId(), $tw1sted->getId(), "2014-05-17", "for using 'dope'", "dope", array("127.0.2.1", "128.0.3.2"));
Ban::addBan($tw1sted->getId(), $alezakos->getId(), "2014-06-12", "tw1sted banned for being too awesome");
Ban::addBan($alezakos->getId(), $tw1sted->getId(), "2014-11-01", "alezakos banned for breaking the build", "For breaking the build", array("256.512.124.1", "256.512.124.3"));
echo " done!";
echo "\nAdding pages...";
Page::addPage("Rules", "<p>This is a test page.</p>\n<p>Let's hope this works!</p>", $tw1sted->getId());
Page::addPage("Contact", "<p>If you find anything wrong, please stop by irc.freenode.net channel #sujevo and let a developer know.<br /><br />Thanks", $tw1sted->getId());
echo " done!";
echo "\nAdding news categories...";
$announcements = NewsCategory::addCategory("Announcements");
$administration = NewsCategory::addCategory("Administration");
$events = NewsCategory::addCategory("Events");
$newFeatures = NewsCategory::addCategory("New Features");
echo " done!";
echo "\nAdding news entries...";
News::addNews("Announcement", "Very important Announcement", $kierra->getId(), $newFeatures->getId());
News::addNews("Cats think we are bigger cats", "In order for your indess recognizes where this whole mistake has come, and why one accuses the pleasure and praise the pain, and I will open to you all and set apart, what those founders of the truth and, as builders of the happy life himself has said about it. No one, he says, despise, or hate, or flee the desire as such, but because great pain to follow, if you do not pursue pleasure rationally. Similarly, the pain was loved as such by no one or pursues or desires, but because occasionally circumstances occur that one means of toil and pain can procure him some great pleasure to look verschaften be. To stay here are a trivial, so none of us would ever undertakes laborious physical exercise, except to obtain some advantage from it. But who is probably the blame, which requires an appetite, has no annoying consequences, or one who avoids a pain, which shows no desire? In contrast, blames and you hate with the law, which can soften and seduced by the allurements of present pleasure, without seeing in his blind desire which pain and inconvenience wait his reason. Same debt meet Those who from weakness, i.e to escape the work and the pain, neglect their duties. A person can easily and quickly make the real difference, to a quiet time where the choice of the decision is completely free and nothing prevents them from doing what we like best, you have to grasp every pleasure and every pain avoided, but to times it hits in succession of duties or guilty of factual necessity that you reject the desire and complaints must not reject. Why then the way will make a selection so that it Achieve a greater rejection by a desire for it or by taking over some pains to spare larger.", $alezakos->getId());
echo " done!";
echo "\n\nThe database has been populated successfully.\n";
示例5: enter
/**
* {@inheritdoc}
*/
public function enter($form)
{
return \News::addNews($form->get('subject')->getData(), $form->get('content')->getData(), $this->me->getId(), $form->get('category')->getData()->getId(), $form->get('status')->getData());
}
示例6: iHaveEnteredANewsArticleNamed
/**
* @Given /^I have entered a news article named "([^"]*)"$/
*/
public function iHaveEnteredANewsArticleNamed($title)
{
News::addNews($title, "bleep", $this->getAdminId());
}
示例7: sanitize
<?php
include "../../../classes/Database.php";
include "../../../classes/Connection.php";
include_once "../../../includes/bootstrap.php";
include "../../../classes/News.php";
include "../../../classes/AdminAction.php";
include "../../../includes/security.funcs.inc";
include_once "../../../includes/Pagination.php";
if (isset($_POST['submit'])) {
$_POST = sanitize($_POST);
$news = $_POST;
settype($news, 'object');
News::addNews($news);
$success = "News Successfully Published!";
$updates = 'Add new news and events content';
AdminAction::addAdminAction($_SESSION['admin_name'], $updates);
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" type="text/css" media="screen" href="<?php
echo $ROOT_URL;
?>
_admin/_assets/css/core3.css" />
<link rel="stylesheet" type="text/css" media="screen" href="<?php
echo $ROOT_URL;
?>
示例8: News
*/
if (isset($_GET['remove_home_page'])) {
$news = new News();
$news->setUserID($_COOKIE['userID']);
$news->setID($_GET['remove_home_page']);
$news->setInHome('0');
$news->updateNews();
header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/myNews.php");
exit;
}
if (isset($_POST['rss_url'])) {
$news = new News();
$news->setUserID($_COOKIE['userID']);
$news->setRSSURL($_POST['rss_url']);
$news->setInHome(false);
$news->addNews();
header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/myNews.php");
exit;
}
if (isset($_POST['remove_news_id'])) {
$news = new News();
$news->setUserID($_COOKIE['userID']);
$news->setID($_POST['remove_news_id']);
$news->removeNews();
header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/myNews.php");
exit;
}
if (isset($_GET['feed'])) {
$news = new News();
$news->setUserID($_COOKIE['userID']);
$news->setID($_GET['feed']);
示例9: viewAjoutActualite
function viewAjoutActualite($db)
{
menu();
echo '
<section id="main-content">
<section class="wrapper">
<div class="row">';
if (!isset($_POST['btEnvoyer'])) {
echo ' <form method="POST">
<div class="col-lg-12">
<section class="panel">
<div class="form-group">
<label class="col-sm-2 col-sm-2 control-label">Titre</label>
<div class="col-sm-10">
<input type="text" id="titreNews" name="titreNews" class="form-control">
</div>
</div>
</div>
<div class="col-lg-12">
<section class="panel">
<div class="form-group">
<label class="col-sm-2 col-sm-2 control-label">Descriptif</label>
<div class="col-sm-10">
<input type="text" id="soustitreNews" name="soustitreNews" class="form-control">
</div>
</div>
</div>
<div class="col-lg-12">
<div class="panel-body">
<div class="form">
<div class="form-group">
<label class="col-sm-2 control-label col-sm-2">Texte</label>
<div class="col-sm-10">
<textarea class="form-control ckeditor" id="contenuNews" name="contenuNews" rows="6"></textarea>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="panel-body">
<input type="submit" id="btEnvoyer" name="btEnvoyer" class="btn btn-danger"></input>
</div>
</div>
</div>
</section>
</div>
</form>
</div>
</section>
</section>
';
} else {
$titreNews = $_POST['titreNews'];
$soustitreNews = $_POST['soustitreNews'];
$contenuNews = $_POST['contenuNews'];
//var_dump($_POST);
$titreNews = htmlentities($titreNews, ENT_QUOTES, "UTF-8");
$soustitreNews = htmlentities($soustitreNews, ENT_QUOTES, "UTF-8");
$contenuNews = htmlentities($contenuNews, ENT_QUOTES, "UTF-8");
$news = new News($db);
$result = $news->addNews($titreNews, $soustitreNews, $contenuNews);
if ($result = !1) {
echo 'Erreur';
} else {
echo '
<div class="col-lg-12">
<button type="button" class="btn btn-success">Ajout effectué avec succès.</button>
<a href="index.php?page=ajouter_actualite"> Ajouter une autre actualité </a>
</div>
';
}
}
}
示例10: json_encode
<?php
require_once "../../helper.php";
require_once "../../classes/News.class.php";
$helper = new Helper();
$newsObj = new News();
$result = $newsObj->addNews($_POST);
echo json_encode($result);