-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshaarleed.plugin.disabled.php
71 lines (58 loc) · 2.6 KB
/
shaarleed.plugin.disabled.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/*
@name Shaarleed
@author Idleman <[email protected]>
@link http://blog.idleman.fr
@licence WTFPL
@version 3.0.2
@description Le plugin Shaarleed permet de partager un lien d'evenement directement sur son script <a target="_blank" href="http://sebsauvage.net/wiki/doku.php?id=php:shaarli">shaarli</a>
*/
function shaarleed_plugin_button(&$event){
$mysqli = new MysqlEntity();
$configurationManager = new Configuration();
$configurationManager->getAll();
$shareOption = $configurationManager->get('plugin_shaarli_link');
$requete = 'SELECT link, title FROM `'.MYSQL_PREFIX.'event` WHERE id = '.$event->getId();
$query = $mysqli->customQuery($requete);
$result = $query->fetch_row();
$link = $result[0];
$title = $result[1];
echo '
<a title="'._t('P_SHARLEED_SHARE_WITH_SHAARLI').'" target="_blank" href="'.$shareOption.'?post='.rawurlencode($link).'&title='.$title.'&source=bookmarklet">'._t('P_SHARLEED_SHAARLI_EXCLAMATION').'</a>
';
}
function shaarleed_plugin_setting_link(&$myUser){
echo '<li><a class="toggle" href="#shaarli">'._t('P_SHARLEED_SHAARLI_EXCLAMATION').'</a></li>';
}
function shaarleed_plugin_setting_bloc(&$myUser){
$configurationManager = new Configuration();
$configurationManager->getAll();
echo '
<section id="shaarli" name="shaarli" class="shaarli">
<form action="action.php?action=shaarleed_update" method="POST">
<h2>'._t('P_SHARLEED_PLUGIN_TITLE').'</h2>
<p class="shaarliBlock">
<label for="plugin_shaarli_link">'._t('P_SHARLEED_SHAARLI_LINK').'</label>
<input style="width:50%;" type="text" placeholder="http://mon.domaine.com/shaarli/" value="'.$configurationManager->get('plugin_shaarli_link').'" id="plugin_shaarli_link" name="plugin_shaarli_link" />
<input type="submit" class="button" value="'._t('P_SHARLEED_SAVE').'"><br/>
</p>
<strong>'._t('P_SHARLEED_NB').'</strong> '._t('P_SHARLEED_NB_INFO').'
</form>
</section>
';
}
function shaarleed_plugin_update($_){
$myUser = (isset($_SESSION['currentUser'])?unserialize($_SESSION['currentUser']):false);
if($myUser===false) exit(_t('P_SHARLEED_CONNECTION_ERROR'));
if($_['action']=='shaarleed_update'){
$configurationManager = new Configuration();
$configurationManager->put('plugin_shaarli_link',$_['plugin_shaarli_link']);
$_SESSION['configuration'] = null;
header('location: settings.php');
}
}
Plugin::addHook('event_post_top_options', 'shaarleed_plugin_button');
Plugin::addHook('setting_post_link', 'shaarleed_plugin_setting_link');
Plugin::addHook('setting_post_section', 'shaarleed_plugin_setting_bloc');
Plugin::addHook("action_post_case", "shaarleed_plugin_update");
?>