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


PHP Picture::removeDirectory方法代码示例

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


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

示例1: action

 /**
  * Call action (mark as fav, archive, delete, etc.)
  */
 public function action($action, Url $url, $id = 0, $import = FALSE, $autoclose = FALSE, $tags = null)
 {
     switch ($action) {
         case 'add':
             $content = Tools::getPageContent($url);
             $title = $content['rss']['channel']['item']['title'] != '' ? $content['rss']['channel']['item']['title'] : _('Untitled');
             $body = $content['rss']['channel']['item']['description'];
             // clean content from prevent xss attack
             $purifier = $this->_getPurifier();
             $title = $purifier->purify($title);
             $body = $purifier->purify($body);
             //search for possible duplicate
             $duplicate = NULL;
             $duplicate = $this->store->retrieveOneByURL($url->getUrl(), $this->user->getId());
             $last_id = $this->store->add($url->getUrl(), $title, $body, $this->user->getId());
             if ($last_id) {
                 Tools::logm('add link ' . $url->getUrl());
                 if (DOWNLOAD_PICTURES) {
                     $content = Picture::filterPicture($body, $url->getUrl(), $last_id);
                     Tools::logm('updating content article');
                     $this->store->updateContent($last_id, $content, $this->user->getId());
                 }
                 if ($duplicate != NULL) {
                     // duplicate exists, so, older entry needs to be deleted (as new entry should go to the top of list), BUT favorite mark and tags should be preserved
                     Tools::logm('link ' . $url->getUrl() . ' is a duplicate');
                     // 1) - preserve tags and favorite, then drop old entry
                     $this->store->reassignTags($duplicate['id'], $last_id);
                     if ($duplicate['is_fav']) {
                         $this->store->favoriteById($last_id, $this->user->getId());
                     }
                     if ($this->store->deleteById($duplicate['id'], $this->user->getId())) {
                         Tools::logm('previous link ' . $url->getUrl() . ' entry deleted');
                     }
                 }
                 // if there are tags, add them to the new article
                 if (isset($_GET['tags'])) {
                     $_POST['value'] = $_GET['tags'];
                     $_POST['entry_id'] = $last_id;
                     $this->action('add_tag', $url);
                 }
                 $this->messages->add('s', _('the link has been added successfully'));
             } else {
                 $this->messages->add('e', _('error during insertion : the link wasn\'t added'));
                 Tools::logm('error during insertion : the link wasn\'t added ' . $url->getUrl());
             }
             if ($autoclose == TRUE) {
                 Tools::redirect('?view=home&closewin=true');
             } else {
                 Tools::redirect('?view=home');
             }
             return $last_id;
             break;
         case 'delete':
             if (isset($_GET['search'])) {
                 //when we want to apply a delete to a search
                 $tags = array($_GET['search']);
                 $allentry_ids = $this->store->search($tags[0], $this->user->getId());
                 $entry_ids = array();
                 foreach ($allentry_ids as $eachentry) {
                     $entry_ids[] = $eachentry[0];
                 }
             } else {
                 // delete a single article
                 $entry_ids = array($id);
             }
             foreach ($entry_ids as $id) {
                 $msg = 'delete link #' . $id;
                 if ($this->store->deleteById($id, $this->user->getId())) {
                     if (DOWNLOAD_PICTURES) {
                         Picture::removeDirectory(ABS_PATH . $id);
                     }
                     $this->messages->add('s', _('the link has been deleted successfully'));
                 } else {
                     $this->messages->add('e', _('the link wasn\'t deleted'));
                     $msg = 'error : can\'t delete link #' . $id;
                 }
                 Tools::logm($msg);
             }
             Tools::redirect('?');
             break;
         case 'toggle_fav':
             $this->store->favoriteById($id, $this->user->getId());
             Tools::logm('mark as favorite link #' . $id);
             if (Tools::isAjaxRequest()) {
                 echo 1;
                 exit;
             } else {
                 Tools::redirect();
             }
             break;
         case 'toggle_archive':
             if (isset($_GET['tag_id'])) {
                 //when we want to archive a whole tag
                 $tag_id = $_GET['tag_id'];
                 $allentry_ids = $this->store->retrieveEntriesByTag($tag_id, $this->user->getId());
                 $entry_ids = array();
                 foreach ($allentry_ids as $eachentry) {
//.........这里部分代码省略.........
开发者ID:nsbasicus,项目名称:wallabag,代码行数:101,代码来源:Poche.class.php


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