Theme emoticons do not need a fallback into another theme

This commit is contained in:
Ian 2015-08-19 19:51:56 +02:00
parent df17a410b0
commit 4c94dcba5c
3 changed files with 36 additions and 24 deletions

View File

@ -1,3 +1,9 @@
1.9:
----
* changed fetching path in emoticons.inc.php file.
Theme emoticons do not need a fallback into another theme.
1.8:
-----

View File

@ -23,49 +23,50 @@
. . . etc
*/
$myThemePath = $serendipity['serendipityHTTPPath'] . $serendipity['templatePath'] . $serendipity['template'];
$serendipity['custom_emoticons_regexp'] = true;
$serendipity['custom_emoticons'] = array(
"\:'\(" => serendipity_getTemplateFile('img/emoticons/cry.png', 'serendipityHTTPPath', true),
$serendipity['custom_emoticons'] = array(
"\:'\(" => $myThemePath . '/img/emoticons/cry.png',
'\:\-?\)' => serendipity_getTemplateFile('img/emoticons/smile.png', 'serendipityHTTPPath', true),
'\:\-?\)' => $myThemePath . '/img/emoticons/smile.png',
'\:\-?\|' => serendipity_getTemplateFile('img/emoticons/normal.png', 'serendipityHTTPPath', true),
'\:\-?\|' => $myThemePath . '/img/emoticons/normal.png',
'\:\-?O' => serendipity_getTemplateFile('img/emoticons/eek.png', 'serendipityHTTPPath', true),
'\:\-?O' => $myThemePath . '/img/emoticons/eek.png',
'\:\-?\(' => serendipity_getTemplateFile('img/emoticons/sad.png', 'serendipityHTTPPath', true),
'\:\-?\(' => $myThemePath . '/img/emoticons/sad.png',
'8\-?\)' => serendipity_getTemplateFile('img/emoticons/cool.png', 'serendipityHTTPPath', true),
'8\-?\)' => $myThemePath . '/img/emoticons/cool.png',
'\:\-?D' => serendipity_getTemplateFile('img/emoticons/laugh.png', 'serendipityHTTPPath', true),
'\:\-?D' => $myThemePath . '/img/emoticons/laugh.png',
'\:\-?P' => serendipity_getTemplateFile('img/emoticons/tongue.png', 'serendipityHTTPPath', true),
'\:\-?P' => $myThemePath . '/img/emoticons/tongue.png',
';\-?\)' => serendipity_getTemplateFile('img/emoticons/wink.png', 'serendipityHTTPPath', true),
';\-?\)' => $myThemePath . '/img/emoticons/wink.png',
'\:anger\:' => serendipity_getTemplateFile('img/emoticons/anger.png', 'serendipityHTTPPath', true),
'\:anger\:' => $myThemePath . '/img/emoticons/anger.png',
'\:\$' => serendipity_getTemplateFile('img/emoticons/shame.png', 'serendipityHTTPPath', true),
'\:\$' => $myThemePath . '/img/emoticons/shame.png',
'\:grmpf\:' => serendipity_getTemplateFile('img/emoticons/grmpf.png', 'serendipityHTTPPath', true),
'\:grmpf\:' => $myThemePath . '/img/emoticons/grmpf.png',
'\:grrr\:' => serendipity_getTemplateFile('img/emoticons/grrr.png', 'serendipityHTTPPath', true),
'\:grrr\:' => $myThemePath . '/img/emoticons/grrr.png',
'\:haha\:' => serendipity_getTemplateFile('img/emoticons/haha.png', 'serendipityHTTPPath', true),
'\:haha\:' => $myThemePath . '/img/emoticons/haha.png',
'\:\)' => serendipity_getTemplateFile('img/emoticons/happy.png', 'serendipityHTTPPath', true),
'\:\)' => $myThemePath . '/img/emoticons/happy.png',
'\:hero\:' => serendipity_getTemplateFile('img/emoticons/hero.png', 'serendipityHTTPPath', true),
'\:hero\:' => $myThemePath . '/img/emoticons/hero.png',
'\:ko\:' => serendipity_getTemplateFile('img/emoticons/ko.png', 'serendipityHTTPPath', true),
'\:ko\:' => $myThemePath . '/img/emoticons/ko.png',
'\:safe\:' => serendipity_getTemplateFile('img/emoticons/safe.png', 'serendipityHTTPPath', true),
'\:safe\:' => $myThemePath . '/img/emoticons/safe.png',
'\:still\:' => serendipity_getTemplateFile('img/emoticons/still.png', 'serendipityHTTPPath', true),
'\:still\:' => $myThemePath . '/img/emoticons/still.png',
'\:\(' => serendipity_getTemplateFile('img/emoticons/unhappy.png', 'serendipityHTTPPath', true),
'\:\(' => $myThemePath . '/img/emoticons/unhappy.png',
'\:o\:' => serendipity_getTemplateFile('img/emoticons/whistle.png', 'serendipityHTTPPath', true),
'\:o\:' => $myThemePath . '/img/emoticons/whistle.png',
);
?>

View File

@ -14,7 +14,7 @@ class serendipity_event_emoticate extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_EMOTICATE_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Serendipity Team');
$propbag->add('version', '1.8');
$propbag->add('version', '1.9');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
@ -73,7 +73,12 @@ class serendipity_event_emoticate extends serendipity_event
}
/* Hijack global variable $serendipity['custom_emoticons'] if it exists */
$hijack_file = serendipity_getTemplateFile('emoticons.inc.php', 'serendipityPath', true);
if ($serendipity['version'][0] > 1) {
// called in backend too, but uses frontend fallback. Advise to use the Plugin simple approach 4th parameter!
$hijack_file = serendipity_getTemplateFile('emoticons.inc.php', 'serendipityPath', true, true);
} else {
$hijack_file = serendipity_getTemplateFile('emoticons.inc.php', 'serendipityPath', true);
}
if (@file_exists($hijack_file)) {
@include $hijack_file; // This file contains $serendipity['custom_emoticons'] and maybe $serendipity['custom_emoticons_regexp']
if (isset($serendipity['custom_emoticons']) && is_array($serendipity['custom_emoticons'])) {