Permalink
Browse files

Adapt head comment (2011->2012) and clear Bootstrap and OntoWiki code

  • Loading branch information...
1 parent 8fe5061 commit 76e767e74e629afc62b1cecfca6edf830bbbd42e @k00ni k00ni committed Jun 5, 2012
Showing with 55 additions and 59 deletions.
  1. +5 −6 application/Bootstrap.php
  2. +49 −52 application/classes/OntoWiki.php
  3. +1 −1 index.php
View
@@ -129,9 +129,9 @@ public function _initConfig()
$config->themes->default = rtrim($config->themes->default, '/\\') . '/';
$config->extensions->base = rtrim($config->extensions->base, '/\\') . '/';
- if ( false === defined ( 'EXTENSION_PATH' ) )
+ if ( false === defined('EXTENSION_PATH'))
define('EXTENSION_PATH', $config->extensions->base);
-
+
$config->extensions->legacy = EXTENSION_PATH . rtrim($config->extensions->legacy, '/\\') . '/';
$config->languages->path = EXTENSION_PATH . rtrim($config->languages->path, '/\\') . '/';
@@ -178,8 +178,7 @@ public function _initConfig()
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'On');
// enable debugging options
- if ( false === defined ('_OWDEBUG') )
- {
+ if ( false === defined('_OWDEBUG')) {
define('_OWDEBUG', 1);
}
// log everything
@@ -378,7 +377,7 @@ public function _initPlugins()
$frontController = $this->getResource('frontController');
// Needs to be done first!
- $frontController->registerPlugin(new OntoWiki_Controller_Plugin_HttpAuth(), 1);
+ $frontController->registerPlugin(new OntoWiki_Controller_Plugin_HttpAuth(), 1);
$frontController->registerPlugin(new OntoWiki_Controller_Plugin_SetupHelper(), 2);
//needs to be done after SetupHelper
$frontController->registerPlugin(new OntoWiki_Controller_Plugin_ListSetupHelper(), 3);
@@ -447,7 +446,7 @@ public function _initSession()
// define the session key as a constant for global reference
- if ( false === defined ( '_OWSESSION' ) )
+ if ( false === defined('_OWSESSION'))
define('_OWSESSION', $sessionKey);
// inject session vars into OntoWiki
@@ -1,5 +1,4 @@
-<?php
-
+<?php
/**
* This file is part of the {@link http://ontowiki.net OntoWiki} project.
*
@@ -25,59 +24,59 @@
class OntoWiki
{
const DEFAULT_LOG_IDENTIFIER = 'ontowiki';
-
+
// ------------------------------------------------------------------------
// --- Properties
// ------------------------------------------------------------------------
-
+
/**
* The bootstrap object used during bootstrap.
* @var Zend_Application_Bootstrap_Bootstrap
*/
protected $_bootstrap = null;
-
+
/**
* A dictionary for custom logger objects.
* The key is the identifier for the logger.
*/
protected $_customLogs = array();
-
+
/**
* Array of properties
* @var array
*/
protected $_properties = array();
-
+
/**
* Variables to be autoloaded from the session
* @var array
*/
protected $_sessionVars = array();
-
+
/**
* Singleton instance
* @var OntoWiki
*/
private static $_instance = null;
-
+
// ------------------------------------------------------------------------
// --- Magic Methods
// ------------------------------------------------------------------------
-
+
/**
* Constructor
*/
private function __construct()
{
}
-
+
/**
* Disallow cloning
*/
private function __clone()
{
}
-
+
/**
* Returns a property value
*
@@ -93,19 +92,19 @@ public function __get($propertyName)
$this->_properties[$propertyName] = $this->session->$propertyName;
}
}
-
+
// retrieve bootstrap resource
$bootstrap = $this->getBootstrap();
if ($bootstrap and $bootstrap->hasResource($propertyName)) {
return $bootstrap->getResource($propertyName);
}
-
+
// retrieve locally
if (isset($this->$propertyName)) {
return $this->_properties[$propertyName];
}
}
-
+
/**
* Sets a property
*
@@ -119,11 +118,11 @@ public function __set($propertyName, $propertyValue)
if (in_array($propertyName, $this->_sessionVars)) {
$this->session->$propertyName = $propertyValue;
}
-
+
// set locally
$this->_properties[$propertyName] = $propertyValue;
}
-
+
/**
* Returns whether a property is set
*
@@ -135,7 +134,7 @@ public function __isset($propertyName)
{
return array_key_exists($propertyName, $this->_properties);
}
-
+
/**
* Unsets a property
*
@@ -148,15 +147,15 @@ public function __unset($propertyName)
if (in_array($propertyName, $this->_sessionVars)) {
unset($this->session->$propertyName);
}
-
+
// unset locally
unset($this->_properties[$propertyName]);
}
-
+
// ------------------------------------------------------------------------
// --- Public Methods
- // ------------------------------------------------------------------------
-
+ // ------------------------------------------------------------------------
+
/**
* Appends a message to the message stack
*
@@ -166,15 +165,15 @@ public function __unset($propertyName)
public function appendMessage(OntoWiki_Message $message)
{
$session = $this->getBootstrap()->getResource('Session');
-
+
$messageStack = (array)$session->messageStack;
array_push($messageStack, $message);
-
+
$session->messageStack = $messageStack;
-
+
return $this;
}
-
+
/**
* Returns the current message stack and empties it.
*
@@ -185,7 +184,7 @@ public function drawMessages()
{
return $this->getMessages(true);
}
-
+
/**
* Returns the application bootstrap object
*
@@ -197,10 +196,10 @@ public function getBootstrap()
$frontController = Zend_Controller_Front::getInstance();
$this->_bootstrap = $frontController->getParam('bootstrap');
}
-
+
return $this->_bootstrap;
}
-
+
/**
* Returns the system config object
*
@@ -214,7 +213,7 @@ public function getConfig()
return $this->getBootstrap()->getResource('Config');
}
}
-
+
/**
* Singleton instance
*
@@ -225,10 +224,10 @@ public static function getInstance()
if (null === self::$_instance) {
self::$_instance = new self();
}
-
+
return self::$_instance;
}
-
+
/**
* Returns a custom logger object.
* If the $identifier parameter is missing or is equal to the default log
@@ -242,14 +241,13 @@ public function getCustomLogger($identifier = self::DEFAULT_LOG_IDENTIFIER)
if ($identifier === self::DEFAULT_LOG_IDENTIFIER) {
return $this->logger;
}
-
+
if (isset($this->_customLogs[$identifier])) {
return $this->_customLogs[$identifier];
}
-
-
+
$config = $this->getConfig();
-
+
// support absolute path
if (!(preg_match('/^(\w:[\/|\\\\]|\/)/', $config->log->path) === 1)) {
// prepend OntoWiki root for relative paths
@@ -274,7 +272,7 @@ public function getCustomLogger($identifier = self::DEFAULT_LOG_IDENTIFIER)
return $logger;
}
-
+
/**
* Returns the current message stack and empties it.
*
@@ -284,19 +282,19 @@ public function getCustomLogger($identifier = self::DEFAULT_LOG_IDENTIFIER)
public function getMessages($clearMessages = false)
{
$session = $this->getBootstrap()->getResource('Session');
-
+
// store temporarily
$messageStack = (array)$this->session->messageStack;
-
+
if ($clearMessages) {
// empty message stack
unset($session->messageStack);
}
-
+
// return temp
return $messageStack;
}
-
+
/**
* Returns the base URL for static files.
* In case mod_rewrite is enabled, getUrlBase and getStaticUrlBase
@@ -311,7 +309,7 @@ public function getStaticUrlBase()
return $config->staticUrlBase;
}
}
-
+
/**
* Returns the base URL for dynamic requests.
* In case mod_rewrite is enabled, getUrlBase and getStaticUrlBase
@@ -326,7 +324,7 @@ public function getUrlBase()
return $config->urlBase;
}
}
-
+
/**
* Returns the currently logged-in user.
*
@@ -336,7 +334,7 @@ public function getUser()
{
return $this->user;
}
-
+
/**
* Returns whether OntoWiki currently has messages for the user.
*
@@ -345,10 +343,10 @@ public function getUser()
public function hasMessages()
{
$messages = $this->getMessages();
-
+
return (!empty($messages));
}
-
+
/**
* Sets an array of variables that are to be synchronized
* with the session.
@@ -361,7 +359,7 @@ public function setSessionVars(array $sessionVars)
// add to session vars
$this->_sessionVars = $sessionVars;
}
-
+
/**
* Prepends a message to the message stack
*
@@ -371,18 +369,17 @@ public function setSessionVars(array $sessionVars)
public function prependMessage(OntoWiki_Message $message)
{
$session = $this->getBootstrap()->getResource('Session');
-
+
$messageStack = (array)$session->messageStack;
array_unshift($messageStack, $message);
-
+
$session->messageStack = $messageStack;
-
+
return $this;
}
-
+
public static function reset()
{
self::$_instance = null;
}
}
-
View
@@ -2,7 +2,7 @@
/**
* This file is part of the {@link http://ontowiki.net OntoWiki} project.
*
- * @copyright Copyright (c) 2011, {@link http://aksw.org AKSW}
+ * @copyright Copyright (c) 2012, {@link http://aksw.org AKSW}
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
*/

0 comments on commit 76e767e

Please sign in to comment.