public static function show_langs() { require_once CRAYON_PARSER_PHP; if (($langs = CrayonParser::parse_all()) != FALSE) { $langs = CrayonLangs::sort_by_name($langs); echo '<table class="crayon-table" cellspacing="0" cellpadding="0"><tr class="crayon-table-header">', '<td>ID</td><td>Name</td><td>Version</td><td>File Extensions</td><td>Aliases</td><td>State</td></tr>'; $keys = array_values($langs); for ($i = 0; $i < count($langs); $i++) { $lang = $keys[$i]; $tr = $i == count($langs) - 1 ? 'crayon-table-last' : ''; echo '<tr class="', $tr, '">', '<td>', $lang->id(), '</td>', '<td>', $lang->name(), '</td>', '<td>', $lang->version(), '</td>', '<td>', implode(', ', $lang->ext()), '</td>', '<td>', implode(', ', $lang->alias()), '</td>', '<td class="', strtolower(CrayonUtil::space_to_hyphen($lang->state_info())), '">', $lang->state_info(), '</td>', '</tr>'; } echo '</table><br/>Languages that have the same extension as their name don\'t need to explicitly map extensions.'; } else { echo 'No languages could be found.'; } exit; }
public static function content() { CrayonSettingsWP::load_settings(); $langs = CrayonLangs::sort_by_name(CrayonParser::parse_all()); $curr_lang = CrayonGlobalSettings::val(CrayonSettings::FALLBACK_LANG); $themes = CrayonResources::themes()->get(); $curr_theme = CrayonGlobalSettings::val(CrayonSettings::THEME); $fonts = CrayonResources::fonts()->get(); $curr_font = CrayonGlobalSettings::val(CrayonSettings::FONT); CrayonTagEditorWP::init_settings(); ?> <div id="crayon-te-content" class="crayon-te"> <div id="crayon-te-bar"> <div id="crayon-te-bar-content"> <div id="crayon-te-title">Title</div> <div id="crayon-te-controls"> <a id="crayon-te-ok" href="#"><?php crayon_e('OK'); ?> </a> <span class="crayon-te-seperator">|</span> <a id="crayon-te-cancel" href="#"><?php crayon_e('Cancel'); ?> </a> </div> </div> </div> <table id="crayon-te-table" class="describe"> <tr class="crayon-tr-center"> <th><?php crayon_e('Title'); ?> </th> <td class="crayon-nowrap"><?php self::textbox('title', array('placeholder' => crayon__('A short description'))); ?> <span id="crayon-te-sub-section"> <?php self::checkbox('inline'); ?> <span class="crayon-te-section"><?php crayon_e('Inline'); ?> </span> </span> <span id="crayon-te-sub-section"> <?php self::checkbox('highlight'); ?> <span class="crayon-te-section"><?php crayon_e("Don't Highlight"); ?> </span> </span></td> </tr> <tr class="crayon-tr-center"> <th><?php crayon_e('Language'); ?> </th> <td class="crayon-nowrap"><?php self::select_resource('lang', $langs, $curr_lang); ?> <span class="crayon-te-section"><?php crayon_e('Line Range'); ?> </span> <?php self::textbox('range', array('placeholder' => crayon__('(e.g. 3-5 or 3)'))); ?> <span class="crayon-te-section"><?php crayon_e('Marked Lines'); ?> </span> <?php self::textbox('mark', array('placeholder' => crayon__('(e.g. 1,2,3-5)'))); ?> </td> </tr> <tr class="crayon-tr-center" style="text-align: center;"> <th> <div> <?php crayon_e('Code'); ?> </div> <input type="button" id="crayon-te-clear" class="secondary-primary" value="<?php crayon_e('Clear'); ?> " name="clear"/> </th> <td><textarea id="crayon-code" name="code" placeholder="<?php crayon_e('Paste your code here, or type it in manually.'); ?> "></textarea> </td> </tr> <tr class="crayon-tr-center"> <th id="crayon-url-th"><?php crayon_e('URL'); ?> </th> <td><?php self::textbox('url', array('placeholder' => crayon__('Relative local path or absolute URL'))); ?> <div id="crayon-te-url-info" class="crayon-te-info"> <?php crayon_e("If the URL fails to load, the code above will be shown instead. If no code exists, an error is shown."); echo ' '; printf(crayon__('If a relative local path is given it will be appended to %s - which is defined in %sCrayon > Settings > Files%s.'), '<span class="crayon-te-quote">' . get_home_url() . '/' . CrayonGlobalSettings::val(CrayonSettings::LOCAL_PATH) . '</span>', '<a href="options-general.php?page=crayon_settings" target="_blank">', '</a>'); ?> </div> </td> </tr> <tr> <td id="crayon-te-submit-wrapper" colspan="2" style="text-align: center;"><?php self::submit(); ?> </td> </tr> <!-- <tr>--> <!-- <td colspan="2"><div id="crayon-te-warning" class="updated crayon-te-info"></div></td>--> <!-- </tr>--> <tr> <td colspan="2"><?php $admin = isset($_GET['is_admin']) ? intval($_GET['is_admin']) : is_admin(); if (!$admin && !CrayonGlobalSettings::val(CrayonSettings::TAG_EDITOR_SETTINGS)) { exit; } ?> <hr/> <div> <h2 class="crayon-te-heading"> <?php crayon_e('Settings'); ?> </h2> </div> <div id="crayon-te-settings-info" class="crayon-te-info"> <?php crayon_e('Change the following settings to override their global values.'); echo ' <span class="', CrayonSettings::SETTING_CHANGED, '">'; crayon_e('Only changes (shown yellow) are applied.'); echo '</span><br/>'; echo sprintf(crayon__('Future changes to the global settings under %sCrayon > Settings%s won\'t affect overridden settings.'), '<a href="options-general.php?page=crayon_settings" target="_blank">', '</a>'); ?> </div> </td> </tr> <?php $sections = array('Theme', 'Font', 'Metrics', 'Toolbar', 'Lines', 'Code'); foreach ($sections as $section) { echo '<tr><th>', crayon__($section), '</th><td>'; call_user_func('CrayonSettingsWP::' . strtolower($section), TRUE); echo '</td></tr>'; } ?> </table> </div> <?php exit; }