bludit/bl-plugins/tags/plugin.php

57 lines
1.2 KiB
PHP
Raw Normal View History

2015-08-29 07:02:09 +02:00
<?php
class pluginTags extends Plugin {
public function init()
{
$this->dbFields = array(
'label'=>'Tags'
2015-08-29 07:02:09 +02:00
);
}
public function form()
{
global $L;
2015-08-29 07:02:09 +02:00
2018-07-02 00:24:53 +02:00
$html = '<div class="alert alert-primary" role="alert">';
$html .= $this->description();
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Label').'</label>';
$html .= '<input id="jslabel" name="label" type="text" value="'.$this->getValue('label').'">';
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
$html .= '</div>';
2015-08-29 07:02:09 +02:00
return $html;
}
public function siteSidebar()
{
global $L;
2018-08-02 22:33:53 +02:00
global $tags;
global $url;
2015-08-29 07:02:09 +02:00
$filter = $url->filters('tag');
2015-08-30 01:26:46 +02:00
2015-08-29 07:02:09 +02:00
$html = '<div class="plugin plugin-tags">';
2018-08-02 22:33:53 +02:00
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
2015-08-29 07:02:09 +02:00
$html .= '<div class="plugin-content">';
$html .= '<ul>';
// By default the database of tags are alphanumeric sorted
2018-08-02 22:33:53 +02:00
foreach( $tags->db as $key=>$fields ) {
$html .= '<li>';
$html .= '<a href="'.DOMAIN_TAGS.$key.'">';
$html .= $fields['name'];
$html .= '</a>';
$html .= '</li>';
}
2015-08-29 07:02:09 +02:00
$html .= '</ul>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
2016-01-22 20:27:53 +01:00
}