Pastoid

The page you are looking at now is at this URL: http://pastoid.com/a2z

This paste was last updated on June 29, 2009 at 11:22 pm.

Pasted Coderaw

<?php
 
/**
 * 
 *
 * @version $Id$
 * @copyright 2009
 */
 
/** 
 * 
 *
 */
class Categories extends Plugin
{
/*
	function action_plugin_activation($file){
		if ( Plugins::id_from_file( $file ) == $this->plugin_id ) {
			$v = new Vocabulary(array(
				'name' => 'Categories',
				'description' => 'A basic hierarchical category system to associate to posts.',
				'feature_mask' => Vocabulary::feature_mask(true, false, true, false),
			));
			$v->insert();
		}
	}
 
	function action_plugin_deactivation($file){
		if ( Plugins::id_from_file( $file ) == $this->plugin_id ) {
			$v = Vocabulary::get('Categories');
			$v->delete();
		}		
	}
 
	public function help()
	{
		return <<< HELP
<p>This is help.  It is inadequate.</p>
HELP;
	}	
	*/
 
	public function filter_plugin_config( $actions, $plugin_id )
	{
		if ( $plugin_id == $this->plugin_id() ) {
			$actions['configure']= _t( 'Add Vocabularies' );
			$vs = Vocabulary::names();
			foreach($vs as $key => $name) {
				$actions['vocab_' . $key] = _t('Configure %s', array($name));
			}
		}
		return $actions;
	}
 
	public function action_plugin_ui( $plugin_id, $action )
	{
		if ( $plugin_id == $this->plugin_id() ) {
			if($action == 'configure') {
				$form = new FormUI('vocab');
				$form->append('text', 'new_vocab', 'null:null', _t('New Vocabulary Name'));
				$form->append('submit', 'submit', _t('Add Vocabulary'));
				$form->on_success(array($this, '_add_vocab'));
				$form->out();
			}
		}
	}
 
	public function _add_vocab($form)
	{
		$v = new Vocabulary(array(
			'name' => $form->new_vocab->value,
			'description' => 'A basic hierarchical category system to associate to posts.',
			'feature_mask' => Vocabulary::feature_mask(true, false, true, false),
		));
		$v->insert();
		Session::notice(_t('Added vocabulary "%s".', array($form->new_vocab->value)));
		return false;
	}
 
}
 
?>

Toggle wordwrap

Pasted Coderaw

<?xml version="1.0" encoding="utf-8" ?>
<pluggable type="plugin">
	<name>Categories</name>
	<license url="http://www.apache.org/licenses/LICENSE-2.0.html">Apache Software License 2.0</license>
 
	<author url="http://asymptomatic.net/">Owen Winkler</author>
 
	<version>0.1</version>
	<url>http://redalt.com/habari</url>
	<description><![CDATA[Allows assignment of one or more hierarchical categories to a post.]]></description>
 
	<copyright>2009</copyright>
 
	<provides>
		<feature>categories</feature>
	</provides>
 
	<help>
		<value><![CDATA[This is useless help]]></value>
	</help>
 
</pluggable>

Toggle wordwrap

Referring DomainHits
Unknown Referer 158
pastoid.com 6
search.live.com 1
Is this paste spam?
<Hide