Example #1
0
 function getPlugins()
 {
     if (self::$_plugins) {
         return self::$_plugins;
     } else {
         $plugins = array();
         if (file_exists(JPATH_ROOT . "/images/com_adsmanager/plugins/")) {
             $path = JPATH_ROOT . "/images/com_adsmanager/plugins/";
             $handle = opendir($path);
             while ($file = readdir($handle)) {
                 $dir = $path . '/' . $file;
                 if (is_dir($dir)) {
                     if ($file != "." && $file != "..") {
                         if (file_exists($path . '/' . $file . '/plug.php')) {
                             include_once $path . '/' . $file . '/plug.php';
                             if ($file == "zipcode") {
                                 $plugins["zipcode"] = new AdsManagerZipCodePlugin();
                             }
                             if ($file == "region") {
                                 $plugins["region"] = new AdsManagerRegionPlugin();
                             }
                         } else {
                             if (is_file($path . '/' . $file)) {
                                 JFolder::delete($path . '/' . $file);
                             }
                         }
                     }
                 }
             }
             closedir($handle);
         }
         self::$_plugins = $plugins;
         return self::$_plugins;
     }
 }