X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=smileybutton%2Fsmileybutton.php;h=593eed8b0912c6b6484379d53dbafc34feb43e99;hb=101d3603245b17bd2e6d4880e94bb27887257238;hp=d922a6b147082f3c20262708de3925a8fccc1d0d;hpb=461b3db9f449fdb1ce780a337cf2f1bb7aa35ac5;p=friendica-addons.git diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php index d922a6b1..593eed8b 100644 --- a/smileybutton/smileybutton.php +++ b/smileybutton/smileybutton.php @@ -5,29 +5,30 @@ * Version: 0.2 * Author: Johannes Schwab */ - +use Friendica\Core\Hook; +use Friendica\Core\Logger; function smileybutton_install() { //Register hooks - register_hook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); + Hook::register('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); - logger("installed smileybutton"); + Logger::log("installed smileybutton"); } function smileybutton_uninstall() { //Delet registered hooks - unregister_hook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); + Hook::unregister('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); - logger("removed smileybutton"); + Logger::log("removed smileybutton"); } -function show_button($a, &$b) { +function show_button(Friendica\App $a, &$b) { // Disable if theme is quattro // TODO add style for quattro - if (current_theme() == 'quattro') + if ($a->getCurrentTheme() == 'quattro') return; // Disable for mobile because most mobiles have a smiley key for ther own @@ -69,34 +70,34 @@ function show_button($a, &$b) { ]; $icons = [ - '<3', - '</3', - ':-)', - ';-)', - ':-(', - ':-P', - ':-X', - ':-D', - ':-O', - '\\o/', - 'O_o', - ':\'(', - ':-!', - ':-/', - ':-[', - '8-)', - ':beer', - ':coffee', - ':facepalm', - ':like', - ':dislike', - '~friendica', - 'red' + '<3', + '</3', + ':-)', + ';-)', + ':-(', + ':-P', + ':-X', + ':-D', + ':-O', + '\\o/', + 'O_o', + ':\'(', + ':-!', + ':-/', + ':-[', + '8-)', + ':beer', + ':coffee', + ':facepalm', + ':like', + ':dislike', + '~friendica', + 'red' ]; // Call hooks to get aditional smileies from other addons $params = ['texts' => $texts, 'icons' => $icons, 'string' => ""]; //changed - call_hooks('smilie', $params); + Hook::callAll('smilie', $params); //Generate html for smiley list $s = "\n\t"; @@ -112,19 +113,19 @@ function show_button($a, &$b) { $s .= "\t
"; //Add css to header - $css_file = 'addon/smileybutton/view/'.current_theme().'.css'; + $css_file = 'addon/smileybutton/view/' . $a->getCurrentTheme() . '.css'; if (! file_exists($css_file)) $css_file = 'addon/smileybutton/view/default.css'; - $css_url = $a->get_baseurl().'/'.$css_file; + $css_url = $a->getBaseURL().'/'.$css_file; $a->page['htmlhead'] .= ''."\r\n"; //Get the correct image for the theme - $image = 'addon/smileybutton/view/'.current_theme().'.png'; + $image = 'addon/smileybutton/view/' . $a->getCurrentTheme() . '.png'; if (! file_exists($image)) $image = 'addon/smileybutton/view/default.png'; - $image_url = $a->get_baseurl().'/'.$image; + $image_url = $a->getBaseURL().'/'.$image; //Add the hmtl and script to the page $b = <<< EOT