*

* * * */ class Colophon extends Plugin { const VERSION= '0.2'; /** * Required plugin information * @return array The array of information */ function info() { return array( 'name' => 'Colophon Plugin', 'version' => self::VERSION, 'url' => 'http://github.com/stan/habari-plugins/tree/master', 'author' => 'stanislas mazurek', 'authorurl' => 'http://stanbar.jp', 'licence' => 'Apache licence 2.0', 'description' => 'Adds an About / Colophon to your blog' ); } /** * Add actions to the plugin page for this plugin * @param array $actions An array of actions to apply to this plugin * @param string $plugin_id The string with the plugin id, generated by the system * @return array $actions Array of actions to atach to the specified $plugin_id */ public function filter_plugin_config($actions,$plugin_id) { if( $plugin_id == $this->plugin_id()) { $actions[] = _t('Configure'); } return $actions; } /** * Method that responds to the user selecting an action on the plugin page * @param string $plugin_id String containning the id of the plugin * @param string $action The action string suplied via the filter_plugin_config hook **/ public function action_plugin_ui( $plugin_id, $action ) { if ( $plugin_id == $this->plugin_id() ) { switch( $action ) { case _t('Configure'): $ui = new FormUI ( strtolower( get_class( $this ) ) ); $colophontitle = $ui->add('text','colophon_title',_t('Enter your Title:')); $colophontext = $ui->add('textarea','colophon_text',_t('Enter your Text:')); $ui->on_success( array( $this, 'updated_config' ) ); $ui->out(); break; } } } /** * Assigns output code to the template variables * @param Theme $theme The theme that will display the template */ function action_add_template_vars( $theme ) { $theme->colophon = Format::autop(Options::get( 'colophon:colophon_text' )); $theme->colophon_title = Options::get( 'colophon:colophon_title' ); } /** * Returns true if plugin config form values defined in action_plugin_ui whould be stored by habari * @return bool True if options should be stored */ public function updated_config($ui) { return true; } } ?>