From 01f35199f47da6dd30b1eac3a11cd464bb20b28b Mon Sep 17 00:00:00 2001 From: Random Penguin <25882519-randompenguin@users.noreply.gitlab.com> Date: Sun, 27 Apr 2025 16:52:25 -0500 Subject: [PATCH] Fixing Issue #1 --- zen_postbox.php | 181 ++++++++++++++++++++++++++---------------------- 1 file changed, 97 insertions(+), 84 deletions(-) diff --git a/zen_postbox.php b/zen_postbox.php index 6e5f607..be42d28 100644 --- a/zen_postbox.php +++ b/zen_postbox.php @@ -2,7 +2,7 @@ /** * Name: Zen Postbox * Description: Adds a button to editor to insert color background. Called Zen to load last. - * Version: 1.0 + * Version: 1.1 * Author: Random Penguin */ @@ -20,88 +20,95 @@ 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', + ['White Smoke', 'whitesmoke'], + ['Dark Grey', 'darkgrey'], + ['Black', 'black'], + ['Pink', 'pink'], + ['Red', 'red'], + ['Dark Red', 'darkred'], + ['Light Pink', 'lightpink'], + ['Hot Pink', 'hotpink'], + ['Medium Violet Red', 'mediumvioletred'], + ['Peach Puff', 'peachpuff'], + ['Dark Orange (Orange)', 'darkorange'], + ['Sienna', 'sienna'], + ['Light Yellow', 'lightyellow'], + ['Gold', 'gold'], + ['Goldenrod', 'goldenrod'], + ['Honeydew', 'honeydew'], + ['Yellow Green', 'yellowgreen'], + ['Olive Drab', 'olivedrab'], + ['Pale Green', 'palegreen'], + ['Lime Green (Green)', 'limegreen'], + ['Forest Green (Forest)', 'forestgreen'], + ['Mint Cream', 'mintcream'], + ['Medium Aquamarine', 'mediumaquamarine'], + ['Sea Green', 'seagreen'], + ['Sky Blue', 'skyblue'], + ['Cornflower Blue (Blue)', 'cornflowerblue'], + ['Dark Slate Blue', 'darkslateblue'], + ['Lavender', 'lavender'], + ['Medium Slate Blue', 'mediumslateblue'], + ['Dark Blue (Ocean)', 'darkblue'], + ['Thistle', 'thistle'], + ['Violet', 'violet'], + ['Purple', 'purple'], + ['Light Salmon (Salmon)', 'lightsalmon'], + + ['Aurora', 'aurora'], + ['Blue-Gray', 'bluegray'], + ['Gray-Grey', 'graygrey'], + ['Gray-Black', 'grayblack'], + ['Green-Gray', 'greengray'], + ['Lavender-Gray', 'lavendergray'], + ['Minty', 'minty'], + ['Mint-Gray', 'mintgray'], + ['Rainbow', 'rainbow'], + ['Red-Blue', 'redblue'], + ['Sherbet', 'sherbet'], + ['Spectrum', 'spectrum'], + ['Strawberry-Cream', 'strawberrycream'], + ['Sunset', 'sunset'], + ['Teal-Blue', 'tealblue'], + ['Teal-Gray', 'tealgray'], + ['Violets', 'violets'], + ['Violet-Blue', 'violetblue'], + + ['Blueprint', 'blueprint'], + ['Birds', 'birds'], + ['Checkered', 'checkered'], + ['Cubes', 'cubes'], + ['Lemon-Lime', 'lemonlime'], + ['Gingham', 'gingham'], + ['Grid', 'grid'], + ['Hearts', 'hearts'], + ['Honeycomb', 'honeycomb'], + ['Notebook', 'notebook'], + ['Plaid', 'plaid'], + ['Polkadots', 'polkadots'], + ['Shade Dots', 'shadedots'], + ['Shadowbox', 'shadowbox'], + ['Stars', 'stars'], + ['Warp Grid', 'warpgrid'], + ['Wavy', 'wavy'], + + ['Ani-Gradient', 'anigradient'], + ['Blob', 'blob'], + ['Color Fade', 'colorfade'], + ['Grid Runner', 'gridrunner'], + ['Heartbeat', 'heartbeat'], + ['Moonrise', 'moonrise'], + ['Rainy', 'rainy'], + ['Rocket', 'rocket'], + ['Snowy', 'snowy'], + ['Sunrise', 'sunrise'], + ['Waves', 'waves'], ]; - $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 + // Generate Postbox Buttons $s = '
'; - for ($x = 0; $x < count($params['texts']); $x++) { - $icon = $params['icons'][$x]; - $s .= ''; + for ($x = 0; $x < count($labels); $x++){ + $s .= ''; } $s .= '
'; @@ -113,10 +120,16 @@ function zen_postbox_jot_tool(string &$body) DI::page()->registerStylesheet($css_file); - // Add zen_postbox Styling to Header - $box_styles = __DIR__ . '/view/postbox.min.css'; - DI::page()->registerStylesheet($box_styles); - + /* Add Postbox Styling to Header + DI::page()->registerStylesheet($path) might load before theme + so we will append with DI::page()['htmlhead'] to make it load much much later + */ + $path = __DIR__ . '/view/postbox.min.css?v=' . DI::app()::VERSION; + if (mb_strpos($path, DI::basePath() . DIRECTORY_SEPARATOR) === 0) { + $path = mb_substr($path, mb_strlen(DI::basePath() . DIRECTORY_SEPARATOR)); + } + DI::page()['htmlhead'] .= ''; + //Get the correct image for the theme $image = 'addon/zen_postbox/view/default.png';