本文整理汇总了PHP中Sections::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Sections::delete方法的具体用法?PHP Sections::delete怎么用?PHP Sections::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sections
的用法示例。
在下文中一共展示了Sections::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
}
// not found
if (!isset($item['id'])) {
include '../error.php';
// access 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['confirm']) && $_REQUEST['confirm'] == 'yes') {
// touch the related anchor before actual deletion, since the image has to be accessible at that time
if (is_object($anchor)) {
$anchor->touch('section:delete', $item['id']);
}
// attempt to delete
if (Sections::delete($item['id'])) {
// log item deletion
$label = sprintf(i18n::c('Deletion: %s'), strip_tags($item['title']));
$description = Sections::get_permalink($item);
Logger::remember('sections/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'] . $anchor->get_url());
} else {
Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'sections/');
}
}
示例2: delete_for_anchor
/**
* delete all sections for a given anchor
*
* @param string the anchor to check (e.g., 'section:123')
* @return void
*
* @see shared/anchors.php
*/
public static function delete_for_anchor($anchor)
{
global $context;
// seek all records attached to this anchor
$query = "SELECT id FROM " . SQL::table_name('sections') . " AS sections " . " WHERE sections.anchor LIKE '" . SQL::escape($anchor) . "'";
if (!($result = SQL::query($query))) {
return;
}
// empty list
if (!SQL::count($result)) {
return;
}
// delete silently all matching items
while ($row = SQL::fetch($result)) {
Sections::delete($row['id']);
}
}
示例3: sprintf
// 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
} elseif (isset($_REQUEST['selected_sections'])) {
$count = 0;
foreach ($_REQUEST['selected_sections'] as $dummy => $id) {
if (Sections::delete($id)) {
$count++;
}
}
// clear the cache for this section
Sections::clear($item);
// report on results
$context['text'] .= '<p>' . sprintf(i18n::ns('%d section has been deleted.', '%d sections 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');
// nothing to do