Ejemplo n.º 1
0
 public function _isEntryAuthorized(UseyourDrive_Node $cachedentry)
 {
     $entry = $cachedentry->getItem();
     /* Skip entry if its a file, and we dont want to show files */
     if ($entry->getMimeType() !== 'application/vnd.google-apps.folder' && $this->options['show_files'] === '0') {
         return false;
     }
     /* Skip entry if its a folder, and we dont want to show folders */
     if ($entry->getMimeType() === 'application/vnd.google-apps.folder' && $this->options['show_folders'] === '0') {
         return false;
     }
     /* Only add allowed files to array */
     $extension = isset($entry->fileExtension) ? $entry->getFileExtension() : '';
     if ($entry->getMimeType() !== 'application/vnd.google-apps.folder' && !in_array(strtolower($extension), $this->options['ext']) && $this->options['ext'][0] != '*') {
         return false;
     }
     /* skip excluded folders and files */
     if ($this->options['exclude'][0] != '*') {
         if (in_array($entry->getTitle(), $this->options['exclude'])) {
             return false;
         }
     }
     /* only allow included folders and files */
     if ($this->options['include'][0] != '*') {
         if (!in_array($entry->getTitle(), $this->options['include'])) {
             return false;
         }
     }
     /* Is file in the selected root Folder? */
     if (!$cachedentry->isInFolder($this->_rootFolder)) {
         return false;
     }
     return true;
 }
 public function removeParent(UseyourDrive_Node $pnode)
 {
     if ($this->hasParents() && isset($this->parents[$pnode->getId()])) {
         $this->parents[$pnode->getId()]->removeChild($this);
         unset($this->parents[$pnode->getId()]);
     }
     return $this;
 }