Copyright (C) Rodolfo Berrios A. All rights reserved. BY USING THIS SOFTWARE YOU DECLARE TO ACCEPT THE CHEVERETO EULA http://chevereto.com/license --------------------------------------------------------------------- */ $route = function($handler) { try { if(!CHV\getSetting('enable_plugin_route') && !CHV\Login::isAdmin()) { return $handler->issue404(); } $src = CHV\getSetting('sdk_pup_url') ?: G\get_base_url('sdk/pup.js'); $src = G\str_replace_first('https:', '', $src); G\Render\include_theme_file('snippets/embed'); $embed_tpl = G\get_global('embed_tpl'); $embed = []; foreach($embed_tpl as $kGroup => $vGroup) { foreach($vGroup['options'] as $k => $v) { if($k == 'bbcode-embed-medium') { $k = NULL; } $embed[$k] = $v['label']; } } $tagAttrs = [ 'async' => '', 'src' => $src, 'data-url' => G\get_base_url('upload') ]; $tagCode = ' $v) { $tagCode .= ' ' . $k; if($v) { $tagCode .= '="' . $v .'"'; } } $tagCode .= '>'; $plugin = [ 'tagAttrs' => $tagAttrs, 'tagCode' => $tagCode, 'table' => [ '%cClass' => 'chevereto-pup-container', '%bClass' => 'chevereto-pup-button', '%iClass' => 'chevereto-pup-button-icon', '%iconSvg' => '', ], 'vendors' => [ 'bbPress', 'Discourse', 'Discuz!', 'Invision Power Board', 'MyBB', 'NodeBB', 'phpBB', 'Simple Machines Forum', 'Vanilla Forums', 'vBulletin', 'XenForo' ], 'palettes' => [ 'default' => ['#ececec','#000','#2980b9','#fff'], 'clear' => ['inherit','inherit','inherit','#2980b9'], 'turquoise' => ['#16a085','#fff','#1abc9c','#fff'], 'green' => ['#27ae60','#fff','#2ecc71','#fff'], 'blue' => ['#2980b9','#fff','#3498db','#fff'], 'purple' => ['#8e44ad','#fff','#9b59b6','#fff'], 'darkblue' => ['#2c3e50','#fff','#34495e','#fff'], 'yellow' => ['#f39c12','#fff','#f1c40f','#fff'], 'orange' => ['#d35400','#fff','#e67e22','#fff'], 'red' => ['#c0392b','#fff','#e74c3c','#fff'], 'grey' => ['#ececec','#000','#e0e0e0','#000'], 'black' => ['#333','#fff','#666','#fff'] ], 'button' => '
', 'baseCss' => '.%cClass{display:inline-block;margin-top:5px;margin-bottom:5px}.%bClass{-webkit-transition:all .2s;-o-transition:all .2s;transition:all .2s;outline:0;border:none;cursor:pointer;border:1px solid rgba(0,0,0,.05);border-radius:.2em;padding:.5em 1em;font-size:12px;font-weight:700;text-shadow:none}.%bClass:hover{border-top-color:rgba(255,255,255,.1);border-right-color:rgba(0,0,0,.05);border-bottom-color:rgba(0,0,0,.1);border-left-color:rgba(0,0,0,.05);}.%iClass{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-item-align:center;align-self:center;position:relative;height:1em;width:1em;margin-right:.25em}.%iClass img,.%iClass svg{width:1em;height:1em;bottom:-.125em;position:absolute}.%iClass svg{fill:currentColor}', 'paletteCss' => '.%bClass--palette-%palette{color:%2;background:%1}.%bClass--palette-%palette:hover{background:%3;color:%4}', 'embed' => $embed, ]; $palette_css_rules = ''; foreach($plugin['palettes'] as $palette => $colors) { $paletteTable = $plugin['table']; $paletteTable['%palette'] = $palette; foreach($colors as $index => $color) { $paletteTable['%' . ($index + 1)] = $color; } $palette_css_rules .= strtr($plugin['paletteCss'], $paletteTable); } foreach(['button', 'baseCss'] as $v) { $plugin[$v] = strtr($plugin[$v], $plugin['table']); } $plugin['stylesheet'] = ''; $handler::setVar('plugin', $plugin); $handler::setVar('pre_doctitle', _s('Upload plugin')); } catch(Exception $e) { G\exception_to_error($e); } };