Permalink
Browse files

Standardize code.

- Add standard file-level and class-level docblocks.
- Remove unneded doc tags and whitespace.
  • Loading branch information...
1 parent 0a0b4a7 commit c0f652e666b5ba3eb892b924cb6511c3a68d154c @jimsafley jimsafley committed Oct 11, 2012
Showing with 274 additions and 381 deletions.
  1. +7 −12 admin/index.php
  2. +19 −57 application/libraries/Omeka/Application.php
  3. +6 −15 application/libraries/Omeka/Application/Resource/Acl.php
  4. +7 −11 application/libraries/Omeka/Application/Resource/Auth.php
  5. +6 −14 application/libraries/Omeka/Application/Resource/Autoloader.php
  6. +10 −13 application/libraries/Omeka/Application/Resource/Cachemanager.php
  7. +7 −10 application/libraries/Omeka/Application/Resource/Config.php
  8. +5 −8 application/libraries/Omeka/Application/Resource/Currentuser.php
  9. +8 −11 application/libraries/Omeka/Application/Resource/Db.php
  10. +9 −15 application/libraries/Omeka/Application/Resource/Debug.php
  11. +10 −9 application/libraries/Omeka/Application/Resource/Exception.php
  12. +19 −24 application/libraries/Omeka/Application/Resource/Frontcontroller.php
  13. +16 −18 application/libraries/Omeka/Application/Resource/Helpers.php
  14. +6 −6 application/libraries/Omeka/Application/Resource/Jobs.php
  15. +8 −7 application/libraries/Omeka/Application/Resource/Jobs/InvalidAdapterException.php
  16. +15 −20 application/libraries/Omeka/Application/Resource/Locale.php
  17. +8 −11 application/libraries/Omeka/Application/Resource/Logger.php
  18. +10 −13 application/libraries/Omeka/Application/Resource/Mail.php
  19. +14 −19 application/libraries/Omeka/Application/Resource/Options.php
  20. +6 −10 application/libraries/Omeka/Application/Resource/Pluginbroker.php
  21. +10 −15 application/libraries/Omeka/Application/Resource/Plugins.php
  22. +8 −14 application/libraries/Omeka/Application/Resource/Router.php
  23. +13 −17 application/libraries/Omeka/Application/Resource/Session.php
  24. +10 −9 application/libraries/Omeka/Application/Resource/Storage.php
  25. +8 −15 application/libraries/Omeka/Application/Resource/Theme.php
  26. +23 −3 bootstrap.php
  27. +6 −5 index.php
View
@@ -1,22 +1,19 @@
<?php
/**
- * Bootstrap for admin interface.
- *
- * This is the same as the public interface bootstrap, except it defines an
- * ADMIN constant used by the bootstrap script to ensure that Omeka loads the
- * correct view scripts (and any other theme-specific behavior).
- *
- * @copyright Roy Rosenzweig Center for History and New Media, 2007-2012
- * @license http://www.gnu.org/licenses/gpl-3.0.txt
+ * Omeka
+ *
+ * @copyright Copyright 2007-2012 Roy Rosenzweig Center for History and New Media
+ * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
+ * @package Omeka
*/
-
+
// Flag this as the admin theme.
define('ADMIN', true);
// Bootstrap the application.
include dirname(dirname(__FILE__)) . '/bootstrap.php';
-// Configure the bootstrap and run the application.
+// Configure, initialize, and run the application.
$application = new Omeka_Application(APPLICATION_ENV);
$application->getBootstrap()->setOptions(array(
'resources' => array(
@@ -26,8 +23,6 @@
)
)
));
-
// Set an admin flag to the front controller.
Zend_Controller_Front::getInstance()->setParam('admin', true);
-
$application->initialize()->run();
@@ -1,99 +1,76 @@
<?php
/**
- * @copyright Roy Rosenzweig Center for History and New Media, 2007-2010
- * @license http://www.gnu.org/licenses/gpl-3.0.txt
- * @package Omeka
- * @access private
+ * Omeka
+ *
+ * @copyright Copyright 2007-2012 Roy Rosenzweig Center for History and New Media
+ * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
*/
/**
* Core class used to bootstrap the Omeka environment.
*
- * Various duties include, but are not limited to, sanitizing magic_quotes,
- * setting up class autoload, database, configuration files, logging, plugins,
- * front controller, etc.
+ * Various duties include, but are not limited to setting up class autoload,
+ * database, configuration files, logging, plugins, front controller, etc.
*
* When any core resource returns from init(), the result is stored in the
* bootstrap container. Other parts of the application can get the resources
* from the bootstrap when needed.
- *
- * @internal This implements Omeka internals and is not part of the public API.
- * @access private
- * @package Omeka
+ *
+ * @package Omeka\Application
*/
class Omeka_Application extends Zend_Application
{
/**
* Initialize the application.
*
- * @param string $environment Environment name.
+ * @param string $environment The environment name.
* @param string|array|Zend_Config $options Application configuration.
*/
public function __construct($environment, $options = null)
{
+ // Add functions to the global scope.
require_once 'globals.php';
// Set the configuration file if not passed.
if (!$options) {
- $options = CONFIG_DIR . '/' . 'application.ini';
+ $options = CONFIG_DIR . '/application.ini';
}
parent::__construct($environment, $options);
-
Zend_Registry::set('bootstrap', $this->getBootstrap());
}
/**
* Bootstrap the entire application.
- *
- * This will initialize all the elements of the application.
- *
- * @return void
*/
public function initialize()
{
try {
// Force the autoloader to be set up first.
$this->getBootstrap()->bootstrap('Autoloader');
- $this->sanitizeMagicQuotes();
return $this->bootstrap();
+
} catch (Zend_Config_Exception $e) {
- // These exceptions will be thrown for config files, when they don't
- // exist or are improperly structured. Should do something similar
- // to the database exception errors.
$this->_displayErrorPage($e->getMessage(), 'Omeka Configuration Error');
+
} catch (Zend_Db_Adapter_Mysqli_Exception $e) {
- $message = $e->getMessage() .'.'."\n\n";
+ $message = $e->getMessage() . ".\n\n";
$message .= 'Confirm that the information in your db.ini file is correct.';
$this->_displayErrorPage($message, 'Omeka Database Error');
+
} catch (Omeka_Db_Migration_Exception $e) {
$title = 'Cannot Upgrade: Need to Upgrade to Omeka 1.2.1';
$message = 'You must upgrade to version 1.2.1 before continuing.'."\n\n";
$message .= 'Please consult the <a href="http://omeka.org/codex/Upgrading">Upgrading</a> page on the Omeka codex, and <a href="http://omeka.org/files/omeka-1.2.1.zip">Downlodad Omeka 1.2.1</a>';
$this->_displayErrorPage($message, $title);
+
} catch (Exception $e) {
- // No idea what this exception would be. Just start crying.
$this->_displayErrorPage($e);
}
exit;
}
/**
- * If magic_quotes has been enabled, then strip all slashes from the $_GET,
- * $_POST and $_REQUEST superglobals.
- *
- * @return void
- */
- public function sanitizeMagicQuotes()
- {
- if (get_magic_quotes_gpc()) {
- $_POST = $this->_stripSlashes($_POST);
- $_REQUEST = $this->_stripSlashes($_REQUEST);
- $_GET = $this->_stripSlashes($_GET);
- }
- }
-
- /**
* Display the generic error page for all otherwise-uncaught exceptions.
*/
public function run()
@@ -109,14 +86,13 @@ public function run()
/**
* Print an HTML page to display errors when starting the application.
*
- * @param string $message Error message to display.
* @param Exception $e
- * @return void
+ * @param string $title The title of the error page.
*/
private function _displayErrorPage($e, $title = null)
{
- if (($logger = $this->getBootstrap()->getResource('Logger')))
- {
+ $logger = $this->getBootstrap()->getResource('Logger');
+ if ($logger) {
$logger->log($e, Zend_Log::ERR);
} else {
error_log("Omeka fatal error: $e");
@@ -125,18 +101,4 @@ private function _displayErrorPage($e, $title = null)
header("HTTP/1.0 500 Internal Server Error");
require VIEW_SCRIPTS_DIR . '/error/index.php';
}
-
- /**
- * Strip slashes.
- *
- * Filters request superglobals in order to avoid problems with PHP's
- * magic_quotes setting.
- *
- * @param mixed $value
- * @return mixed
- */
- private function _stripSlashes($value)
- {
- return is_array($value) ? array_map(array($this, '_stripSlashes'), $value) : stripslashes($value);
- }
}
@@ -1,24 +1,15 @@
<?php
/**
- * @copyright Roy Rosenzweig Center for History and New Media, 2009-2010
- * @license http://www.gnu.org/licenses/gpl-3.0.txt
- * @package Omeka
- * @access private
+ * Omeka
+ *
+ * @copyright Copyright 2007-2012 Roy Rosenzweig Center for History and New Media
+ * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
*/
/**
- * Initializes Omeka's ACL
+ * Initializes Omeka's ACL.
*
- * @internal This implements Omeka internals and is not part of the public API.
- * @access private
- * @since 0.10 Plugins must use the 'define_acl' hook to modify ACL definitions.
- * @uses Zend_Acl
- * @todo ACL settings should be stored in the database. When ACL settings
- * are properly stored in a normalized database configuration, then this
- * method should populate a new Acl instance with those settings and store
- * that Acl object in a session for quick access.
- * @package Omeka
- * @copyright Roy Rosenzweig Center for History and New Media, 2009-2010
+ * @package Omeka\Application\Resource
*/
class Omeka_Application_Resource_Acl extends Zend_Application_Resource_ResourceAbstract
{
@@ -1,19 +1,15 @@
-<?php
+<?php
/**
- * @copyright Roy Rosenzweig Center for History and New Media, 2009-2010
- * @license http://www.gnu.org/licenses/gpl-3.0.txt
- * @package Omeka
- * @access private
+ * Omeka
+ *
+ * @copyright Copyright 2007-2012 Roy Rosenzweig Center for History and New Media
+ * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
*/
/**
* Authentication resource.
- *
- * @internal This implements Omeka internals and is not part of the public API.
- * @access private
- * @todo Should be combined with the CurrentUser resource.
- * @package Omeka
- * @copyright Roy Rosenzweig Center for History and New Media, 2009-2010
+ *
+ * @package Omeka\Application\Resource
*/
class Omeka_Application_Resource_Auth extends Zend_Application_Resource_ResourceAbstract
{
@@ -1,20 +1,15 @@
<?php
/**
- * @copyright Roy Rosenzweig Center for History and New Media, 2007-2010
- * @license http://www.gnu.org/licenses/gpl-3.0.txt
- * @package Omeka
- * @access private
+ * Omeka
+ *
+ * @copyright Copyright 2007-2012 Roy Rosenzweig Center for History and New Media
+ * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
*/
/**
* An application resource for class autoloaders.
- *
- * Autoloading is also currently handled by Zend_Loader_Autoloader's fallback loader.
- *
- * @internal This implements Omeka internals and is not part of the public API.
- * @access private
- * @package Omeka
- * @copyright Roy Rosenzweig Center for History and New Media, 2007-2010
+ *
+ * @package Omeka\Application\Resource
*/
class Omeka_Application_Resource_Autoloader extends Zend_Application_Resource_ResourceAbstract
{
@@ -24,9 +19,6 @@ class Omeka_Application_Resource_Autoloader extends Zend_Application_Resource_Re
* Set up autoloading of the following class types from the following
* directories:
* - {@link Omeka_Form}: forms/
- *
- * @todo [2.0] Add a namespace for models (Omeka_File or Omeka_Model_File?)
- * @return void
*/
public function init()
{
@@ -1,32 +1,29 @@
<?php
/**
- * @copyright Roy Rosenzweig Center for History and New Media, 2009-2012
- * @license http://www.gnu.org/licenses/gpl-3.0.txt
- * @package Omeka
- * @access private
+ * Omeka
+ *
+ * @copyright Copyright 2007-2012 Roy Rosenzweig Center for History and New Media
+ * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
*/
/**
* Core resource for configuring caches for use by other components.
- *
- * @package Omeka
+ *
+ * @package Omeka\Application\Resource
*/
-class Omeka_Application_Resource_Cachemanager extends Zend_Application_Resource_Cachemanager {
-
- /**
- * @return void
- */
+class Omeka_Application_Resource_Cachemanager extends Zend_Application_Resource_Cachemanager
+{
public function init()
{
$bootstrap = $this->getBootstrap();
$bootstrap->bootstrap('Config');
$config = $bootstrap->getResource('Config');
-
+
$cacheConfig = $config->cache;
if ($cacheConfig) {
$this->setOptions($cacheConfig->toArray());
}
-
+
return parent::init();
}
}
@@ -1,18 +1,15 @@
-<?php
+<?php
/**
- * @copyright Roy Rosenzweig Center for History and New Media, 2007-2010
- * @license http://www.gnu.org/licenses/gpl-3.0.txt
- * @package Omeka
- * @access private
+ * Omeka
+ *
+ * @copyright Copyright 2007-2012 Roy Rosenzweig Center for History and New Media
+ * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
*/
/**
* Load the default configuration file for Omeka.
- *
- * @internal This implements Omeka internals and is not part of the public API.
- * @access private
- * @package Omeka
- * @copyright Roy Rosenzweig Center for History and New Media, 2007-2010
+ *
+ * @package Omeka\Application\Resource
*/
class Omeka_Application_Resource_Config extends Zend_Application_Resource_ResourceAbstract
{
@@ -1,9 +1,9 @@
<?php
/**
- * @copyright Roy Rosenzweig Center for History and New Media, 2009-2010
- * @license http://www.gnu.org/licenses/gpl-3.0.txt
- * @package Omeka
- * @access private
+ * Omeka
+ *
+ * @copyright Copyright 2007-2012 Roy Rosenzweig Center for History and New Media
+ * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
*/
/**
@@ -12,10 +12,7 @@
* If the user record is not retrievable (invalid ID), then the authentication
* ID will be cleared.
*
- * @internal This implements Omeka internals and is not part of the public API.
- * @access private
- * @package Omeka
- * @copyright Roy Rosenzweig Center for History and New Media, 2009-2010
+ * @package Omeka\Application\Resource
*/
class Omeka_Application_Resource_Currentuser extends Zend_Application_Resource_ResourceAbstract
{
Oops, something went wrong.

0 comments on commit c0f652e

Please sign in to comment.