From 2e0daff0943da1da6c266d4aff793863ec9a23f1 Mon Sep 17 00:00:00 2001 From: Patrick Murray-John Date: Mon, 6 Feb 2012 11:07:16 -0500 Subject: [PATCH] Bugfixes. updates .ini --- CommentingPlugin.php | 151 ------------------------------------------- plugin.ini | 7 +- 2 files changed, 4 insertions(+), 154 deletions(-) diff --git a/CommentingPlugin.php b/CommentingPlugin.php index bbbdd9e..db60503 100644 --- a/CommentingPlugin.php +++ b/CommentingPlugin.php @@ -1,156 +1,5 @@ - * array('option_name1' => 'option_default_value1', - * 'option_name2' => 'option_default_value2', - * 'option_name3', - * 'option_name4') - * - * - * @var array - */ - protected $_options; - - /** - * Construct the plugin object. - * - * Sets the database object. Plugin authors must call parent::__construct() - * in the child class's constructor, if used. - */ - public function __construct() - { - $this->_db = Omeka_Context::getInstance()->getDb(); - } - - /** - * Set up the plugin to hook into Omeka. - * - * Adds the plugin's hooks and filters. Plugin writers must call this method - * after instantiating their plugin class. - */ - public function setUp() - { - $this->_addHooks(); - $this->_addFilters(); - } - - /** - * Set options with default values. - * - * Plugin authors may want to use this convenience method in their install - * hook callback. - */ - protected function _installOptions() - { - $options = $this->_options; - if (!is_array($options)) { - return; - } - foreach ($options as $name => $value) { - // Don't set options without default values. - if (!is_string($name)) { - continue; - } - set_option($name, $value); - } - } - - /** - * Delete all options. - * - * Plugin authors may want to use this convenience method in their uninstall - * hook callback. - */ - protected function _uninstallOptions() - { - $options = self::$_options; - if (!is_array($options)) { - return; - } - foreach ($options as $name => $value) { - delete_option($name); - } - } - - /** - * Validate and add hooks. - */ - private function _addHooks() - { - $hookNames = $this->_hooks; - if (!is_array($hookNames)) { - return; - } - foreach ($hookNames as $hookName) { - $functionName = 'hook' . Inflector::camelize($hookName); - if (!is_callable(array($this, $functionName))) { - throw new Omeka_Plugin_Exception('Hook callback "' . $functionName . '" does not exist.'); - } - add_plugin_hook($hookName, array($this, $functionName)); - } - } - - /** - * Validate and add filters. - */ - private function _addFilters() - { - $filterNames = $this->_filters; - if (!is_array($filterNames)) { - return; - } - foreach ($filterNames as $filterName) { - $functionName = 'filter' . Inflector::camelize($filterName); - if (!is_callable(array($this, $functionName))) { - throw new Omeka_Plugin_Exception('Filter callback "' . $functionName . '" does not exist.'); - } - add_filter($filterName, array($this, $functionName)); - } - } - } - -} - class CommentingPlugin extends Omeka_Plugin_Abstract { diff --git a/plugin.ini b/plugin.ini index 6a9e1d2..f44980b 100644 --- a/plugin.ini +++ b/plugin.ini @@ -2,7 +2,8 @@ name="Commenting" description="Allows commenting on Items, Collections, Exhibits, and more" version="1.0" -link="" -support_link="" -license="GPL" +support_link="http://omeka.org/forums/forum/plugins" +link="http://omeka.org/codex/Plugins/Commenting +omeka_minimum_version="1.5" +license="GPLv3" omeka_target_version="1.5"