?\/])\s*#', '#[;,]([\]\}])#', '#\btrue\b#', '#\bfalse\b#', '#\breturn\s+#' ), array( "", '$1', '$1', '!0', '!1', 'return '), $input ); } function yash3_minify_js($input) { if( ! $input = trim($input)) return $input; // Create chunk(s) of string(s), comment(s), regex(es) and text global $SS, $CC; $input = preg_split('#(' . $SS . '|' . $CC . '|\/[^\n]+?\/(?=[.,;]|[gimuy]|$))#', $input, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); $output = ""; foreach($input as $v) { if(trim($v) === "") continue; if( ($v[0] === '"' && substr($v, -1) === '"') || ($v[0] === "'" && substr($v, -1) === "'") || ($v[0] === '/' && substr($v, -1) === '/') ){ // Remove if not detected as important comment ... if(strpos($v, '//') === 0 || (strpos($v, '/*') === 0 && strpos($v, '/*!') !== 0 && strpos($v, '/*@cc_on') !== 0)) continue; $output .= $v; // String, comment or regex ... } else { $output .= _yash3_minify_js($v); } } return preg_replace( array( '#(' . $CC . ')|([\{,])([\'])(\d+|[a-z_]\w*)\3(?=:)#i', '#([\w\)\]])\[([\'"])([a-z_]\w*)\2\]#i' ), array( '$1$2$4', '$1.$3' ), $output); } // Setting default parameters if missing configuration $core->blog->settings->addNamespace('yash3'); if (is_null($core->blog->settings->yash3->yash3_active)) { try { // Default state is active if the comments are configured to allow wiki syntax $core->blog->settings->yash3->put('yash3_active',false,'boolean',true); $core->blog->settings->yash3->put('yash3_theme','Default','string',true); $core->blog->settings->yash3->put('yash3_custom_css','','string',true); $core->blog->triggerBlog(); http::redirect($p_url); } catch (Exception $e) { $core->error->add($e->getMessage()); } } // Getting current parameters $active = (boolean)$core->blog->settings->yash3->yash3_active; $theme = (string)$core->blog->settings->yash3->yash3_theme; $custom_css = (string)$core->blog->settings->yash3->yash3_custom_css; if (!empty($_REQUEST['popup'])) { $yash3_brushes = array( 'plain' => __('Plain Text'), 'applescript' => __('AppleScript'), 'as3' => __('ActionScript3'), 'bash' => __('Bash/shell'), 'cf' => __('ColdFusion'), 'csharp' => __('C#'), 'cpp' => __('C/C++'), 'css' => __('CSS'), 'delphi' => __('Delphi'), 'diff' => __('Diff/Patch'), 'erl' => __('Erlang'), 'groovy' => __('Groovy'), 'haxe' => __('Haxe'), 'js' => __('Javascript/JSON'), 'java' => __('Java'), 'jfx' => __('JavaFX'), 'pl' => __('Perl'), 'php' => __('PHP'), 'ps' => __('PowerShell'), 'python' => __('Python'), 'ruby' => __('Ruby'), 'sass' => __('SASS'), 'scala' => __('Scala'), 'sql' => __('SQL'), 'tap' => __('Tap'), 'ts' => __('TypeScript'), 'vb' => __('Visual Basic'), 'xml' => __('XML/XSLT/XHTML/HTML'), 'yaml' => __('Yaml') ); echo ''. ''. ''.__('YASH - Syntax Selector').''. dcPage::jsLoad(urldecode(dcPage::getPF('yash3/js/popup.js')),$core->getVersion('yash3')). ''. ''. '

'.__('YASH - Syntax Selector').'

'. '
'. '

'. '

'.__('Cancel').' - '. ''.__('Ok').'

'. '
'. ''. ''; return; } // Saving new configuration if (!empty($_POST['saveconfig'])) { try { $core->blog->settings->addNameSpace('yash3'); $active = (empty($_POST['active'])) ? false : true; $theme = (empty($_POST['theme'])) ? 'Default' : $_POST['theme']; $custom_css = (empty($_POST['custom_css'])) ? '' : html::sanitizeURL($_POST['custom_css']); $core->blog->settings->yash3->put('yash3_active',$active,'boolean'); $core->blog->settings->yash3->put('yash3_theme',$theme,'string'); $core->blog->settings->yash3->put('yash3_custom_css',$custom_css,'string'); //To do, créer le file minifié ici yash3/syntaxhighlighter/js/shConcatened.js if(file_exists(dirname(__FILE__)."/syntaxhighlighter/js/shConcatened.js")){ //delete It unlink(dirname(__FILE__)."/syntaxhighlighter/js/shConcatened.js"); } //concat js files and minify them $fContent = yash3_minify_js( get_file_content(dirname(__FILE__)."/syntaxhighlighter/js/shCore.js"). get_file_content(dirname(__FILE__)."/syntaxhighlighter/js/shAutoloader.js"). dcUtils::jsVar('yash_path',$core->blog->getPF('yash/syntaxhighlighter/js/')). get_file_content(dirname(__FILE__)."/js/public.js") ); //write the fiule file_put_contents(dirname(__FILE__)."/syntaxhighlighter/js/shConcatened.js",$fContent); $core->blog->triggerBlog(); dcPage::addSuccessNotice(__('Configuration successfully updated.')); http::redirect($p_url); } catch (Exception $e) { $core->error->add($e->getMessage()); } } ?> <?php echo __('YASH'); ?> blog->name) => '', __('YASH') => '' )); echo dcPage::notices(); $combo_theme = array( __('Default') => 'Default', __('Django') => 'Django', __('Eclipse') => 'Eclipse', __('Emacs') => 'Emacs', __('Fade to gray') => 'FadeToGrey', __('Material') => 'Material', __('MD Ultra') => 'MDUltra', __('Midnight') => 'Midnight', __('RDark') => 'RDark', __('Solarized Dark') => 'SolarizedDark', __('Solarized Light') => 'SolarizedLight', __('Tomorrow Night') => 'TomorrowNight' ); ?>


formNonce(); ?>