Skip to content
Snippets Groups Projects
Select Git revision
  • 74c7890fbb3e1b52c9207e15a886f2d3820d1f6c
  • master default protected
2 results

app.php

Blame
  • app.php 16.46 KiB
    <?php
    /**
     * ownCloud
     *
     * @author Frank Karlitschek
     * @author Jakob Sack
     * @copyright 2012 Frank Karlitschek frank@owncloud.org
     *
     * This library is free software; you can redistribute it and/or
     * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
     * License as published by the Free Software Foundation; either
     * version 3 of the License, or any later version.
     *
     * This library is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
     *
     * You should have received a copy of the GNU Affero General Public
     * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
     *
     */
    
    /**
     * This class manages the apps. It allows them to register and integrate in the
     * owncloud ecosystem. Furthermore, this class is responsible for installing,
     * upgrading and removing apps.
     */
    class OC_App{
    	static private $init = false;
    	static private $activeapp = '';
    	static private $navigation = array();
    	static private $settingsForms = array();
    	static private $adminForms = array();
    	static private $personalForms = array();
    	static private $appInfo = array();
    	static private $appTypes = array();
    	static private $loadedApps = array();
    
    	/**
    	 * @brief loads all apps
    	 * @param array $types
    	 * @returns true/false
    	 *
    	 * This function walks through the owncloud directory and loads all apps
    	 * it can find. A directory contains an app if the file /appinfo/app.php
    	 * exists.
    	 *
    	 * if $types is set, only apps of those types will be loaded
    	 */
    	public static function loadApps($types=null){
    		// Load the enabled apps here
    		$apps = self::getEnabledApps();
    		// prevent app.php from printing output
    		ob_start();
    		foreach( $apps as $app ){
    			if((is_null($types) or self::isType($app,$types)) && !in_array($app, self::$loadedApps)){
    				self::loadApp($app);
    				self::$loadedApps[] = $app;
    			}
    		}
    		ob_end_clean();
    
    		if (!defined('DEBUG') || !DEBUG){
    			if (is_null($types)) {
    				OC_Util::$core_scripts = OC_Util::$scripts;
    				OC_Util::$scripts = array();
    				OC_Util::$core_styles = OC_Util::$styles;
    				OC_Util::$styles = array();
    			}