commentSpice:

* Reload rss if homepage url changes
* Configure max entries loaded from rss
* Beautifying inputs and descriptions
This commit is contained in:
Grischa Brockhaus 2012-01-21 16:10:06 +01:00
parent 4e54ddcd6d
commit 595bd262f7
10 changed files with 106 additions and 25 deletions

View file

@ -1,10 +1,23 @@
<?php <?php
@define('PLUGIN_EVENT_COMMENTSPICE_TITLE', 'Comment Spice'); @define('PLUGIN_EVENT_COMMENTSPICE_TITLE', 'Comment Spice');
@define('PLUGIN_EVENT_COMMENTSPICE_DESC', 'Würze Deinen Kommentarbereich mit Extras wie einem Twitterlink oder einem Link auf den letzten Artikel des Kommentators.'); @define('PLUGIN_EVENT_COMMENTSPICE_DESC', 'Würze Deinen Kommentarbereich mit Extras wie einem Twitterlink oder einem Link auf den letzten Artikel des Kommentators.');
@define('PLUGIN_EVENT_COMMENTSPICE_EXPERIMENTAL', 'comment spice experimentell');
@define('PLUGIN_EVENT_COMMENTSPICE_TWITTERINPUT', 'Erlaube Kommentatoren, ihren Twitternamen anzugeben');
@define('PLUGIN_EVENT_COMMENTSPICE_TWITTERINPUT_DESC', 'Hiermit erlaubst Du einem Kommentator, mit ihrem Kommentar auch ihren Twitternamen anzugeben. Wenn er dies tut, so wird seine Twitter Timeline mit seinem Kommentar verlinkt.');
@define('PLUGIN_EVENT_COMMENTSPICE_TWITTERINPUT_NOFOLLOW', 'Twitterlink auf nofollow setzen');
@define('PLUGIN_EVENT_COMMENTSPICE_TWITTERINPUT_NOFOLLOW_DESC', 'Wenn der Twitterlink auf nofollow gesetzt wird, werden Suchmaschinen ihn ignorieren. Dies macht die Eingabe für manuelle Kommentarspammer uninteressant, gibt aber weniger Kudos an den echten Kommentator.');
@define('PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS', 'Erlaube Kommentatoren, einen ihrer Artikel zu bewerben');
@define('PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS_DESC', 'Wenn der Kommentator eine Homepage eingegeben hat, wird CommentSpice die URL nach einem RSS feed durchsuchen. Wenn einer gefunden wurde, kann der Kommentator einen seiner Artikel aussuchen, der dann mit seinem Kommentar beworben wird.');
@define('PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS_NOFOLLOW', 'Artikel Bewerbung auf nofollow setzen');
@define('PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS_NOFOLLOW_DESC', 'Wenn die Artikel Bewerbung auf nofollow gesetzt wird, werden Suchmaschinen ihn ignorieren. Dies macht die Eingabe für manuelle Kommentarspammer uninteressant, gibt aber weniger Kudos an den echten Kommentator.');
@define('PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS_MAXSELECT', 'Maximale Artikel Anzahl, aus der beworben werden darf');
@define('PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS_MAXSELECT_DESC', 'Wie viele seiner neuesten Artikel sollen dem Kommentator maximal zu Auswahl vorgelegt werden?');
@define('PLUGIN_EVENT_COMMENTSPICE_PATH', 'Plugin Pfad');
@define('PLUGIN_EVENT_COMMENTSPICE_PATH_DESC', 'In normalen Installationen ist der Default die korrekte Einstellung.');
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER', 'Auf Twitter lesen'); @define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER', 'Auf Twitter lesen');
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER_FOOTER', 'Wenn Du Deinen <b>Twitter Namen</b> eingibst wird Deine Timeline in Deinem Kommentar verlinkt.'); @define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER_FOOTER', 'Wenn Du Deinen <b>Twitter Namen</b> eingibst wird Deine Timeline in Deinem Kommentar verlinkt.');
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER_PLACEHOLDER', 'Dein Twittername');
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_CHOOSE', '- Bewirb einen Deiner letzten Artikel -'); @define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_CHOOSE', '- Bewirb einen Deiner letzten Artikel -');
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_RESCENT', '%s schrieb auch'); @define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_RESCENT', '%s schrieb auch');

View file

@ -1,11 +1,13 @@
var inputComentUrl = document.getElementById("serendipity_commentform_url"); var inputComentUrl = document.getElementById("serendipity_commentform_url");
var inputComentText = document.getElementById("serendipity_commentform_comment"); var inputComentText = document.getElementById("serendipity_commentform_comment");
var lastUrlChecked = null;
function fetch_rss() { function fetch_rss() {
var url = inputComentUrl.value; var url = inputComentUrl.value;
if(!url.match(/^http/)) return; if(!url.match(/^http/)) return;
if (url == lastUrlChecked) return;
var divSelectRss = document.getElementById("serendipity_commentspice_rss"); var divSelectRss = document.getElementById("serendipity_commentspice_rss");
if (divSelectRss.style.display!='none') return; // allready done //if (divSelectRss.style.display!='none') return; // allready done
if (window.XMLHttpRequest) { // Mozilla, Safari, Opera, IE7 if (window.XMLHttpRequest) { // Mozilla, Safari, Opera, IE7
httpRequest = new XMLHttpRequest(); httpRequest = new XMLHttpRequest();
@ -28,8 +30,10 @@ function fetch_rss_ready(httpRequest){
var jsonResponse = eval('(' + response + ')'); var jsonResponse = eval('(' + response + ')');
var divSelectRss = document.getElementById("serendipity_commentspice_rss"); var divSelectRss = document.getElementById("serendipity_commentspice_rss");
var selectRss = document.getElementById("serendipity_commentform_rss"); var selectRss = document.getElementById("serendipity_commentform_rss");
for (idx in jsonResponse) { var articles = jsonResponse.articles;
var article = jsonResponse[idx]; selectRss.options.length = 0;
for (idx in articles) {
var article = articles[idx];
var option = document.createElement('option'); var option = document.createElement('option');
option.text = article.title; option.text = article.title;
option.value = article.url; option.value = article.url;
@ -41,6 +45,7 @@ function fetch_rss_ready(httpRequest){
} }
} }
divSelectRss.style.display=''; divSelectRss.style.display='';
lastUrlChecked = jsonResponse.url;
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 927 B

View file

@ -1,10 +1,23 @@
<?php <?php
@define('PLUGIN_EVENT_COMMENTSPICE_TITLE', 'Comment Spice'); @define('PLUGIN_EVENT_COMMENTSPICE_TITLE', 'Comment Spice');
@define('PLUGIN_EVENT_COMMENTSPICE_DESC', 'Würze Deinen Kommentarbereich mit Extras wie einem Twitterlink oder einem Link auf den letzten Artikel des Kommentators.'); @define('PLUGIN_EVENT_COMMENTSPICE_DESC', 'Würze Deinen Kommentarbereich mit Extras wie einem Twitterlink oder einem Link auf den letzten Artikel des Kommentators.');
@define('PLUGIN_EVENT_COMMENTSPICE_EXPERIMENTAL', 'comment spice experimentell');
@define('PLUGIN_EVENT_COMMENTSPICE_TWITTERINPUT', 'Erlaube Kommentatoren, ihren Twitternamen anzugeben');
@define('PLUGIN_EVENT_COMMENTSPICE_TWITTERINPUT_DESC', 'Hiermit erlaubst Du einem Kommentator, mit ihrem Kommentar auch ihren Twitternamen anzugeben. Wenn er dies tut, so wird seine Twitter Timeline mit seinem Kommentar verlinkt.');
@define('PLUGIN_EVENT_COMMENTSPICE_TWITTERINPUT_NOFOLLOW', 'Twitterlink auf nofollow setzen');
@define('PLUGIN_EVENT_COMMENTSPICE_TWITTERINPUT_NOFOLLOW_DESC', 'Wenn der Twitterlink auf nofollow gesetzt wird, werden Suchmaschinen ihn ignorieren. Dies macht die Eingabe für manuelle Kommentarspammer uninteressant, gibt aber weniger Kudos an den echten Kommentator.');
@define('PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS', 'Erlaube Kommentatoren, einen ihrer Artikel zu bewerben');
@define('PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS_DESC', 'Wenn der Kommentator eine Homepage eingegeben hat, wird CommentSpice die URL nach einem RSS feed durchsuchen. Wenn einer gefunden wurde, kann der Kommentator einen seiner Artikel aussuchen, der dann mit seinem Kommentar beworben wird.');
@define('PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS_NOFOLLOW', 'Artikel Bewerbung auf nofollow setzen');
@define('PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS_NOFOLLOW_DESC', 'Wenn die Artikel Bewerbung auf nofollow gesetzt wird, werden Suchmaschinen ihn ignorieren. Dies macht die Eingabe für manuelle Kommentarspammer uninteressant, gibt aber weniger Kudos an den echten Kommentator.');
@define('PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS_MAXSELECT', 'Maximale Artikel Anzahl, aus der beworben werden darf');
@define('PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS_MAXSELECT_DESC', 'Wie viele seiner neuesten Artikel sollen dem Kommentator maximal zu Auswahl vorgelegt werden?');
@define('PLUGIN_EVENT_COMMENTSPICE_PATH', 'Plugin Pfad');
@define('PLUGIN_EVENT_COMMENTSPICE_PATH_DESC', 'In normalen Installationen ist der Default die korrekte Einstellung.');
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER', 'Auf Twitter lesen'); @define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER', 'Auf Twitter lesen');
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER_FOOTER', 'Wenn Du Deinen <b>Twitter Namen</b> eingibst wird Deine Timeline in Deinem Kommentar verlinkt.'); @define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER_FOOTER', 'Wenn Du Deinen <b>Twitter Namen</b> eingibst wird Deine Timeline in Deinem Kommentar verlinkt.');
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER_PLACEHOLDER', 'Dein Twittername');
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_CHOOSE', '- Bewirb einen Deiner letzten Artikel -'); @define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_CHOOSE', '- Bewirb einen Deiner letzten Artikel -');
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_RESCENT', '%s schrieb auch'); @define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_RESCENT', '%s schrieb auch');

View file

@ -1,7 +1,6 @@
<?php <?php
@define('PLUGIN_EVENT_COMMENTSPICE_TITLE', 'Comment Spice'); @define('PLUGIN_EVENT_COMMENTSPICE_TITLE', 'Comment Spice');
@define('PLUGIN_EVENT_COMMENTSPICE_DESC', 'Spice up your comments area with goodies like commenters twitter or last posted article link.'); @define('PLUGIN_EVENT_COMMENTSPICE_DESC', 'Spice up your comments area with goodies like commenters twitter or last posted article link.');
@define('PLUGIN_EVENT_COMMENTSPICE_EXPERIMENTAL', 'comment spice experimental');
@define('PLUGIN_EVENT_COMMENTSPICE_TWITTERINPUT', 'Allow commentors to add their twitter name'); @define('PLUGIN_EVENT_COMMENTSPICE_TWITTERINPUT', 'Allow commentors to add their twitter name');
@define('PLUGIN_EVENT_COMMENTSPICE_TWITTERINPUT_DESC', 'If you enable this, commenters are allowed to enter their twitter names and their twitter timeline will be linked to the comment.'); @define('PLUGIN_EVENT_COMMENTSPICE_TWITTERINPUT_DESC', 'If you enable this, commenters are allowed to enter their twitter names and their twitter timeline will be linked to the comment.');
@ -18,6 +17,7 @@
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER', 'Read on twitter'); @define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER', 'Read on twitter');
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER_FOOTER', 'If you enter your <b>twitter name</b>, your timeline will get linked to your comment.'); @define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER_FOOTER', 'If you enter your <b>twitter name</b>, your timeline will get linked to your comment.');
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER_PLACEHOLDER', 'your twittername');
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_CHOOSE', '- Promote one of your rescent articles -'); @define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_CHOOSE', '- Promote one of your rescent articles -');
@define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_RESCENT', '%s wrote about'); @define('PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_RESCENT', '%s wrote about');

View file

@ -15,7 +15,7 @@ include dirname(__FILE__) . '/lang_en.inc.php';
require_once dirname(__FILE__) . '/DbSpice.class.php'; require_once dirname(__FILE__) . '/DbSpice.class.php';
require_once dirname(__FILE__) . '/json/json.php4.include.php'; require_once dirname(__FILE__) . '/json/json.php4.include.php';
@define('PLUGIN_EVENT_COMMENTSPICE_DEBUG', TRUE); @define('PLUGIN_EVENT_COMMENTSPICE_DEBUG', FALSE);
class serendipity_event_commentspice extends serendipity_event class serendipity_event_commentspice extends serendipity_event
{ {
@ -33,9 +33,8 @@ class serendipity_event_commentspice extends serendipity_event
'smarty' => '2.6.7', 'smarty' => '2.6.7',
'php' => '4.1.0' 'php' => '4.1.0'
)); ));
$propbag->add('version', '0.1'); $propbag->add('version', '1.0');
$propbag->add('event_hooks', array( $propbag->add('event_hooks', array(
// 'frontend_header' => true,
'frontend_footer' => true, 'frontend_footer' => true,
'frontend_comment' => true, 'frontend_comment' => true,
'frontend_display' => true, 'frontend_display' => true,
@ -43,9 +42,10 @@ class serendipity_event_commentspice extends serendipity_event
'frontend_saveComment_finish' => true, 'frontend_saveComment_finish' => true,
'backend_deletecomment' => true, 'backend_deletecomment' => true,
'external_plugin' => true, 'external_plugin' => true,
'css' => true,
)); ));
$propbag->add('groups', array('FRONTEND_VIEWS')); $propbag->add('groups', array('FRONTEND_VIEWS'));
$propbag->add('configuration', array('twitterinput','twitterinput_nofollow', 'announcerss', 'announcerss_nofollow','plugin_path')); $propbag->add('configuration', array('twitterinput','twitterinput_nofollow', 'announcerss', 'announcerssmax','announcerss_nofollow','plugin_path'));
} }
function generate_content(&$title) { function generate_content(&$title) {
@ -88,7 +88,7 @@ class serendipity_event_commentspice extends serendipity_event
$propbag->add('type', 'string'); $propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS_MAXSELECT); $propbag->add('name', PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS_MAXSELECT);
$propbag->add('description', PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS_MAXSELECT_DESC); $propbag->add('description', PLUGIN_EVENT_COMMENTSPICE_ANNOUNCE_RSS_MAXSELECT_DESC);
$propbag->add('default', false); $propbag->add('default', 3);
return true; return true;
case 'plugin_path': case 'plugin_path':
@ -110,13 +110,17 @@ class serendipity_event_commentspice extends serendipity_event
switch($event) { switch($event) {
case 'external_plugin': case 'external_plugin':
switch($eventData) { switch($eventData) {
case 'spicetwitter.png': case 'spiceicotwitter.png':
header('Content-Type: image/png'); header('Content-Type: image/png');
echo file_get_contents(dirname(__FILE__). '/img/twitter.png'); echo file_get_contents(dirname(__FILE__). '/img/twitter_icon.png');
break; break;
case 'spicetwittersmall.png': case 'spiceicorss.png':
header('Content-Type: image/png'); header('Content-Type: image/png');
echo file_get_contents(dirname(__FILE__). '/img/twitter_small.png'); echo file_get_contents(dirname(__FILE__). '/img/rss_icon.png');
break;
case 'commentspice.png':
header('Content-Type: image/png');
echo file_get_contents(dirname(__FILE__). '/img/commentspice.png');
break; break;
case 'commentspicefrss': case 'commentspicefrss':
if (!serendipity_db_bool($this->get_config('announcerss', false))) break; if (!serendipity_db_bool($this->get_config('announcerss', false))) break;
@ -130,7 +134,6 @@ class serendipity_event_commentspice extends serendipity_event
case 'frontend_saveComment_finish' : case 'frontend_saveComment_finish' :
$this->commentSaved($eventData, $addData); $this->commentSaved($eventData, $addData);
break; break;
//case 'frontend_header':
case 'frontend_footer': case 'frontend_footer':
$this->printHeader(); $this->printHeader();
break; break;
@ -143,6 +146,9 @@ class serendipity_event_commentspice extends serendipity_event
case 'backend_deletecomment' : case 'backend_deletecomment' :
$this->commentDeleted($eventData, $addData); $this->commentDeleted($eventData, $addData);
break; break;
case 'css':
$this->writeCss($eventData, $addData);
break;
default: default:
return false; return false;
break; break;
@ -157,6 +163,10 @@ class serendipity_event_commentspice extends serendipity_event
} }
function cleanup() { function cleanup() {
DbSpice::install($this); DbSpice::install($this);
$announcerssmax = $this->get_config('announcerssmax',3);
if (!is_numeric($announcerssmax)) {
$this->set_config('announcerssmax',3);
}
} }
function printHeader() { function printHeader() {
global $serendipity; global $serendipity;
@ -278,7 +288,7 @@ class serendipity_event_commentspice extends serendipity_event
$articles[] = $article; $articles[] = $article;
$itemCount = 0; $itemCount = 0;
$maxItems = 3; $maxItems = $announcerssmax = $this->get_config('announcerssmax',3);
// Iterate the items // Iterate the items
while ($item = $rss->getNextItem()) { while ($item = $rss->getNextItem()) {
if ($itemCount>=$maxItems) break; if ($itemCount>=$maxItems) break;
@ -290,8 +300,9 @@ class serendipity_event_commentspice extends serendipity_event
$itemCount++; $itemCount++;
} }
if ($itemCount==0) return; if ($itemCount==0) return;
$result['articles'] = $articles;
echo json_encode($articles); $result['url'] = $comment_url;
echo json_encode($result);
} }
function commentDeleted($eventData, $addData) { function commentDeleted($eventData, $addData) {
@ -317,7 +328,7 @@ class serendipity_event_commentspice extends serendipity_event
return true; return true;
} }
$twittername = $spice['twittername']; $twittername = $spice['twittername'];
$eventData['comment'] = '<a href="https://twitter.com/#!/' . $twittername . '" class="commentspice_twitterlink" target="_blank"' . ($this->get_config('twitterinput_nofollow', true)?' rel="nofollow"':'') . '><img src="' . $serendipity['baseURL'] . 'index.php?/plugin/spicetwittersmall.png" alt="' . PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER . ': "> ' . $twittername . '</a><br/>' . $eventData['comment']; $eventData['comment'] = '<a href="https://twitter.com/#!/' . $twittername . '" class="commentspice_twitterlink" target="_blank"' . ($this->get_config('twitterinput_nofollow', true)?' rel="nofollow"':'') . '><img src="' . $serendipity['baseURL'] . 'index.php?/plugin/spiceicotwitter.png" alt="' . PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER . ': "> ' . $twittername . '</a><br/>' . $eventData['comment'];
if ($spice['promo_name'] && $spice['promo_url']) { if ($spice['promo_name'] && $spice['promo_url']) {
$eventData['comment'] .= "<p class=\"spice_resentpost\" style=\"padding-top: 1em; margin-bottom: 0em\">" . sprintf(PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_RESCENT, $eventData['author']) . ": <a href=\"{$spice['promo_url']}\" target=\"_blank\"" . ($this->get_config('announcerss_nofollow', false)?' rel="nofollow"':'') . ">{$spice['promo_name']}</a></p>"; $eventData['comment'] .= "<p class=\"spice_resentpost\" style=\"padding-top: 1em; margin-bottom: 0em\">" . sprintf(PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_RESCENT, $eventData['author']) . ": <a href=\"{$spice['promo_url']}\" target=\"_blank\"" . ($this->get_config('announcerss_nofollow', false)?' rel="nofollow"':'') . ">{$spice['promo_name']}</a></p>";
} }
@ -326,31 +337,70 @@ class serendipity_event_commentspice extends serendipity_event
function printCommentEditExtras(&$eventData, &$addData) { function printCommentEditExtras(&$eventData, &$addData) {
global $serendipity; global $serendipity;
$tag_comment_spice = '<br/>(<i>' . PLUGIN_EVENT_COMMENTSPICE_EXPERIMENTAL . '</i>)';
if (serendipity_db_bool($this->get_config('twitterinput', true))) { if (serendipity_db_bool($this->get_config('twitterinput', true))) {
if (isset($serendipity['COOKIE']['twitter'])) $twittername = $serendipity['COOKIE']['twitter']; if (isset($serendipity['COOKIE']['twitter'])) $twittername = $serendipity['COOKIE']['twitter'];
else $twittername = ''; else $twittername = '';
echo '<div id="serendipity_commentspice_twitter">'; echo '<div id="serendipity_commentspice_twitter">';
echo '<input style="background: url(' . $serendipity['baseURL'] . 'index.php?/plugin/spicetwittersmall.png) left no-repeat; padding-left: 1.5em; max-width: 18.5em" type="text" id="serendipity_commentform_twitter" name="serendipity[twitter]" placeholder="your twittername" value="' . $twittername . '"/>'; echo '<input class="commentspice_twitter_input" type="text" id="serendipity_commentform_twitter" name="serendipity[twitter]" placeholder="' . PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER_PLACEHOLDER . '" value="' . $twittername . '"/>';
echo '</div>'; echo '</div>';
} }
if (serendipity_db_bool($this->get_config('announcerss', false))) { if (serendipity_db_bool($this->get_config('announcerss', false))) {
echo '<div id="serendipity_commentspice_rss" style="display:none;">'; echo '<div id="serendipity_commentspice_rss" style="display:none;">';
echo '<select id="serendipity_commentform_rss" name="serendipity[promorss]"></select>'; // style="max-width: 20em; width: 100%" echo '<select class="commentspice_rss_input" id="serendipity_commentform_rss" name="serendipity[promorss]"></select>'; // style="max-width: 20em; width: 100%"
echo '</div>'; echo '</div>';
} }
if (serendipity_db_bool($this->get_config('twitterinput', true))) { if (serendipity_db_bool($this->get_config('twitterinput', true))) {
echo '<div id="serendipity_commentspice_twitter_desc" class="serendipity_commentDirection serendipity_comment_spice">'; echo '<div id="serendipity_commentspice_twitter_desc" class="serendipity_commentDirection serendipity_comment_spice">';
echo PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER_FOOTER . $tag_comment_spice; echo '<img src="' . $serendipity['baseURL'] . 'index.php?/plugin/commentspice.png" class="commentspice_ico" title="' . PLUGIN_EVENT_COMMENTSPICE_TITLE . '">';
echo PLUGIN_EVENT_COMMENTSPICE_PROMOTE_TWITTER_FOOTER;
echo '</div>'; echo '</div>';
} }
if (serendipity_db_bool($this->get_config('announcerss', false))) { if (serendipity_db_bool($this->get_config('announcerss', false))) {
echo '<div id="serendipity_commentspice_rss_desc" class="serendipity_commentDirection serendipity_comment_spice">'; echo '<div id="serendipity_commentspice_rss_desc" class="serendipity_commentDirection serendipity_comment_spice">';
echo PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_FOOTER .$tag_comment_spice; echo '<img src="' . $serendipity['baseURL'] . 'index.php?/plugin/commentspice.png" class="commentspice_ico" title="' . PLUGIN_EVENT_COMMENTSPICE_TITLE . '">';
echo PLUGIN_EVENT_COMMENTSPICE_PROMOTE_ARTICLE_FOOTER;
echo '</div>'; echo '</div>';
} }
} }
function writeCss(&$eventData, &$addData) {
global $serendipity;
if (!(strpos($eventData, '.commentspice_ico'))) {
?>
.commentspice_ico {
float:right;
margin-right:0px;
margin-left:10px;
}
<?php
}
if (!(strpos($eventData, '.commentspice_twitter_input'))) {
?>
.commentspice_twitter_input {
background: url('<?php echo $serendipity['baseURL']; ?>index.php?/plugin/spiceicotwitter.png') left no-repeat;
padding-left: 1.5em;
max-width: 18.5em;
margin-bottom: 1em;
}
<?php
}
if (!(strpos($eventData, '.commentspice_rss_input'))) {
?>
.commentspice_rss_input {
max-width: 22em;
min-width: 13.5em;
width: 100%;
background: url('<?php echo $serendipity['baseURL']; ?>index.php?/plugin/spiceicorss.png') no-repeat left #444444;
overflow: hidden;
border: 0.1em solid #000000;
border-radius: 3px 3px 3px 3px;
color: #FFFFFF;
padding-left: 1.5em;
margin-bottom: 1em;
}
<?php
}
}
function hashString( $what ) { function hashString( $what ) {
$installation_secret = $this->get_config('installation_secret'); $installation_secret = $this->get_config('installation_secret');
if (empty($installation_secret)) { if (empty($installation_secret)) {