本文整理汇总了PHP中Articles::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Articles::delete方法的具体用法?PHP Articles::delete怎么用?PHP Articles::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Articles
的用法示例。
在下文中一共展示了Articles::delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Articles
require_once "models/articles.php";
$article_model = new Articles();
$titles_and_dois = $article_model->get_titles_and_dois($db);
$titles_clean = array();
$dois_clean = array();
if ($titles_and_dois) {
while ($row = $titles_and_dois->fetch_assoc()) {
if ($row['title_count'] * 1 > 1) {
$titles_clean[$row['id']] = $row['title_stripped'];
}
if ($row['doi_count'] * 1 > 1) {
$dois_clean[$row['id']] = $row['doi'];
}
}
}
$unique_titles = array_unique($titles_clean);
$unique_dois = array_unique($dois_clean);
$ids = array();
foreach ($unique_titles as $id => $title) {
array_push($ids, $id);
}
foreach ($unique_dois as $id => $doi) {
array_push($ids, $id);
}
$ids = array_unique($ids);
if (count($ids) > 1) {
echo "Removing " . count($ids) . " duplicates.<br/>";
$article_model->delete($db, $ids);
}
echo "Time elapsed: " . (microtime(true) - $time_start) . "s <br/>";
echo "<a href='/index.php'>Back to index page</a>";
示例2: Articles
<?php
include "Mapper.php";
include "MapperCollection.php";
include "Articles.php";
$map = new Articles("articles");
// Find
echo "Find\n";
$result = $map->find(2);
print_r($result);
// insert
echo "\nInsert\n";
$obj = new stdClass();
$obj->name = "Ny artikel";
$obj->body = "Blah blah yada yada";
$obj->author_id = 2;
$map->insert($obj);
echo "Inserted object:\n";
print_r($obj);
echo "delete\n";
$map->delete($obj);
//update
echo "\nUpdate:\n";
$result->name = "Modified";
$map->update($result);
示例3: actionDelete
/**
* 删除
*/
public function actionDelete($id)
{
$id = (int) $id;
$where = array('aid' => $id);
$Articles = new Articles();
$Articles->delete($where);
$ArticlesContent = new ArticlesContent();
$ArticlesContent->delete($where);
$this->Common->exportResult(true, '成功!');
}
示例4: purge_for_anchor
/**
* limit the number of articles for one anchor
*
* This function deletes oldest pages going beyond the given threshold.
*
* @param int the maximum number of pages to keep in the database
* @return void
*/
public static function purge_for_anchor($anchor, $limit = 1000)
{
global $context;
// lists oldest entries beyond the limit
$query = "SELECT articles.* FROM " . SQL::table_name('articles') . " AS articles " . " WHERE (articles.anchor LIKE '" . SQL::escape($anchor) . "')" . " ORDER BY articles.edit_date DESC LIMIT " . $limit . ', 10';
// no result
if (!($result = SQL::query($query))) {
return;
}
// empty list
if (!SQL::count($result)) {
return;
}
// delete silently all matching items
while ($item = SQL::fetch($result)) {
Articles::delete($item['id']);
}
// end of processing
SQL::free($result);
}
示例5: array
$menu = array();
$menu[] = Skin::build_submit_button(i18n::s('Delete'));
$menu[] = Skin::build_link(Sections::get_url($item['id'], 'manage'), 'Cancel', 'span');
$context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
$context['text'] .= '</form>';
// nothing to do
} else {
Logger::error(i18n::s('No section has been selected.'));
}
// actual deletion
} elseif ($action == 'delete_confirmed') {
// articles
if (isset($_REQUEST['selected_articles'])) {
$count = 0;
foreach ($_REQUEST['selected_articles'] as $dummy => $id) {
if (Articles::delete($id)) {
$count++;
}
}
// clear the cache for this section
Sections::clear($item);
// report on results
$context['text'] .= '<p>' . sprintf(i18n::ns('%d page has been deleted.', '%d pages have been deleted.', $count), $count) . '</p>';
// follow-up commands
$follow_up = i18n::s('What do you want to do now?');
$menu = array();
$menu[] = Skin::build_link(Sections::get_permalink($item), i18n::s('View the section'), 'span');
$menu[] = Skin::build_link(Sections::get_url($item['id'], 'manage'), i18n::s('Manage it'), 'span');
$follow_up .= Skin::finalize_list($menu, 'menu_bar');
$context['text'] .= Skin::build_block($follow_up, 'bottom');
// sections
示例6: elseif
global $render_overlaid;
// not found
if (!isset($item['id'])) {
include '../error.php';
// permission denied
} elseif (!$permitted) {
Safe::header('Status: 401 Unauthorized', TRUE, 401);
Logger::error(i18n::s('You are not allowed to perform this operation.'));
// deletion is confirmed
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
// touch the related anchor before actual deletion, since the image has to be accessible at that time
if (is_object($anchor)) {
$anchor->touch('article:delete', $item['id']);
}
// attempt to delete
if (Articles::delete($item['id'])) {
// log item deletion
$label = sprintf(i18n::c('Deletion: %s'), strip_tags($item['title']));
$description = Articles::get_permalink($item);
Logger::remember('articles/delete.php: ' . $label, $description);
// this can appear anywhere
Cache::clear();
// back to the anchor page or to the index page
if (is_object($overlay) && ($back_url = $overlay->get_url_after_deleting())) {
Safe::redirect($back_url);
} elseif (!is_object($anchor)) {
Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'articles/');
} elseif ($anchor->is_viewable()) {
Safe::redirect($context['url_to_home'] . $context['url_to_root'] . $anchor->get_url());
} elseif ($id = Surfer::get_id()) {
Safe::redirect($context['url_to_home'] . $context['url_to_root'] . Users::get_url($id));