Example #1
0
 function _loadAllEvents()
 {
     if (is_dir(PLUGINS_DIR)) {
         $oPdir = getFileObject(PLUGINS_DIR);
         //parse each plugin directory
         $listDir = $oPdir->listDir($oPdir->ONLY_DIR);
         foreach ($listDir as $strPluginPath) {
             $oDirPlugin = new PPluginDir($strPluginPath);
             if ($oDirPlugin->isActivated()) {
                 $listFiles = $oDirPlugin->listDir($oDirPlugin->ONLY_FILES, $bFullPath = false);
                 //parse each files and add it in the tab events
                 foreach ($listFiles as $strFileName) {
                     if (preg_match('/(.+)filter\\.(.+)\\.php/', $strFileName, $tabInfo)) {
                         $this->_events['smarty'][$tabInfo[1]][] = array('FILEPATH' => $oDirPlugin->path . SLASH . $strFileName, 'NAME' => $tabInfo[2], 'EVENT' => $tabInfo[1]);
                     } else {
                         if (preg_match('/insert\\.(.+)\\.php/', $strFileName, $tabInfo)) {
                             $this->_events['smarty']['insert'][] = array('FILEPATH' => $oDirPlugin->path . SLASH . $strFileName, 'NAME' => $tabInfo[1], 'EVENT' => 'insert');
                         } else {
                             if (preg_match('/function\\.(.+)\\.php/', $strFileName, $tabInfo)) {
                                 $this->_events['smarty']['function'][] = array('FILEPATH' => $oDirPlugin->path . SLASH . $strFileName, 'NAME' => $tabInfo[1], 'EVENT' => 'function');
                             } else {
                                 if (preg_match('/(.+)event\\.(.+)\\.php/', $strFileName, $tabInfo)) {
                                     $strEvent = $tabInfo[1];
                                     $strName = $tabInfo[2];
                                     $strFunction = 'pollen_' . $strEvent . 'event_' . $strName;
                                     require_once $oDirPlugin->path . SLASH . $strFileName;
                                     $this->_addEvent($strEvent, $strFunction, $pritority = 10);
                                 } else {
                                     if (preg_match('/\\.php$/', $strFileName)) {
                                         require_once $oDirPlugin->path . SLASH . $strFileName;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             //end if plugin is activated
         }
     }
 }