toAttribute($this->get('fb_title'));
}
$ret = $tp->toHTML($this->get('fb_title'), false, 'TITLE');
if(isset($parm['url']) && $this->get('fb_imageurl'))
{
return ''.$ret.'';
}
return $ret;
}
/**
* Parameter list (GET string format):
* - text: used if href is true
* - href (1/0): return only URL if false, else return tag
* - rel: rel tag attribute
*
* @param string $parm
* @return string
*/
public function sc_featurebox_url($parm = '')
{
$tp = e107::getParser();
$url = $tp->replaceConstants($this->get('fb_imageurl'), 'full');
if(empty($url)) return '';
parse_str($parm, $parm);
if(!vartrue($parm['href']))
{
return $tp->replaceConstants($url);
}
$title = vartrue($parm['text']) ? defset($parm['text']) : FBLAN_02;
$alt = $tp->toAttribute($this->get('fb_title'), false, 'TITLE');
return ''.$title.'';
}
public function sc_featurebox_text()
{
return e107::getParser()->toHTML($this->get('fb_text'), true, 'BODY');
}
/**
* Parameter list (GET string format):
* - src: return image src URL only
* - nourl: force no url tag
*
* @param string $parm
* @return string
*/
public function sc_featurebox_image($parm = '')
{
if(!$this->get('fb_image'))
{
return '';
}
parse_str($parm, $parm);
$tp = e107::getParser();
$src = $tp->replaceConstants($this->get('fb_image'), 'full');
if(isset($parm['src']))
{
return $src;
}
$tag = '';
if(isset($parm['nourl']) || !$this->get('fb_imageurl'))
{
return $tag;
}
return ''.$tag.'';
}
public function sc_featurebox_thumb($parm='')
{
if(!$this->get('fb_image'))
{
return '';
}
$att = ($parm) ?$parm : 'aw=100&ah=60';
return e107::getParser()->thumbUrl($this->get('fb_image'),$att);
}
/**
* Item counter number (starting from 1)
*/
public function sc_featurebox_counter()
{
return $this->getParam('counter', 1);
}
/**
* Item limit number
*/
public function sc_featurebox_limit()
{
return $this->getParam('limit', 0);
}
/**
* Number of items (real) currently loaded
*/
public function sc_featurebox_total()
{
return $this->getParam('total', 0);
}
/**
* Total Number of items (no matter of the limit)
*/
public function sc_featurebox_all()
{
return $this->getCategory()->sc_featurebox_category_all();
}
/**
* Number of items per column
*/
public function sc_featurebox_cols()
{
return $this->getParam('cols', 1);
}
/**
* Item counter number inside a column (1 to sc_featurebox_cols)
*/
public function sc_featurebox_colcount()
{
return $this->getParam('col_counter', 1);
}
/**
* Column counter
*/
public function sc_featurebox_colscount()
{
return $this->getParam('cols_counter', 1);
}
/**
* Set current category
* @param plugin_featurebox_category $category
* @return plugin_featurebox_item
*/
public function setCategory($category)
{
$this->_category = $category;
return $this;
}
/**
* Get Category model instance
* @return plugin_featurebox_category
*/
public function getCategory()
{
if(null === $this->_category)
{
$this->_category = new plugin_featurebox_category();
$this->_category->load($this->get('fb_category'));
}
return $this->_category;
}
/**
* Magic call - category shortcodes
*
* @param string $method
* @param array $arguments
*/
public function __call($method, $arguments)
{
if (strpos($method, "sc_featurebox_") === 0)
{
return call_user_func_array(array($this->getCategory(), $method), $arguments);
}
}
}