本文整理汇总了PHP中SpoonFilter::getPostValue方法的典型用法代码示例。如果您正苦于以下问题:PHP SpoonFilter::getPostValue方法的具体用法?PHP SpoonFilter::getPostValue怎么用?PHP SpoonFilter::getPostValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpoonFilter
的用法示例。
在下文中一共展示了SpoonFilter::getPostValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// call parent
parent::execute();
// get parameters
$id = SpoonFilter::getPostValue('id', null, 0, 'int');
$droppedOn = SpoonFilter::getPostValue('dropped_on', null, -1, 'int');
$typeOfDrop = SpoonFilter::getPostValue('type', null, '');
// validate
if ($id === 0) {
$this->output(self::BAD_REQUEST, null, 'no id provided');
}
if ($droppedOn === -1) {
$this->output(self::BAD_REQUEST, null, 'no id provided');
}
if ($typeOfDrop == '') {
$this->output(self::BAD_REQUEST, null, 'no type provided');
}
// get page
$success = BackendPagesModel::move($id, $droppedOn, $typeOfDrop);
// build cache
BackendPagesModel::buildCache(BL::getWorkingLanguage());
// output
if ($success) {
$this->output(self::OK, BackendPagesModel::get($id), 'page moved');
} else {
$this->output(self::ERROR, null, 'page not moved');
}
}
示例2: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$formId = \SpoonFilter::getPostValue('form_id', null, '', 'int');
$newIdSequence = trim(\SpoonFilter::getPostValue('new_id_sequence', null, '', 'string'));
// invalid form id
if (!BackendFormBuilderModel::exists($formId)) {
$this->output(self::BAD_REQUEST, null, 'form does not exist');
} else {
// list id
$ids = (array) explode('|', rtrim($newIdSequence, '|'));
// loop id's and set new sequence
foreach ($ids as $i => $id) {
$id = (int) $id;
// get field
$field = BackendFormBuilderModel::getField($id);
// from this form and not a submit button
if (!empty($field) && $field['form_id'] == $formId && $field['type'] != 'submit') {
BackendFormBuilderModel::updateField($id, array('sequence' => $i + 1));
}
}
$this->output(self::OK, null, 'sequence updated');
}
}
示例3: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// call parent, this will probably add some general CSS/JS or other required files
parent::execute();
// get parameters
$formId = SpoonFilter::getPostValue('form_id', null, '', 'int');
$newIdSequence = trim(SpoonFilter::getPostValue('new_id_sequence', null, '', 'string'));
// invalid form id
if (!BackendFormBuilderModel::exists($formId)) {
$this->output(self::BAD_REQUEST, null, 'form does not exist');
}
// list id
$ids = (array) explode(',', rtrim($newIdSequence, ','));
// loop id's and set new sequence
foreach ($ids as $i => $id) {
// redefine
$id = (int) $id;
// get field
$field = BackendFormBuilderModel::getField($id);
// from this form and not a submit button
if (!empty($field) && $field['form_id'] == $formId && $field['type'] != 'submit') {
BackendFormBuilderModel::updateField($id, array('sequence' => $i + 1));
}
}
// success output
$this->output(self::OK, null, 'sequence updated');
}
示例4: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$categoryTitle = trim(\SpoonFilter::getPostValue('value', null, '', 'string'));
// validate
if ($categoryTitle === '') {
$this->output(self::BAD_REQUEST, null, BL::err('TitleIsRequired'));
} else {
// get the data
// build array
$item['title'] = \SpoonFilter::htmlspecialchars($categoryTitle);
$item['language'] = BL::getWorkingLanguage();
$meta['keywords'] = $item['title'];
$meta['keywords_overwrite'] = 'N';
$meta['description'] = $item['title'];
$meta['description_overwrite'] = 'N';
$meta['title'] = $item['title'];
$meta['title_overwrite'] = 'N';
$meta['url'] = BackendBlogModel::getURLForCategory(\SpoonFilter::urlise($item['title']));
// update
$item['id'] = BackendBlogModel::insertCategory($item, $meta);
// output
$this->output(self::OK, $item, vsprintf(BL::msg('AddedCategory'), array($item['title'])));
}
}
示例5: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
//--Get the ids as array
$ids = \SpoonFilter::getPostValue('ids', null, '', 'array');
//--Set module
$module = (string) \SpoonFilter::getPostValue('mediaModule', null, '', 'string');
//--Set action
$action = (string) \SpoonFilter::getPostValue('mediaAction', null, '', 'string');
//--Set the id
$id = (int) \SpoonFilter::getPostValue('mediaId', null, '', 'int');
//--Set the type
$type = (string) \SpoonFilter::getPostValue('mediaType', null, '', 'string');
//--Create media object
$media = new BackendMediaHelper(new BackendForm('add_image', null, 'post', false), $module, $id, $action, $type);
//--Check if the ids is not empty
if (!empty($ids)) {
foreach ($ids as $id) {
//--Link mediaitem with id to item
$media->linkMediaToModule($id);
}
}
// success output
$this->output(self::OK, null, 'files added');
}
示例6: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$charset = $this->getContainer()->getParameter('kernel.charset');
$searchTerm = \SpoonFilter::getPostValue('term', null, '');
$term = $charset == 'utf-8' ? \SpoonFilter::htmlspecialchars($searchTerm) : \SpoonFilter::htmlentities($searchTerm);
// validate search term
if ($term == '') {
$this->output(self::BAD_REQUEST, null, 'term-parameter is missing.');
} else {
// previous search result
$previousTerm = \SpoonSession::exists('searchTerm') ? \SpoonSession::get('searchTerm') : '';
\SpoonSession::set('searchTerm', '');
// save this term?
if ($previousTerm != $term) {
// format data
$this->statistics = array();
$this->statistics['term'] = $term;
$this->statistics['language'] = LANGUAGE;
$this->statistics['time'] = FrontendModel::getUTCDate();
$this->statistics['data'] = serialize(array('server' => $_SERVER));
$this->statistics['num_results'] = FrontendSearchModel::getTotal($term);
// save data
FrontendSearchModel::save($this->statistics);
}
// save current search term in cookie
\SpoonSession::set('searchTerm', $term);
// output
$this->output(self::OK);
}
}
示例7: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$mailingId = SpoonFilter::getPostValue('mailing_id', null, '', 'int');
$sendOnDate = SpoonFilter::getPostValue('send_on_date', null, BackendModel::getUTCDate('d/m/Y'));
$sendOnTime = SpoonFilter::getPostValue('send_on_time', null, BackendModel::getUTCDate('H:i'));
$messageDate = $sendOnDate;
// validate mailing ID
if ($mailingId == '') {
$this->output(self::BAD_REQUEST, null, 'Provide a valid mailing ID');
}
if ($sendOnDate == '' || $sendOnTime == '') {
$this->output(self::BAD_REQUEST, null, 'Provide a valid send date date provided');
}
// record is empty
if (!BackendMailmotorModel::existsMailing($mailingId)) {
$this->output(self::BAD_REQUEST, null, BL::err('MailingDoesNotExist', 'mailmotor'));
}
// reverse the date and make it a proper
$explodedDate = explode('/', $sendOnDate);
$sendOnDate = $explodedDate[2] . '-' . $explodedDate[1] . '-' . $explodedDate[0];
// calc full send timestamp
$sendTimestamp = strtotime($sendOnDate . ' ' . $sendOnTime);
// build data
$item['id'] = $mailingId;
$item['send_on'] = BackendModel::getUTCDate('Y-m-d H:i:s', $sendTimestamp);
$item['edited_on'] = BackendModel::getUTCDate('Y-m-d H:i:s');
// update mailing
BackendMailmotorModel::updateMailing($item);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_edit_mailing_step4', array('item' => $item));
// output
$this->output(self::OK, array('mailing_id' => $mailingId, 'timestamp' => $sendTimestamp), sprintf(BL::msg('SendOn', $this->getModule()), $messageDate, $sendOnTime));
}
示例8: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// call parent, this will probably add some general CSS/JS or other required files
parent::execute();
// get parameters
$formId = trim(SpoonFilter::getPostValue('form_id', null, '', 'int'));
$fieldId = trim(SpoonFilter::getPostValue('field_id', null, '', 'int'));
// invalid form id
if (!BackendFormBuilderModel::exists($formId)) {
$this->output(self::BAD_REQUEST, null, 'form does not exist');
}
// invalid fieldId
if (!BackendFormBuilderModel::existsField($fieldId, $formId)) {
$this->output(self::BAD_REQUEST, null, 'field does not exist');
}
// get field
$field = BackendFormBuilderModel::getField($fieldId);
// submit button cannot be deleted
if ($field['type'] == 'submit') {
$this->output(self::BAD_REQUEST, null, 'submit button cannot be deleted');
} else {
// delete field
BackendFormBuilderModel::deleteField($fieldId);
// success output
$this->output(self::OK, null, 'field deleted');
}
}
示例9: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$term = SpoonFilter::getPostValue('term', null, '');
// validate
if ($term == '') {
$this->output(self::BAD_REQUEST, null, 'term-parameter is missing.');
}
// previous search result
$previousTerm = SpoonSession::exists('searchTerm') ? SpoonSession::get('searchTerm') : '';
SpoonSession::set('searchTerm', '');
// save this term?
if ($previousTerm != $term) {
// format data
$this->statistics = array();
$this->statistics['term'] = $term;
$this->statistics['language'] = FRONTEND_LANGUAGE;
$this->statistics['time'] = FrontendModel::getUTCDate();
$this->statistics['data'] = serialize(array('server' => $_SERVER));
$this->statistics['num_results'] = FrontendSearchModel::getTotal($term);
// save data
FrontendSearchModel::save($this->statistics);
}
// save current search term in cookie
SpoonSession::set('searchTerm', $term);
// output
$this->output(self::OK);
}
示例10: execute
/**
* Execute the action
*/
public function execute()
{
// call parent, this will probably add some general CSS/JS or other required files
parent::execute();
// get parameters
$charset = $this->getContainer()->getParameter('kernel.charset');
$searchTerm = \SpoonFilter::getPostValue('term', null, '');
$term = $charset == 'utf-8' ? \SpoonFilter::htmlspecialchars($searchTerm) : \SpoonFilter::htmlentities($searchTerm);
$limit = (int) $this->get('fork.settings')->get('Search', 'autocomplete_num_items', 10);
// validate
if ($term == '') {
$this->output(self::BAD_REQUEST, null, 'term-parameter is missing.');
} else {
// get matches
$matches = FrontendSearchModel::getStartsWith($term, FRONTEND_LANGUAGE, $limit);
// get search url
$url = FrontendNavigation::getURLForBlock('Search');
// loop items and set search url
foreach ($matches as &$match) {
$match['url'] = $url . '?form=search&q=' . $match['term'];
}
// output
$this->output(self::OK, $matches);
}
}
示例11: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$id = \SpoonFilter::getPostValue('id', null, 0, 'int');
$tag = trim(\SpoonFilter::getPostValue('value', null, '', 'string'));
// validate id
if ($id === 0) {
$this->output(self::BAD_REQUEST, null, 'no id provided');
} else {
// validate tag name
if ($tag === '') {
$this->output(self::BAD_REQUEST, null, BL::err('NameIsRequired'));
} else {
// check if tag exists
if (BackendTagsModel::existsTag($tag)) {
$this->output(self::BAD_REQUEST, null, BL::err('TagAlreadyExists'));
} else {
$item['id'] = $id;
$item['tag'] = \SpoonFilter::htmlspecialchars($tag);
$item['url'] = BackendTagsModel::getURL(CommonUri::getUrl(\SpoonFilter::htmlspecialcharsDecode($item['tag'])), $id);
BackendTagsModel::update($item);
$this->output(self::OK, $item, vsprintf(BL::msg('Edited'), array($item['tag'])));
}
}
}
}
示例12: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$formId = trim(\SpoonFilter::getPostValue('form_id', null, '', 'int'));
$fieldId = trim(\SpoonFilter::getPostValue('field_id', null, '', 'int'));
// invalid form id
if (!BackendFormBuilderModel::exists($formId)) {
$this->output(self::BAD_REQUEST, null, 'form does not exist');
} else {
// invalid fieldId
if (!BackendFormBuilderModel::existsField($fieldId, $formId)) {
$this->output(self::BAD_REQUEST, null, 'field does not exist');
} else {
// get field
$field = BackendFormBuilderModel::getField($fieldId);
if ($field['type'] == 'radiobutton') {
$values = array();
foreach ($field['settings']['values'] as $value) {
$values[] = $value['label'];
}
$field['settings']['values'] = $values;
}
// success output
$this->output(self::OK, array('field' => $field));
}
}
}
示例13: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// call parent, this will probably add some general CSS/JS or other required files
parent::execute();
// get parameters
$id = SpoonFilter::getPostValue('id', null, 0, 'int');
$tag = trim(SpoonFilter::getPostValue('value', null, '', 'string'));
// validate
if ($id === 0) {
$this->output(self::BAD_REQUEST, null, 'no id provided');
}
if ($tag === '') {
$this->output(self::BAD_REQUEST, null, BL::err('NameIsRequired'));
}
// check if tag exists
if (BackendTagsModel::existsTag($tag)) {
$this->output(self::BAD_REQUEST, null, BL::err('TagAlreadyExists'));
}
// build array
$item['id'] = $id;
$item['tag'] = SpoonFilter::htmlspecialchars($tag);
$item['url'] = BackendTagsModel::getURL($item['tag'], $id);
// update
BackendTagsModel::update($item);
// output
$this->output(self::OK, $item, vsprintf(BL::msg('Edited'), array($item['tag'])));
}
示例14: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// call parent, this will probably add some general CSS/JS or other required files
parent::execute();
// get parameters
$id = SpoonFilter::getPostValue('id', null, '', 'int');
$name = trim(SpoonFilter::getPostValue('value', null, '', 'string'));
// validate
if ($name == '') {
$this->output(self::BAD_REQUEST, null, 'no name provided');
}
// get existing id
$existingId = BackendMailmotorModel::getCampaignId($name);
// existing campaign
if ($existingId !== 0 && $id !== $existingId) {
$this->output(self::ERROR, array('id' => $existingId, 'error' => true), BL::err('CampaignExists', $this->getModule()));
}
// build array
$item = array();
$item['id'] = $id;
$item['name'] = $name;
$item['created_on'] = BackendModel::getUTCDate('Y-m-d H:i:s');
// get page
$rows = BackendMailmotorModel::updateCampaign($item);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'edited_campaign', array('item' => $item));
// output
if ($rows !== 0) {
$this->output(self::OK, array('id' => $id), BL::msg('CampaignEdited', $this->getModule()));
} else {
$this->output(self::ERROR, null, BL::err('CampaignNotEdited', $this->getModule()));
}
}
示例15: execute
/**
* Execute the action
*/
public function execute()
{
// call parent, this will probably add some general CSS/JS or other required files
parent::execute();
// create bogus form
$frm = new BackendForm('meta');
// get parameters
$URL = \SpoonFilter::getPostValue('url', null, '', 'string');
$metaId = \SpoonFilter::getPostValue('meta_id', null, null);
$baseFieldName = \SpoonFilter::getPostValue('baseFieldName', null, '', 'string');
$custom = \SpoonFilter::getPostValue('custom', null, false, 'bool');
$className = \SpoonFilter::getPostValue('className', null, '', 'string');
$methodName = \SpoonFilter::getPostValue('methodName', null, '', 'string');
$parameters = \SpoonFilter::getPostValue('parameters', null, '', 'string');
// cleanup values
$metaId = $metaId ? (int) $metaId : null;
$parameters = @unserialize($parameters);
// meta object
$this->meta = new BackendMeta($frm, $metaId, $baseFieldName, $custom);
// set callback for generating an unique URL
$this->meta->setUrlCallback($className, $methodName, $parameters);
// fetch generated meta url
$URL = urldecode($this->meta->generateURL($URL));
// output
$this->output(self::OK, $URL);
}