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


PHP Path::delete方法代码示例

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


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

示例1: _set_front_page

 /**
  * Sets Front page route
  *
  * @param   string  $source  Path for alias
  * @return  ORM Model_Path
  *
  * @uses    Path::delete
  * @uses    Path::save
  */
 private function _set_front_page($source)
 {
     // Delete previous alias if any
     Path::delete(array('alias' => Path::FRONT_ALIAS));
     // Create and save alias
     $values = array();
     $values['source'] = $source;
     $values['alias'] = Path::FRONT_ALIAS;
     return Path::save($values);
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:19,代码来源:setting.php

示例2: delete

 /**
  * Deletes a single post or multiple posts, ignoring relationships.
  *
  * @return  ORM
  * @throws  Gleez_Exception
  * @uses    Path::delete
  */
 public function delete()
 {
     if (!$this->_loaded) {
         throw new Gleez_Exception('Cannot delete :model model because it is not loaded.', array(':model' => $this->_object_name));
     }
     $source = $this->rawurl;
     parent::delete();
     // Delete the path aliases associated with this object
     Path::delete(array('source' => $source));
     unset($source);
     return $this;
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:19,代码来源:tag.php

示例3: delete

 /**
  * Deletes a single post or multiple posts, ignoring relationships.
  *
  * @param  	boolean $soft    Make delete as soft or hard. Default hard [Optional]
  * @return  ORM
  * @throws  Gleez_Exception
  * @uses    Path::delete
  */
 public function delete($soft = FALSE)
 {
     if (!$this->_loaded) {
         throw new Gleez_Exception('Cannot delete :model model because it is not loaded.', array(':model' => $this->_object_name));
     }
     if (is_array($this->_deleted_column) && $soft == TRUE) {
     } else {
         $source = $this->rawurl;
         parent::delete($soft);
         // Delete the path aliases associated with this object
         Path::delete(array('source' => $source));
         unset($source);
     }
     return $this;
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:23,代码来源:tag.php

示例4: editBook

function editBook()
{
    if (!isLogged()) {
        header('Location: ./');
        exit;
    }
    $books = new Books(isLogged());
    $id = (int) $_GET['edit'] + 0;
    if (!isset($books[$id])) {
        notFound();
    }
    $book = $books[$id];
    global $tpl;
    global $_CONFIG;
    // process to edit book in database
    if (isset($_POST) && !empty($_POST)) {
        if (!empty($_POST['token']) && acceptToken($_POST['token'])) {
            $inputs = array('title' => isset($_POST['title']) ? trim(htmlspecialchars($_POST['title'])) : NULL, 'author' => isset($_POST['author']) ? trim(htmlspecialchars($_POST['author'])) : NULL, 'summary' => isset($_POST['summary']) ? checkNewLineContent($_POST['summary']) : NULL, 'publisher' => isset($_POST['publisher']) ? trim(htmlspecialchars($_POST['publisher'])) : NULL, 'status' => isset($_POST['status']) ? Book::SEEN : NULL, 'note' => isset($_POST['note']) ? checkRatingNote($_POST['note'], isset($_POST['status']) ? Book::SEEN : NULL) : NULL, 'read_date' => isset($_POST['read_date']) ? checkInputDate($_POST['read_date']) : NULL, 'review' => isset($_POST['review']) ? checkNewLineContent($_POST['review']) : NULL, 'genre' => isset($_POST['genre']) ? checkGenre($_POST['genre']) : NULL, 'publication_year' => isset($_POST['publication_year']) ? checkInputYear($_POST['publication_year']) : NULL, 'pages' => isset($_POST['pages']) ? checkPages($_POST['pages']) : NULL, 'country' => isset($_POST['country']) ? checkCountry($_POST['country']) : NULL, 'link_website' => isset($_POST['link_website']) ? checkLink($_POST['link_website']) : NULL, 'link_image' => isset($_POST['link_image']) ? checkLink($_POST['link_image']) : NULL, 'link_image_import' => isset($_POST['link_image_import']) ? TRUE : NULL);
            try {
                if (empty($inputs['title'])) {
                    throw new \Exception('Title must not be empty.');
                }
                if (empty($inputs['author'])) {
                    throw new \Exception('Author must not be empty.');
                }
                if (empty($inputs['summary'])) {
                    throw new \Exception('Summary must not be empty.');
                }
                $book = array('id' => $id);
                // check if we need to get the image given with url
                if ($inputs['link_image_import']) {
                    importImage($inputs['link_image'], $book['id']);
                    $inputs['link_image'] = $_CONFIG['images'] . '/' . $id . '.jpg';
                }
                unset($inputs['link_image_import']);
                foreach ($inputs as $key => $value) {
                    $book[$key] = $value;
                }
                $books[$id] = $book;
                $books->save();
                header('Location: ' . Path::book($id));
                exit;
            } catch (\Exception $e) {
                $tpl->assign('error', $e->getMessage());
            }
        } else {
            errorPage('The received token was empty or invalid.', 'Invalid security token');
        }
    } else {
        $inputs = array('title' => $book['title'], 'author' => $book['author'], 'summary' => str_replace('<br />', '', $book['summary']), 'publisher' => $book['publisher'], 'status' => $book['status'], 'note' => $book['note'], 'read_date' => $book['read_date'], 'review' => str_replace('<br />', '', $book['review']), 'genre' => $book['genre'], 'publication_year' => $book['publication_year'], 'pages' => $book['pages'], 'country' => $book['country'], 'link_website' => preg_replace('#http://#', '', $book['link_website']), 'link_image' => preg_replace('#http://#', '', $book['link_image']));
    }
    $tpl->assign('page_title', 'Edit book');
    $tpl->assign('menu_links', Path::menu('edit'));
    $tpl->assign('menu_links_admin', Path::menuAdmin('edit'));
    $tpl->assign('inputs', $inputs);
    $tpl->assign('today', date('Y-m-d'));
    $tpl->assign('countries', displayCountryOptions($inputs['country']));
    $tpl->assign('token', getToken());
    $tpl->assign('target', Path::edit($id));
    $tpl->assign('delete', Path::delete($id));
    $tpl->draw('form.book');
    exit;
}
开发者ID:Devenet,项目名称:MyBooks,代码行数:63,代码来源:index.php

示例5: bulk_convert

 /**
  * Bulk convert post type(s)
  *
  * Example:
  * ~~~
  * Post::bulk_convert(array(1, 2, 3, ...), 'blog');
  * ~~~
  *
  * @param   array   $ids      Array of post id's
  * @param   array   $actions  Array of post type (new type)
  * @param   string  $type     Type of post [Optional]
  * @uses    Path::delete
  */
 public static function bulk_convert(array $ids, array $actions, $type)
 {
     $new_type = (string) $actions[0];
     $posts = ORM::factory($type)->where('id', 'IN', $ids)->find_all();
     foreach ($posts as $post) {
         // Delete the path aliases associated with this object
         Path::delete(array('source' => $post->rawurl));
         // Remove the previous terms relationship
         $post->remove('terms');
         // Remove the previous tags relationship
         $post->remove('tags');
         // Update the type column in comments
         DB::update('comments')->set(array('type' => $new_type))->where('post_id', '=', $post->id)->execute();
         // Set the post type to new type
         $post->type = $new_type;
         // Be sure unpublish the converted posts
         $post->status = 'draft';
         $post->promote = 0;
         $post->sticky = 0;
         // Finally update the object
         $post->save();
     }
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:36,代码来源:post.php


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