diff --git a/zen_postbox.php b/zen_postbox.php new file mode 100644 index 0000000..26a4bd2 --- /dev/null +++ b/zen_postbox.php @@ -0,0 +1,184 @@ + + */ + +use Friendica\App; +use Friendica\Core\Hook; +use Friendica\DI; + +function zen_postbox_install() +{ + //Register hooks + Hook::register('jot_tool', 'addon/zen_postbox/zen_postbox.php', 'zen_postbox_jot_tool'); +} + +function zen_postbox_jot_tool(string &$body) +{ + + $labels = [ + 'Black', + 'Red', + 'Green', + 'Blue', + 'Orange', + 'Purple', + 'Forest', + 'Ocean', + 'Pink', + 'Salmon', + 'Dark Gray', + 'Minty', + 'Mint Gray', + 'Red-Blue', + 'Violets', + 'Gray-Black', + 'Teal Blue', + 'Green Gray', + 'Teal Gray', + 'Blue Gray', + 'Lavender Gray', + 'Sunset', + 'Sherbert', + ]; + + $texts = [ + '[class=postbox-black]', + '[class=postbox-red]', + '[class=postbox-green]', + '[class=postbox-blue]', + '[class=postbox-orange]', + '[class=postbox-purple]', + '[class=postbox-forest]', + '[class=postbox-ocean]', + '[class=postbox-pink]', + '[class=postbox-salmon]', + '[class=postbox-darkgray]', + '[class=postbox-minty]', + '[class=postbox-mintgray]', + '[class=postbox-redblue]', + '[class=postbox-violets]', + '[class=postbox-grayblack]', + '[class=postbox-tealblue]', + '[class=postbox-greengray]', + '[class=postbox-tealgray]', + '[class=postbox-bluegray]', + '[class=postbox-lavendergray]', + '[class=postbox-sunset]', + '[class=postbox-sherbert]', + ]; + + $icons = [ + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + ]; + $params = ['texts' => $texts, 'icons' => $icons, 'string' => '', 'labels' => $labels]; + //Generate html for smiley list + $s = '
'; + for ($x = 0; $x < count($params['texts']); $x++) { + $icon = $params['icons'][$x]; + $s .= ''; + } + $s .= '
'; + + //Add control css to header + $css_file = __DIR__ . '/view/' . DI::app()->getCurrentTheme() . '.css'; + if (!file_exists($css_file)) { + $css_file = __DIR__ . '/view/default.css'; + } + + DI::page()->registerStylesheet($css_file); + + // Add zen_postbox Styling to Header + $box_styles = __DIR__ . '/view/postbox.css'; + DI::page()->registerStylesheet($box_styles); + + //Get the correct image for the theme + $image = 'addon/zen_postbox/view/default.png'; + + $image_url = DI::baseUrl() . '/' . $image; + + //Append the hmtl and script to the page + $body .= <<< EOT +
+ +
+ $s +
+
+ + +EOT; +} +