X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=plugins%2Fdemo_plugin%2Fdemo_plugin.php;h=defb01f7e4457d05f95f0f95e939297300033904;hb=99ab4f148ba6711883c44425a149a623eff6295f;hp=ca520d15147ce937302eb99d0a15c38c1721e2fb;hpb=1004742f09b55ff781c13745781b9a7e90986faa;p=github%2Fshaarli%2FShaarli.git
diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php
index ca520d15..defb01f7 100644
--- a/plugins/demo_plugin/demo_plugin.php
+++ b/plugins/demo_plugin/demo_plugin.php
@@ -2,8 +2,8 @@
/**
* Demo Plugin.
*
- * This plugin try to cover Shaarli's plugin API entirely.
- * Can be used by plugin developper to make their own.
+ * This plugin tries to completely cover Shaarli's plugin API.
+ * Can be used by plugin developers to make their own plugin.
*/
/*
@@ -15,6 +15,8 @@
*/
use Shaarli\Config\ConfigManager;
+use Shaarli\Plugin\PluginManager;
+use Shaarli\Render\TemplatePage;
/**
* In the footer hook, there is a working example of a translation extension for Shaarli.
@@ -59,7 +61,7 @@ function demo_plugin_init($conf)
/**
* Hook render_header.
- * Executed on every page redering.
+ * Executed on every page render.
*
* Template placeholders:
* - buttons_toolbar
@@ -72,7 +74,7 @@ function demo_plugin_init($conf)
function hook_demo_plugin_render_header($data)
{
// Only execute when linklist is rendered.
- if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) {
+ if ($data['_PAGE_'] == TemplatePage::LINKLIST) {
// If loggedin
if ($data['_LOGGEDIN_'] === true) {
/*
@@ -116,7 +118,7 @@ function hook_demo_plugin_render_header($data)
$form = array(
'attr' => array(
'method' => 'GET',
- 'action' => '?',
+ 'action' => $data['_BASE_PATH_'] . '/',
'class' => 'addform',
),
'inputs' => array(
@@ -143,7 +145,7 @@ function hook_demo_plugin_render_header($data)
/**
* Hook render_includes.
- * Executed on every page redering.
+ * Executed on every page render.
*
* Template placeholders:
* - css_files
@@ -167,7 +169,7 @@ function hook_demo_plugin_render_includes($data)
/**
* Hook render_footer.
- * Executed on every page redering.
+ * Executed on every page render.
*
* Template placeholders:
* - text
@@ -184,7 +186,7 @@ function hook_demo_plugin_render_includes($data)
*/
function hook_demo_plugin_render_footer($data)
{
- // footer text
+ // Footer text
$data['text'][] = '
'. demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.');
// Free elements at the end of the page.
@@ -275,7 +277,7 @@ function hook_demo_plugin_render_editlink($data)
// Load HTML into a string
$html = file_get_contents(PluginManager::$PLUGINS_PATH .'/demo_plugin/field.html');
- // replace value in HTML if it exists in $data
+ // Replace value in HTML if it exists in $data
if (!empty($data['link']['stuff'])) {
$html = sprintf($html, $data['link']['stuff']);
} else {
@@ -322,9 +324,7 @@ function hook_demo_plugin_render_tools($data)
*/
function hook_demo_plugin_render_picwall($data)
{
- // plugin_start_zone
$data['plugin_start_zone'][] = '