当前位置: 首页>>代码示例>>PHP>>正文


PHP Sections::delete方法代码示例

本文整理汇总了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/');
        }
    }
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:delete.php

示例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']);
     }
 }
开发者ID:rair,项目名称:yacs,代码行数:25,代码来源:sections.php

示例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
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:manage.php


注:本文中的Sections::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。