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


PHP Page::delete方法代码示例

本文整理汇总了PHP中Page::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::delete方法的具体用法?PHP Page::delete怎么用?PHP Page::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Page的用法示例。


在下文中一共展示了Page::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 function delete($id)
 {
     $page = new Page($id);
     $page->delete();
     set_notify('success', lang('delete_data_complete'));
     redirect('pages/admin/pages');
 }
开发者ID:unisexx,项目名称:thaigcd2015,代码行数:7,代码来源:pages.php

示例2: delPage

function delPage()
{
    //Delete
    if ($GLOBALS["action"] == "delete" && $GLOBALS["id"] != null) {
        global $database;
        $delpage = new Page("pages");
        $id = $delpage::$id = "Id=" . $GLOBALS["id"];
        $delpage->delete();
        if ($database->affectedRows()) {
            //delete corresponding image
            $imgdirpath = "../";
            $image_path = $imgdirpath . PAGEIMG_DIR;
            $delimage = new Image("pageimgs");
            $getimage = $delimage::findRow("Pageid='{$GLOBALS["id"]}'");
            if ($database->getNumofRows() > 0) {
                unlink($image_path . $getimage->Imgname . "." . $getimage->Extention);
                //delete image
                unlink($imgdirpath . TEMP_DIR . $getimage->Imgname . "." . $getimage->Extention);
                //delete thumb image
                $delimage::$id = "Id=" . $GLOBALS["id"];
                $delimage->delete();
            }
        }
    }
    header("Location: " . filter_var($_SERVER['PHP_SELF'] . "?action=view&target=managepage"));
}
开发者ID:rasarpmultimedia,项目名称:ezCMSv1.1.2,代码行数:26,代码来源:page.del.php

示例3: delete

 /**
  * Delete the company
  * @return void
  */
 function delete()
 {
     global $DB, $Controller, $USER;
     if ($Controller->alias('companyEditor')->may($USER, DELETE)) {
         $DB->companies->delete(array('id' => $this->ID));
         parent::delete();
     }
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:12,代码来源:Company.php

示例4: delete

 public function delete()
 {
     if ($this->show->itemID) {
         $oPage = new Page();
         $oPage->delete($this->show->itemID);
     }
     redirect(BASE_PATH . 'admin/page');
 }
开发者ID:kizz66,项目名称:meat,代码行数:8,代码来源:Page.php

示例5: delete

 public function delete()
 {
     if ($this->getStackType() == self::ST_TYPE_GLOBAL_AREA) {
         GlobalArea::deleteByName($this->getStackName());
     }
     parent::delete();
     $db = Loader::db();
     $db->Execute('delete from Stacks where cID = ?', array($this->getCollectionID()));
 }
开发者ID:rmxdave,项目名称:concrete5,代码行数:9,代码来源:model.php

示例6: removePage

 public function removePage($pageNumber)
 {
     if (array_key_exists($pageNumber, $this->_pageKeys)) {
         $this->load->model('page');
         $page = new Page($this->_DBI);
         $pageKey = $this->_pageKeys[$pageNumber];
         $page->setKey($pageKey);
         if ($page->delete()) {
             array_splice($this->_pageKeys, $pageNumber, 1);
             return true;
         }
     }
     return false;
 }
开发者ID:cybercog,项目名称:exambuff,代码行数:14,代码来源:pagegroup.php

示例7: testDelete

 /**
  * delete
  *
  * @param mixed $id ID of record to delete
  * @param array $expected 期待値
  * @param string $message テストが失敗した時に表示されるメッセージ
  * @dataProvider deleteDataProvider
  */
 public function testDelete($id, $expected, $message = null)
 {
     // 削除したファイルを再生するため内容を取得
     $Page = $this->Page->find('first', ['conditions' => ['Page.id' => $id], 'fields' => ['Content.url'], 'recursive' => 0]);
     $path = APP . 'View' . DS . 'Pages' . $Page['Content']['url'] . '.php';
     $File = new File($path);
     $Content = $File->read();
     // 削除実行
     $this->Page->delete($id);
     $this->assertFileNotExists($path, $message);
     // 元のファイルを再生成
     $File->write($Content);
     $File->close();
     // 削除できているか確認用にデータ取得
     $result = $this->Page->exists($id);
     $this->assertEquals($expected, $result, $message);
 }
开发者ID:baserproject,项目名称:basercms,代码行数:25,代码来源:PageTest.php

示例8: display

 public function display()
 {
     $page = new Page();
     $page->loadProperties(DataBase::Current()->EscapeString($_GET['site']));
     $host = Settings::getInstance()->get("host");
     if (!isset($_GET['delete'])) {
         $template = new Template();
         $template->load("site_delete");
         $template->assign_var("TITLE", $page->title);
         $home = UrlRewriting::GetUrlByAlias("admin/home");
         $template->assign_var("SITESURL", $home);
         $delete = UrlRewriting::GetUrlByAlias("admin/pagedelete", "site=" . urlencode($_GET['site']) . "&delete=true");
         $template->assign_var("DELETEURL", $delete);
         $template->output();
     } else {
         if ($page->delete()) {
             $template = new Template();
             $template->load("message");
             $message = str_ireplace("{VAR:TITLE}", $page->title, Language::GetGlobal()->getString("PAGE_DELETED"));
             $template->assign_var("MESSAGE", $message);
             $template->output();
         }
     }
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:24,代码来源:pagedeletepage.php

示例9: testRevertToLiveFixesBrokenLinks

 public function testRevertToLiveFixesBrokenLinks()
 {
     // Create page and virutal page
     $p = new Page();
     $p->Title = "source";
     $p->write();
     $pageID = $p->ID;
     $this->assertTrue($p->doPublish());
     // Content links are one kind of link to pages
     $p2 = new Page();
     $p2->Title = "regular link";
     $p2->Content = "<a href=\"[sitetree_link,id={$p->ID}]\">test</a>";
     $p2->write();
     $this->assertTrue($p2->doPublish());
     // Virtual pages are another
     $vp = new VirtualPage();
     $vp->CopyContentFromID = $p->ID;
     $vp->write();
     // Redirector links are a third
     $rp = new RedirectorPage();
     $rp->Title = "redirector";
     $rp->LinkType = 'Internal';
     $rp->LinkToID = $p->ID;
     $rp->write();
     $this->assertTrue($rp->doPublish());
     // Confirm that there are no broken links to begin with
     $this->assertFalse($p2->HasBrokenLink);
     $this->assertFalse($vp->HasBrokenLink);
     $this->assertFalse($rp->HasBrokenLink);
     // Delete from draft and confirm that broken links are marked
     $pID = $p->ID;
     $p->delete();
     $vp->flushCache();
     $vp = DataObject::get_by_id('SiteTree', $vp->ID);
     $p2->flushCache();
     $p2 = DataObject::get_by_id('SiteTree', $p2->ID);
     $rp->flushCache();
     $rp = DataObject::get_by_id('SiteTree', $rp->ID);
     $this->assertEquals(1, $p2->HasBrokenLink);
     $this->assertEquals(1, $vp->HasBrokenLink);
     $this->assertEquals(1, $rp->HasBrokenLink);
     // Call doRevertToLive and confirm that broken links are restored
     $pLive = Versioned::get_one_by_stage('SiteTree', 'Live', '"SiteTree"."ID" = ' . $pID);
     $pLive->doRevertToLive();
     $p2->flushCache();
     $p2 = DataObject::get_by_id('SiteTree', $p2->ID);
     $vp->flushCache();
     $vp = DataObject::get_by_id('SiteTree', $vp->ID);
     $rp->flushCache();
     $rp = DataObject::get_by_id('SiteTree', $rp->ID);
     $this->assertFalse((bool) $p2->HasBrokenLink);
     $this->assertFalse((bool) $vp->HasBrokenLink);
     $this->assertFalse((bool) $rp->HasBrokenLink);
 }
开发者ID:helpfulrobot,项目名称:comperio-silverstripe-cms,代码行数:54,代码来源:SiteTreeBrokenLinksTest.php

示例10: testNormalSiteTreeDeleteWithoutVersionsTableCleaning

	public function testNormalSiteTreeDeleteWithoutVersionsTableCleaning() {
		$page = new Page();
		$page->Title = 'Page';
		$page->write();
		$pageID = $page->ID;
		
		$page->delete();
		
		$query = "SELECT \"ID\" FROM \"SiteTree_versions\" WHERE \"RecordID\" = {$pageID}";
		$this->assertTrue((bool)DB::query($query)->value(),
			"No versions found for RecordID {$pageID} even though one should exist");
	}
开发者ID:redema,项目名称:silverstripe-janitor,代码行数:12,代码来源:DataObjectOnDeleteDecoratorTest.php

示例11: destroy_user

 /**
  * Function: destroy_user
  * Destroys a user.
  */
 public function destroy_user()
 {
     if (!Visitor::current()->group->can("delete_user")) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to delete users."));
     }
     if (empty($_POST['id'])) {
         error(__("No ID Specified"), __("An ID is required to delete a user."));
     }
     if ($_POST['destroy'] == "bollocks") {
         redirect("/admin/?action=manage_users");
     }
     if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
         show_403(__("Access Denied"), __("Invalid security key."));
     }
     $sql = SQL::current();
     $user = new User($_POST['id']);
     if (isset($_POST['posts'])) {
         if ($_POST['posts'] == "delete") {
             foreach ($user->post as $post) {
                 Post::delete($post->id);
             }
         } elseif ($_POST['posts'] == "move") {
             $sql->update("posts", array("user_id" => $user->id), array("user_id" => $_POST['move_posts']));
         }
     }
     if (isset($_POST['pages'])) {
         if ($_POST['pages'] == "delete") {
             foreach ($user->page as $page) {
                 Page::delete($page->id);
             }
         } elseif ($_POST['pages'] == "move") {
             $sql->update("pages", array("user_id" => $user->id), array("user_id" => $_POST['move_pages']));
         }
     }
     User::delete($_POST['id']);
     Flash::notice(__("User deleted."), "/admin/?action=manage_users");
 }
开发者ID:eadz,项目名称:chyrp,代码行数:41,代码来源:Admin.php

示例12: getRootPath

<?php

include_once getRootPath() . "/classes/core/Page.php";
$strNode = stripslashes($_REQUEST["node"]);
Page::delete($strNode);
开发者ID:joel-cass,项目名称:structure-cms,代码行数:5,代码来源:save.php

示例13: delete

 /**
  * Delete the file
  * Cascades the call to parent
  * @see solidbase/lib/Page#delete()
  */
 function delete()
 {
     global $USER, $DB;
     if ($this->may($USER, DELETE)) {
         if ($this->Type == 'File') {
             unlink($this->path);
         }
         $DB->files->delete($this->ID);
         parent::delete();
     }
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:16,代码来源:File.php

示例14: delete

 public function delete()
 {
     if ($this->canDelete(Member::currentUser())) {
         parent::delete();
     }
 }
开发者ID:vinstah,项目名称:body,代码行数:6,代码来源:AccountPage.php

示例15: Session

<?php

require_once '../model/paths.php';
$session = new Session();
if (!$session->isLogin) {
    redirect("../login.php");
}
$user = new User();
$database = new Database();
$page = new Page();
if (isset($_POST['pageList']) && $_POST['pageList'] != null) {
    foreach ($_POST['pageList'] as $pageId) {
        $page->setPageId($database->escapeString($pageId));
        $page->delete($database);
        $path = "../logs";
        $dateTime = strftime("%Y-%m-%d %H:%M:%S");
        $text = "Deleted page with id:" . $pageId;
        $content = $dateTime . " " . $_SESSION['USNM'] . ": " . $text;
        $user->setId($_SESSION['USID']);
        $user->storeLog($content, $path);
        echo "true";
    }
} else {
    echo "false";
}
开发者ID:jetmirhaxhisefa,项目名称:rezervime,代码行数:25,代码来源:deletePage.php


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