Example #1
0
 public static function themes($type = 'installed')
 {
     switch ($type) {
         case 'installed':
             return ClassRegistry::init('Themes.Theme')->installed();
             break;
         case 'notInstalled':
             return array_intersect(self::themes('all'), self::themes('installed'));
             break;
         default:
         case 'all':
             $return = array();
             foreach (InfinitasPlugin::listPlugins('loaded') as $plugin) {
                 foreach (InstallerLib::findThemes($plugin) as $theme) {
                     $return[$plugin . '.' . $theme] = Inflector::humanize(Inflector::underscore($plugin . Inflector::camelize($theme)));
                 }
             }
             foreach (InstallerLib::findThemes() as $theme) {
                 $return[$theme] = Inflector::humanize(Inflector::underscore($theme));
             }
             return $return;
             break;
     }
 }
Example #2
0
 /**
  * @brief get a list of themes that are not yet installed
  * 
  * @access public
  * 
  * @return array list of themes that are not installed
  */
 public function notInstalled()
 {
     App::uses('InstallerLib', 'Installer.Lib');
     $installed = $this->installed();
     $notInstalled = array();
     foreach (InfinitasPlugin::listPlugins('loaded') as $plugin) {
         foreach (InstallerLib::findThemes($plugin) as $theme) {
             if (!array_key_exists($theme, $installed)) {
                 $notInstalled[$plugin . '.' . $theme] = Inflector::humanize(Inflector::underscore($plugin . Inflector::camelize($theme)));
             }
         }
     }
     foreach (InstallerLib::findThemes() as $theme) {
         if (!linkinfo(InstallerLib::themePath(null, $theme)) && !array_key_exists($theme, $installed)) {
             $notInstalled[$theme] = Inflector::humanize(Inflector::underscore($theme));
         }
     }
     return $notInstalled;
 }