Skip to content

Commit

Permalink
isso plugin: todo
Browse files Browse the repository at this point in the history
Done: won't work because of isso-comments/isso#27
Waiting for an eventual fix.
  • Loading branch information
ArthurHoaro committed Aug 22, 2015
1 parent 89f9004 commit 5670545
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/isso/config.php.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

$GLOBALS['plugins']['ISSO_SERVER'] = '';
16 changes: 16 additions & 0 deletions plugins/isso/isso.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script data-isso="//%s/"
data-isso-css="true"
data-isso-lang="fr"
data-isso-reply-to-self="true"
data-isso-max-comments-top="20"
data-isso-max-comments-nested="5"
data-isso-reveal-on-click="5"
data-isso-avatar="true"
data-isso-avatar-bg="#f0f0f0"
data-isso-avatar-fg="#9abf88 #5698c4 #e279a3 #9163b6 ..."
data-isso-vote="true"
data-isso-id="%s"
src="//%s/js/embed.min.js">
</script>
<section id="isso-thread"></section>

37 changes: 37 additions & 0 deletions plugins/isso/isso.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

// don't raise unnecessary warnings
if (is_file(PluginManager::$PLUGINS_PATH . '/isso/config.php')) {
include PluginManager::$PLUGINS_PATH . '/isso/config.php';
}

if (!isset($GLOBALS['plugins']['ISSO_SERVER'])) {
header('Content-Type: text/plain; charset=utf-8');
echo 'Isso plugin error: '. PHP_EOL;
echo ' Please copy "plugins/isso/config.php.dist" to config.php and configure your isso server URL.'. PHP_EOL;
echo ' You can also define "$GLOBALS[\'plugins\'][\'ISSO_SERVER\']" in your global Shaarli config.php file.';
exit;
}

function hook_isso_render_linklist($data)
{
// Only execute when linklist is rendered.
if (!empty($data['search_type']) && $data['search_type'] == 'permalink'
&& count($data['links']) == 1) {

$isso_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/isso/isso.html');

// data-isso-id is broken. This plugin is useless until it's fixed.
// https://github.com/posativ/isso/issues/27 (2013!)
$link = reset($data['links']);
$isso = sprintf(
$isso_html,
$GLOBALS['plugins']['ISSO_SERVER'],
$link['linkdate'],
$GLOBALS['plugins']['ISSO_SERVER']
);
$data['plugin_end_zone'][] = $isso;
}

return $data;
}

0 comments on commit 5670545

Please sign in to comment.