All pastes #938721 Raw Edit

plugin class methods

public php v1 · immutable
·published 2008-03-11 20:44 UTC
rendered paste body
public function theme_showblogroll( $theme ){	//read plugin options	$theme->blogroll_title= Options::get( strtolower( get_class( $this ) ) . ':title' );	$links= Options::get( strtolower( get_class( $this ) ) . ':links' );	$max= Options::get( strtolower( get_class( $this ) ) . ':max');	$randomize= Options::get( strtolower( get_class ( $this ) ) . ':random' );		//set default values if options not set	if ( empty( $max ) ) $max= 6;	if ( empty( $random ) ) $random= false ;	if (!isset($theme->blogroll_title)) $theme->blogroll_title='Blogroll';		if ( $randomize ) shuffle( $links );		$theme->blogroll_links= array();	foreach( $links as $link )	{			$link= strip_tags($link);		$props= explode( '|', $link );		if ( !isset( $props[2] ) ) {			$props[2]= '';		}				$theme->blogroll_links[]= array( 'title'=>$props[0], 'url'=>$props[1], 'rel'=>$props[2] );		if ( $max != 0 ) {			if ( $max <= 1 ) break;			$max--;		}	}	#Utils::debug($theme->blogroll_links);	return $theme->fetch( 'blogroll' );	}public function action_init(){	$this->add_template('blogroll', dirname(__FILE__) . '\blogroll.php');}/*-----------Template----------*/<!-- To customize this template, copy it to your currently active theme directory and edit it --><div id="blogroll">	<h2><?php echo $blogroll_title; ?></h2>	<ul>	<?php utils::debug($blogroll_links); ?>	<?php foreach ( $blogroll_links as $item ) : ?>		<li><a href="<?php echo $item['url']; ?>" title="<?php echo $item['title']; ?>" rel="<?php echo $itme['rel']; ?>"><?php echo $item->title; ?></a></li>	<?php endforeach; ?>	</ul></div>