/**
  * Check the item in the collection should be filtered out
  * If return is false, the item will be discarded at 100%
  * If return is true, isn't sure that the item will be added
  * 'cause another plugin can prevent this
  * 
  * Plugins who check per-item acl or blacklist should hook here
  * 
  * @param X_Page_Item_PItem $item
  * @param string $provider
  * @param Zend_Controller_Action $controller
  * @return boolean true if item is ok, false if item should be discarded
  */
 public function filterShareItems(X_Page_Item_PItem $item, $provider, Zend_Controller_Action $controller)
 {
     $providerClass = X_VlcShares_Plugins::broker()->getPluginClass($provider);
     $providerObj = X_VlcShares_Plugins::broker()->getPlugins($provider);
     if (is_a($providerObj, 'X_VlcShares_Plugins_FileSystem')) {
         if ($item->getType() == X_Page_Item_PItem::TYPE_ELEMENT) {
             $itemLocation = $item->getCustom('X_VlcShares_Plugins_FileSystem:location');
             /* @var $urlHelper Zend_Controller_Action_Helper_Url */
             $urlHelper = $controller->getHelper('url');
             $path = $providerObj->resolveLocation($itemLocation);
             $thumb = new Application_Model_FsThumb();
             Application_Model_FsThumbsMapper::i()->fetchByPath($path, $thumb);
             if ($thumb->isNew()) {
                 $thumbUrl = X_Env::completeUrl($urlHelper->direct('thumb', 'fsthumbs', 'default', array('l' => X_Env::encode($itemLocation), 't' => 'dummy.jpg')));
             } else {
                 $thumbUrl = X_Env::completeUrl(Zend_Controller_Front::getInstance()->getBaseUrl() . $thumb->getUrl());
             }
             //$item->setDescription($itemLocation);
             $item->setThumbnail($thumbUrl);
         }
     }
     return true;
 }
 /**
  * Return true if $item is an hidden file or system file (check configs)
  * @param X_Page_Item_PItem $item
  * @param string $provider
  * @param Zend_Controller_Action $controller
  * @return boolean|null true or null if file is ok, false otherwise (will be filtered out)
  */
 public function filterShareItems(X_Page_Item_PItem $item, $provider, Zend_Controller_Action $controller)
 {
     try {
         $plugin = X_VlcShares_Plugins::broker()->getPlugins($provider);
         if (is_a($plugin, 'X_VlcShares_Plugins_FileSystem') && $plugin instanceof X_VlcShares_Plugins_ResolverInterface) {
             // i use instanceof ResolverInterface
             // so i have code suggestions
             // X_VlcShares_Plugins_FileSystem register a custom param in item
             // for location lookup
             $location = $plugin->resolveLocation($item->getCustom('X_VlcShares_Plugins_FileSystem:location'));
             // i must check for $location !== false as a fallback for no custom param case
             if ($location !== false && file_exists($location)) {
                 // i have a location to check for hidden files:
                 if ($this->_checkEntry($location) === false) {
                     X_Debug::i("Plugin triggered, item filtered: {$location}");
                     return false;
                 }
             }
             //X_Debug::i('Plugin triggered');
         }
     } catch (Exception $e) {
         X_Debug::w("Problem while filtering: {$e->getMessage()}");
     }
 }