public static function init_settings()
 {
     if (!self::$settings) {
         // Add settings
         CrayonSettingsWP::load_settings(TRUE);
         self::$settings = array('url' => plugins_url(CRAYON_TE_CONTENT_PHP, __FILE__), 'home_url' => home_url(), 'css' => 'crayon-te', 'used' => CrayonGlobalSettings::val(CrayonSettings::TINYMCE_USED), 'used_setting' => CrayonSettings::TINYMCE_USED, 'ajax_url' => plugins_url(CRAYON_AJAX_PHP, dirname(dirname(__FILE__))), 'css_selected' => 'crayon-selected', 'code_css' => '#crayon-code', 'url_css' => '#crayon-url', 'url_info_css' => '#crayon-te-url-info', 'lang_css' => '#crayon-lang', 'title_css' => '#crayon-title', 'mark_css' => '#crayon-mark', 'inline_css' => 'crayon-inline', 'inline_hide_css' => 'crayon-hide-inline', 'inline_hide_only_css' => 'crayon-hide-inline-only', 'hl_css' => '#crayon-highlight', 'switch_html' => '#content-html', 'switch_tmce' => '#content-tmce', 'tinymce_button' => '#content_crayon_tinymce', 'submit_css' => 'crayon-te-submit', 'submit_wrapper_css' => '#crayon-te-submit-wrapper', 'data_value' => 'data-value', 'attr_sep' => CrayonGlobalSettings::val_str(CrayonSettings::ATTR_SEP), 'css_sep' => '_', 'fallback_lang' => CrayonGlobalSettings::val(CrayonSettings::FALLBACK_LANG), 'dialog_title_add' => crayon__('Add Crayon Code'), 'dialog_title_edit' => crayon__('Edit Crayon Code'), 'submit_add' => crayon__('Add'), 'submit_edit' => crayon__('Save'));
     }
 }
 public static function plugin_row_meta($meta, $file)
 {
     global $CRAYON_DONATE;
     if ($file == CrayonWP::basename()) {
         $meta[] = '<a href="options-general.php?page=crayon_settings">' . crayon__('Settings') . '</a>';
         $meta[] = '<a href="options-general.php?page=crayon_settings&theme-editor=1">' . crayon__('Theme Editor') . '</a>';
         $meta[] = '<a href="' . $CRAYON_DONATE . '" target="_blank">' . crayon__('Donate') . '</a>';
     }
     return $meta;
 }
<!--		<tr>-->
<!--			<td colspan="2"><div id="crayon-te-warning" class="updated crayon-te-info"></div></td>-->
<!--		</tr>-->
		<tr>
			<td colspan="2">
			<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 &gt; 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>
// var_dump($editing);
?>

<div id="icon-options-general" class="icon32"><br>
</div>
<h2>Crayon Syntax Highlighter <?php 
crayon_e('Theme Editor');
?>
</h2>

<h3>
<?php 
if ($editing) {
    echo sprintf(crayon__('Editing "%s" Theme'), $theme->name());
} else {
    echo sprintf(crayon__('Creating Theme From "%s"'), $theme->name());
}
?>
</h3>

<p><a class="button-primary" onclick="CrayonSyntaxAdmin.show_main();"><?php 
crayon_e('Back To Settings');
?>
</a></p>

<?php 
//crayon_e('Use the Sidebar on the right to change the Theme of the Preview window.')
?>

<div id="crayon-editor-top-controls"></div>
    public static function print_code($hl, $code, $line_numbers = TRUE, $print = TRUE)
    {
        global $CRAYON_VERSION;
        // We can print either block or inline, inline is treated differently, factor out common stuff here
        $output = '';
        // Used for style tag
        $main_style = $code_style = $toolbar_style = $info_style = $font_style = $line_style = '';
        // Unique ID for this instance of Crayon
        $uid = 'crayon-' . $hl->id();
        // Print theme id
        // We make the assumption that the id is correct (checked in crayon_wp)
        $theme_id = $hl->setting_val(CrayonSettings::THEME);
        $theme_id_dashed = CrayonUtil::space_to_hyphen($theme_id);
        if (!$hl->setting_val(CrayonSettings::ENQUEUE_THEMES)) {
            $output .= CrayonResources::themes()->get_css($theme_id);
        }
        // Print font id
        // We make the assumption that the id is correct (checked in crayon_wp)
        $font_id = $hl->setting_val(CrayonSettings::FONT);
        $font_id_dashed = CrayonUtil::space_to_hyphen($font_id);
        if (!$hl->setting_val(CrayonSettings::ENQUEUE_FONTS)) {
            $output .= CrayonResources::fonts()->get_css($font_id);
        }
        // Inline margin
        if ($hl->is_inline()) {
            $inline_margin = $hl->setting_val(CrayonSettings::INLINE_MARGIN) . 'px !important;';
        }
        // Determine font size
        // TODO improve logic
        if ($hl->setting_val(CrayonSettings::FONT_SIZE_ENABLE)) {
            $_font_size = $hl->setting_val(CrayonSettings::FONT_SIZE);
            $font_size = $_font_size . 'px !important;';
            $_line_height = $hl->setting_val(CrayonSettings::LINE_HEIGHT);
            // Don't allow line height to be less than font size
            $line_height = ($_line_height > $_font_size ? $_line_height : $_font_size) . 'px !important;';
            $toolbar_height = $font_size * 1.5 . 'px !important;';
            $info_height = $font_size * 1.4 . 'px !important;';
            $font_style .= "font-size: {$font_size} line-height: {$line_height}";
            $toolbar_style .= "font-size: {$font_size}";
            $line_style .= "height: {$line_height}";
            if ($hl->is_inline()) {
                $font_style .= "font-size: {$font_size}";
            } else {
                $toolbar_style .= "height: {$toolbar_height} line-height: {$toolbar_height}";
                $info_style .= "min-height: {$info_height} line-height: {$info_height}";
            }
        } else {
            if (!$hl->is_inline()) {
                if (($font_size = CrayonGlobalSettings::get(CrayonSettings::FONT_SIZE)) !== FALSE) {
                    $font_size = $font_size->def() . 'px !important;';
                    $line_height = $font_size * 1.4 . 'px !important;';
                }
            }
        }
        // This will return from function with inline print
        if ($hl->is_inline()) {
            $wrap = !$hl->setting_val(CrayonSettings::INLINE_WRAP) ? 'crayon-syntax-inline-nowrap' : '';
            $output .= '
			<span id="' . $uid . '" class="crayon-syntax crayon-syntax-inline ' . $wrap . ' crayon-theme-' . $theme_id_dashed . ' crayon-theme-' . $theme_id_dashed . '-inline crayon-font-' . $font_id_dashed . '" style="' . $font_style . '">' . '<span class="crayon-pre crayon-code" style="' . $font_style . '">' . $code . '</span>' . '</span>';
            return $output;
        }
        // Below code only for block (default) printing
        // Generate the code lines and separate each line as a div
        $print_code = '';
        $print_nums = '';
        $hl->line_count(preg_match_all("#(?:^|(?<=\r\n|\n))[^\r\n]*#", $code, $code_lines));
        // The line number to start from
        $start_line = $hl->setting_val(CrayonSettings::START_LINE);
        $marking = $hl->setting_val(CrayonSettings::MARKING);
        $striped = $hl->setting_val(CrayonSettings::STRIPED);
        $range = $hl->setting_val(CrayonSettings::RANGES) ? $hl->range() : FALSE;
        for ($i = 1; $i <= $hl->line_count(); $i++) {
            // Check if the current line is in the range of code to display
            if ($range) {
                if ($i < $range[0]) {
                    continue;
                } else {
                    if ($i > $range[1]) {
                        break;
                    }
                }
            }
            $code_line = $code_lines[0][$i - 1];
            // If line is blank, add a space so the div has the correct height
            if ($code_line == '') {
                $code_line = '&nbsp;';
            }
            // Check if the current line has been selected
            $marked_lines = $hl->marked();
            // Check if lines need to be marked as important
            if ($marking && in_array($i, $marked_lines)) {
                $marked_num = ' crayon-marked-num';
                $marked_line = ' crayon-marked-line';
                // If multiple lines are marked, only show borders for top and bottom lines
                if (!in_array($i - 1, $marked_lines)) {
                    $marked_num .= ' crayon-top';
                    $marked_line .= ' crayon-top';
                }
                // Single lines are both the top and bottom of the multiple marked lines
                if (!in_array($i + 1, $marked_lines)) {
                    $marked_num .= ' crayon-bottom';
                    $marked_line .= ' crayon-bottom';
                }
            } else {
                $marked_num = $marked_line = '';
            }
            // Stripe odd lines
            if ($striped && $i % 2 == 0) {
                $striped_num = ' crayon-striped-num';
                $striped_line = ' crayon-striped-line';
            } else {
                $striped_num = $striped_line = '';
            }
            // Generate the lines
            $line_num = $start_line + $i - 1;
            $line_id = $uid . '-' . $line_num;
            $print_code .= '<div class="crayon-line' . $marked_line . $striped_line . '" id="' . $line_id . '">' . $code_line . '</div>';
            if (!is_string($line_numbers)) {
                $print_nums .= '<div class="crayon-num' . $marked_num . $striped_num . '" data-line="' . $line_id . '">' . $line_num . '</div>';
            }
        }
        // If $line_numbers is a string, display it
        if (is_string($line_numbers) && !empty($line_numbers)) {
            $print_nums .= '<div class="crayon-num">' . $line_numbers . '</div>';
        } else {
            if (empty($line_numbers)) {
                $print_nums = FALSE;
            }
        }
        // Determine whether to print title, encode characters
        $title = $hl->title();
        // Decode if needed
        if ($hl->setting_val(CrayonSettings::DECODE_ATTRIBUTES)) {
            $title = CrayonUtil::html_entity_decode($title);
        }
        $print_title = '<span class="crayon-title">' . $title . '</span>';
        // Determine whether to print language
        $print_lang = '';
        // XXX Use for printing the regex
        if ($hl->language()) {
            $lang = $hl->language()->name();
            switch ($hl->setting_index(CrayonSettings::SHOW_LANG)) {
                case 0:
                    if ($hl->language()->id() == CrayonLangs::DEFAULT_LANG) {
                        break;
                    }
                    // Falls through
                // Falls through
                case 1:
                    $print_lang = '<span class="crayon-language">' . $lang . '</span>';
                    break;
            }
        }
        // Disable functionality for errors
        $error = $hl->error();
        // Combined settings for code
        $code_settings = '';
        // Disable mouseover for touchscreen devices and mobiles, if we are told to
        $touch = FALSE;
        // Whether we have detected a touchscreen device
        if ($hl->setting_val(CrayonSettings::TOUCHSCREEN) && CrayonUtil::is_touch()) {
            $touch = TRUE;
            $code_settings .= ' touchscreen';
        }
        // Disabling Popup
        if (!$hl->setting_val(CrayonSettings::POPUP)) {
            $code_settings .= ' no-popup';
        }
        // Minimize
        if (!$hl->setting_val(CrayonSettings::MINIMIZE)) {
            $code_settings .= ' minimize';
        }
        // Draw the plain code and toolbar
        $toolbar_settings = $print_plain_button = $print_copy_button = '';
        $toolbar_index = $hl->setting_index(CrayonSettings::TOOLBAR);
        if (empty($error) && ($toolbar_index != 2 || $hl->setting_val(CrayonSettings::MINIMIZE))) {
            // Enable mouseover setting for toolbar
            if ($toolbar_index == 0 && !$touch) {
                // No touchscreen detected
                $toolbar_settings .= ' mouseover';
                if ($hl->setting_val(CrayonSettings::TOOLBAR_OVERLAY)) {
                    $toolbar_settings .= ' overlay';
                }
                if ($hl->setting_val(CrayonSettings::TOOLBAR_HIDE)) {
                    $toolbar_settings .= ' hide';
                }
                if ($hl->setting_val(CrayonSettings::TOOLBAR_DELAY)) {
                    $toolbar_settings .= ' delay';
                }
            } else {
                if ($toolbar_index == 1) {
                    // Always display the toolbar
                    $toolbar_settings .= ' show';
                } else {
                    if ($toolbar_index == 2) {
                        $toolbar_settings .= ' never-show';
                    }
                }
            }
            $buttons = array();
            if ($hl->setting_val(CrayonSettings::NUMS_TOGGLE)) {
                $buttons['nums'] = crayon__('Toggle Line Numbers');
            }
            if ($hl->setting_val(CrayonSettings::PLAIN) && $hl->setting_val(CrayonSettings::PLAIN_TOGGLE)) {
                $buttons['plain'] = crayon__('Toggle Plain Code');
            }
            if ($hl->setting_val(CrayonSettings::WRAP_TOGGLE)) {
                $buttons['wrap'] = crayon__('Toggle Line Wrap');
            }
            if ($hl->setting_val(CrayonSettings::EXPAND_TOGGLE)) {
                $buttons['expand'] = crayon__('Expand Code');
            }
            if (!$touch && $hl->setting_val(CrayonSettings::PLAIN) && $hl->setting_val(CrayonSettings::COPY)) {
                $buttons['copy'] = crayon__('Copy');
            }
            if ($hl->setting_val(CrayonSettings::POPUP)) {
                $buttons['popup'] = crayon__('Open Code In New Window');
            }
            $buttons_str = '';
            foreach ($buttons as $button => $value) {
                $buttons_str .= '<div class="crayon-button crayon-' . $button . '-button"';
                if (!is_array($value)) {
                    $value = array('title' => $value);
                }
                foreach ($value as $k => $v) {
                    $buttons_str .= ' ' . $k . '="' . $v . '"';
                }
                $buttons_str .= '><div class="crayon-button-icon"></div></div>';
            }
            /*	The table is rendered invisible by CSS and enabled with JS when asked to. If JS
            		 is not enabled or fails, the toolbar won't work so there is no point to display it. */
            $print_plus = $hl->is_mixed() && $hl->setting_val(CrayonSettings::SHOW_MIXED) ? '<span class="crayon-mixed-highlight" title="' . crayon__('Contains Mixed Languages') . '"></span>' : '';
            $buttons = $print_plus . $buttons_str . $print_lang;
            $toolbar = '
			<div class="crayon-toolbar" data-settings="' . $toolbar_settings . '" style="' . $toolbar_style . '">' . $print_title . '
			<div class="crayon-tools" style="' . $toolbar_style . '">' . $buttons . '</div></div>
			<div class="crayon-info" style="' . $info_style . '"></div>';
        } else {
            $toolbar = $buttons = $plain_settings = '';
        }
        if (empty($error) && $hl->setting_val(CrayonSettings::PLAIN)) {
            // Different events to display plain code
            switch ($hl->setting_index(CrayonSettings::SHOW_PLAIN)) {
                case 0:
                    $plain_settings = 'dblclick';
                    break;
                case 1:
                    $plain_settings = 'click';
                    break;
                case 2:
                    $plain_settings = 'mouseover';
                    break;
                default:
                    $plain_settings = '';
            }
            if ($hl->setting_val(CrayonSettings::SHOW_PLAIN_DEFAULT)) {
                $plain_settings .= ' show-plain-default';
            }
            $tab = $hl->setting_val(CrayonSettings::TAB_SIZE);
            // TODO doesn't seem to work at the moment
            $plain_style = "-moz-tab-size:{$tab}; -o-tab-size:{$tab}; -webkit-tab-size:{$tab}; tab-size:{$tab};";
            $readonly = $touch ? '' : 'readonly';
            $print_plain = $print_plain_button = '';
            $textwrap = !$hl->setting_val(CrayonSettings::WRAP) ? 'wrap="soft"' : '';
            $print_plain = '<textarea ' . $textwrap . ' class="crayon-plain print-no" data-settings="' . $plain_settings . '" ' . $readonly . ' style="' . $plain_style . ' ' . $font_style . '">' . "\n" . self::clean_code($hl->code()) . '</textarea>';
        } else {
            $print_plain = $plain_settings = $plain_settings = '';
        }
        // Line numbers visibility
        $num_vis = $num_settings = '';
        if ($line_numbers === FALSE) {
            $num_vis = 'crayon-invisible';
        } else {
            $num_settings = $hl->setting_val(CrayonSettings::NUMS) ? 'show' : 'hide';
        }
        // Determine scrollbar visibility
        $code_settings .= $hl->setting_val(CrayonSettings::SCROLL) && !$touch ? ' scroll-always' : ' scroll-mouseover';
        // Disable animations
        if ($hl->setting_val(CrayonSettings::DISABLE_ANIM)) {
            $code_settings .= ' disable-anim';
        }
        // Wrap
        if ($hl->setting_val(CrayonSettings::WRAP)) {
            $code_settings .= ' wrap';
        }
        // Expand
        if ($hl->setting_val(CrayonSettings::EXPAND)) {
            $code_settings .= ' expand';
        }
        // Determine dimensions
        if ($hl->setting_val(CrayonSettings::HEIGHT_SET)) {
            $height_style = self::dimension_style($hl, CrayonSettings::HEIGHT);
            // XXX Only set height for main, not code (if toolbar always visible, code will cover main)
            if ($hl->setting_index(CrayonSettings::HEIGHT_UNIT) == 0) {
                $main_style .= $height_style;
            }
        }
        if ($hl->setting_val(CrayonSettings::WIDTH_SET)) {
            $width_style = self::dimension_style($hl, CrayonSettings::WIDTH);
            $code_style .= $width_style;
            if ($hl->setting_index(CrayonSettings::WIDTH_UNIT) == 0) {
                $main_style .= $width_style;
            }
        }
        // Determine margins
        if ($hl->setting_val(CrayonSettings::TOP_SET)) {
            $code_style .= ' margin-top: ' . $hl->setting_val(CrayonSettings::TOP_MARGIN) . 'px;';
        }
        if ($hl->setting_val(CrayonSettings::BOTTOM_SET)) {
            $code_style .= ' margin-bottom: ' . $hl->setting_val(CrayonSettings::BOTTOM_MARGIN) . 'px;';
        }
        if ($hl->setting_val(CrayonSettings::LEFT_SET)) {
            $code_style .= ' margin-left: ' . $hl->setting_val(CrayonSettings::LEFT_MARGIN) . 'px;';
        }
        if ($hl->setting_val(CrayonSettings::RIGHT_SET)) {
            $code_style .= ' margin-right: ' . $hl->setting_val(CrayonSettings::RIGHT_MARGIN) . 'px;';
        }
        // Determine horizontal alignment
        $align_style = ' float: none;';
        switch ($hl->setting_index(CrayonSettings::H_ALIGN)) {
            case 1:
                $align_style = ' float: left;';
                break;
            case 2:
                $align_style = ' float: none; margin-left: auto; margin-right: auto;';
                break;
            case 3:
                $align_style = ' float: right;';
                break;
        }
        $code_style .= $align_style;
        // Determine allowed float elements
        if ($hl->setting_val(CrayonSettings::FLOAT_ENABLE)) {
            $clear_style = ' clear: none;';
        } else {
            $clear_style = ' clear: both;';
        }
        $code_style .= $clear_style;
        // Determine if operating system is mac
        $crayon_os = CrayonUtil::is_mac() ? 'mac' : 'pc';
        // Produce output
        $output .= '
		<div id="' . $uid . '" class="crayon-syntax crayon-theme-' . $theme_id_dashed . ' crayon-font-' . $font_id_dashed . ' crayon-os-' . $crayon_os . ' print-yes notranslate" data-settings="' . $code_settings . '" style="' . $code_style . ' ' . $font_style . '">
		' . $toolbar . '
			<div class="crayon-plain-wrap">' . $print_plain . '</div>' . '
			<div class="crayon-main" style="' . $main_style . '">
				<table class="crayon-table">
					<tr class="crayon-row">';
        if ($print_nums !== FALSE) {
            $output .= '
				<td class="crayon-nums ' . $num_vis . '" data-settings="' . $num_settings . '">
					<div class="crayon-nums-content" style="' . $font_style . '">' . $print_nums . '</div>
				</td>';
        }
        // XXX
        $output .= '
						<td class="crayon-code"><div class="crayon-pre" style="' . $font_style . '">' . $print_code . '</div></td>
					</tr>
				</table>
			</div>
		</div>';
        // Debugging stats
        $runtime = $hl->runtime();
        if (!$hl->setting_val(CrayonSettings::DISABLE_RUNTIME) && is_array($runtime) && !empty($runtime)) {
            $output = '<!-- Crayon Syntax Highlighter v' . $CRAYON_VERSION . ' -->' . CRAYON_NL . $output . CRAYON_NL . '<!-- ';
            foreach ($hl->runtime() as $type => $time) {
                $output .= '[' . $type . ': ' . sprintf('%.4f seconds', $time) . '] ';
            }
            $output .= '-->' . CRAYON_NL;
        }
        // Determine whether to print to screen or save
        if ($print) {
            echo $output;
        } else {
            return $output;
        }
    }
    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 &gt; Settings &gt; 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 &gt; 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;
    }
 private function init()
 {
     global $CRAYON_VERSION;
     crayon_load_plugin_textdomain();
     self::$cache_array = array(crayon__('Hourly') => 3600, crayon__('Daily') => 86400, crayon__('Weekly') => 604800, crayon__('Monthly') => 18144000, crayon__('Immediately') => 1);
     $settings = array(new CrayonSetting(self::VERSION, $CRAYON_VERSION, NULL, TRUE), new CrayonSetting(self::THEME, CrayonThemes::DEFAULT_THEME), new CrayonSetting(self::FONT, CrayonFonts::DEFAULT_FONT), new CrayonSetting(self::FONT_SIZE_ENABLE, FALSE), new CrayonSetting(self::FONT_SIZE, 12), new CrayonSetting(self::PREVIEW, TRUE), new CrayonSetting(self::HEIGHT_SET, FALSE), new CrayonSetting(self::HEIGHT_MODE, array(crayon__('Max'), crayon__('Min'), crayon__('Static'))), new CrayonSetting(self::HEIGHT, '500'), new CrayonSetting(self::HEIGHT_UNIT, array(crayon__('Pixels'), crayon__('Percent'))), new CrayonSetting(self::WIDTH_SET, FALSE), new CrayonSetting(self::WIDTH_MODE, array(crayon__('Max'), crayon__('Min'), crayon__('Static'))), new CrayonSetting(self::WIDTH, '500'), new CrayonSetting(self::WIDTH_UNIT, array(crayon__('Pixels'), crayon__('Percent'))), new CrayonSetting(self::TOP_SET, TRUE), new CrayonSetting(self::TOP_MARGIN, 12), new CrayonSetting(self::BOTTOM_SET, TRUE), new CrayonSetting(self::BOTTOM_MARGIN, 12), new CrayonSetting(self::LEFT_SET, FALSE), new CrayonSetting(self::LEFT_MARGIN, 12), new CrayonSetting(self::RIGHT_SET, FALSE), new CrayonSetting(self::RIGHT_MARGIN, 12), new CrayonSetting(self::H_ALIGN, array(crayon__('None'), crayon__('Left'), crayon__('Center'), crayon__('Right'))), new CrayonSetting(self::FLOAT_ENABLE, FALSE), new CrayonSetting(self::TOOLBAR, array(crayon__('On MouseOver'), crayon__('Always'), crayon__('Never'))), new CrayonSetting(self::TOOLBAR_OVERLAY, TRUE), new CrayonSetting(self::TOOLBAR_HIDE, TRUE), new CrayonSetting(self::TOOLBAR_DELAY, TRUE), new CrayonSetting(self::COPY, TRUE), new CrayonSetting(self::POPUP, TRUE), new CrayonSetting(self::SHOW_LANG, array(crayon__('When Found'), crayon__('Always'), crayon__('Never'))), new CrayonSetting(self::SHOW_TITLE, TRUE), new CrayonSetting(self::STRIPED, TRUE), new CrayonSetting(self::MARKING, TRUE), new CrayonSetting(self::START_LINE, 1), new CrayonSetting(self::NUMS, TRUE), new CrayonSetting(self::NUMS_TOGGLE, TRUE), new CrayonSetting(self::TRIM_WHITESPACE, TRUE), new CrayonSetting(self::TAB_SIZE, 4), new CrayonSetting(self::FALLBACK_LANG, CrayonLangs::DEFAULT_LANG), new CrayonSetting(self::LOCAL_PATH, ''), new CrayonSetting(self::SCROLL, FALSE), new CrayonSetting(self::PLAIN, TRUE), new CrayonSetting(self::PLAIN_TOGGLE, TRUE), new CrayonSetting(self::SHOW_PLAIN_DEFAULT, FALSE), new CrayonSetting(self::SHOW_PLAIN, array(crayon__('On Double Click'), crayon__('On Single Click'), crayon__('On MouseOver'), crayon__('Disable Mouse Events'))), new CrayonSetting(self::DISABLE_ANIM, FALSE), new CrayonSetting(self::TOUCHSCREEN, TRUE), new CrayonSetting(self::DISABLE_RUNTIME, FALSE), new CrayonSetting(self::ERROR_LOG, TRUE), new CrayonSetting(self::ERROR_LOG_SYS, TRUE), new CrayonSetting(self::ERROR_MSG_SHOW, TRUE), new CrayonSetting(self::ERROR_MSG, crayon__('An error has occurred. Please try again later.')), new CrayonSetting(self::HIDE_HELP, FALSE), new CrayonSetting(self::CACHE, array_keys(self::$cache_array), 1), new CrayonSetting(self::EFFICIENT_ENQUEUE, FALSE), new CrayonSetting(self::CAPTURE_PRE, TRUE), new CrayonSetting(self::CAPTURE_MINI_TAG, TRUE), new CrayonSetting(self::MIXED, TRUE), new CrayonSetting(self::SHOW_MIXED, TRUE), new CrayonSetting(self::PLAIN_TAG, TRUE), new CrayonSetting(self::ENQUEUE_THEMES, TRUE), new CrayonSetting(self::ENQUEUE_FONTS, TRUE), new CrayonSetting(self::MAIN_QUERY, FALSE), new CrayonSetting(self::SAFE_ENQUEUE, TRUE), new CrayonSetting(self::INLINE_TAG, TRUE), new CrayonSetting(self::INLINE_MARGIN, 5), new CrayonSetting(self::INLINE_WRAP, TRUE), new CrayonSetting(self::BACKQUOTE, TRUE), new CrayonSetting(self::COMMENTS, TRUE), new CrayonSetting(self::DECODE, FALSE), new CrayonSetting(self::DECODE_ATTRIBUTES, TRUE), new CrayonSetting(self::TINYMCE_USED, FALSE), new CrayonSetting(self::ATTR_SEP, array(':', '_')), new CrayonSetting(self::EXCERPT_STRIP, FALSE));
     $this->set($settings);
 }
Ejemplo n.º 8
0
    public static function content()
    {
        self::initSettings();
        $theme = CrayonResources::themes()->get_default();
        $editing = false;
        if (isset($_GET['curr_theme'])) {
            $currTheme = CrayonResources::themes()->get($_GET['curr_theme']);
            if ($currTheme) {
                $theme = $currTheme;
            }
        }
        if (isset($_GET['editing'])) {
            $editing = CrayonUtil::str_to_bool($_GET['editing'], FALSE);
        }
        $tInformation = crayon__("Information");
        $tHighlighting = crayon__("Highlighting");
        $tFrame = crayon__("Frame");
        $tLines = crayon__("Lines");
        $tNumbers = crayon__("Line Numbers");
        $tToolbar = crayon__("Toolbar");
        $tBackground = crayon__("Background");
        $tText = crayon__("Text");
        $tBorder = crayon__("Border");
        $tTopBorder = crayon__("Top Border");
        $tBottomBorder = crayon__("Bottom Border");
        $tBorderRight = crayon__("Right Border");
        $tHover = crayon__("Hover");
        $tActive = crayon__("Active");
        $tPressed = crayon__("Pressed");
        $tHoverPressed = crayon__("Pressed & Hover");
        $tActivePressed = crayon__("Pressed & Active");
        $tTitle = crayon__("Title");
        $tButtons = crayon__("Buttons");
        $tNormal = crayon__("Normal");
        $tInline = crayon__("Inline");
        $tStriped = crayon__("Striped");
        $tMarked = crayon__("Marked");
        $tStripedMarked = crayon__("Striped & Marked");
        $tLanguage = crayon__("Language");
        $top = '.crayon-top';
        $bottom = '.crayon-bottom';
        $hover = ':hover';
        $active = ':active';
        $pressed = '.crayon-pressed';
        ?>

    <div
            id="icon-options-general" class="icon32"></div>
    <h2>
        Crayon Syntax Highlighter
        <?php 
        crayon_e('Theme Editor');
        ?>
    </h2>

    <h3 id="<?php 
        echo self::$settings['prefix'];
        ?>
-name">
        <?php 
        //			if ($editing) {
        //				echo sprintf(crayon__('Editing "%s" Theme'), $theme->name());
        //			} else {
        //				echo sprintf(crayon__('Creating Theme From "%s"'), $theme->name());
        //			}
        ?>
    </h3>
    <div id="<?php 
        echo self::$settings['prefix'];
        ?>
-info"></div>

    <p>
        <a id="crayon-editor-back" class="button-primary"><?php 
        crayon_e("Back To Settings");
        ?>
</a>
        <a id="crayon-editor-save" class="button-primary"><?php 
        crayon_e("Save");
        ?>
</a>
        <span id="crayon-editor-status"></span>
    </p>

    <?php 
        //crayon_e('Use the Sidebar on the right to change the Theme of the Preview window.')
        ?>

    <div id="crayon-editor-top-controls"></div>

    <table id="crayon-editor-table" style="width: 100%;" cellspacing="5"
           cellpadding="0">
        <tr>
            <td id="crayon-editor-preview-wrapper">
                <div id="crayon-editor-preview"></div>
            </td>
            <div id="crayon-editor-preview-css"></div>
            <td id="crayon-editor-control-wrapper">
                <div id="crayon-editor-controls">
                    <ul>
                        <li title="<?php 
        echo $tInformation;
        ?>
"><a class="crayon-tab-information" href="#tabs-1"></a></li>
                        <li title="<?php 
        echo $tHighlighting;
        ?>
"><a class="crayon-tab-highlighting" href="#tabs-2"></a></li>
                        <li title="<?php 
        echo $tFrame;
        ?>
"><a class="crayon-tab-frame" href="#tabs-3"></a></li>
                        <li title="<?php 
        echo $tLines;
        ?>
"><a class="crayon-tab-lines" href="#tabs-4"></a></li>
                        <li title="<?php 
        echo $tNumbers;
        ?>
"><a class="crayon-tab-numbers" href="#tabs-5"></a></li>
                        <li title="<?php 
        echo $tToolbar;
        ?>
"><a class="crayon-tab-toolbar" href="#tabs-6"></a></li>
                    </ul>
                    <div id="tabs-1">
                        <?php 
        self::createAttributesForm(array(new CrayonHTMLTitle($tInformation)));
        ?>
                        <div id="tabs-1-contents"></div>
                        <!-- Auto-filled by theme_editor.js -->
                    </div>
                    <div id="tabs-2">
                        <?php 
        $highlight = ' .crayon-pre';
        $elems = array('c' => crayon__("Comment"), 's' => crayon__("String"), 'p' => crayon__("Preprocessor"), 'ta' => crayon__("Tag"), 'k' => crayon__("Keyword"), 'st' => crayon__("Statement"), 'r' => crayon__("Reserved"), 't' => crayon__("Type"), 'm' => crayon__("Modifier"), 'i' => crayon__("Identifier"), 'e' => crayon__("Entity"), 'v' => crayon__("Variable"), 'cn' => crayon__("Constant"), 'o' => crayon__("Operator"), 'sy' => crayon__("Symbol"), 'n' => crayon__("Notation"), 'f' => crayon__("Faded"), 'h' => crayon__("HTML"), '' => crayon__("Unhighlighted"));
        $atts = array(new CrayonHTMLTitle($tHighlighting));
        foreach ($elems as $class => $name) {
            $fullClass = $class != '' ? $highlight . ' .crayon-' . $class : $highlight;
            $atts[] = array($name, self::createAttribute($fullClass, 'color'), self::createAttribute($fullClass, 'font-weight'), self::createAttribute($fullClass, 'font-style'), self::createAttribute($fullClass, 'text-decoration'));
        }
        self::createAttributesForm($atts);
        ?>
                    </div>
                    <div id="tabs-3">
                        <?php 
        $inline = '-inline';
        self::createAttributesForm(array(new CrayonHTMLTitle($tFrame), new CrayonHTMLSeparator($tNormal), array($tBorder, self::createAttribute('', 'border-width'), self::createAttribute('', 'border-color'), self::createAttribute('', 'border-style')), new CrayonHTMLSeparator($tInline), self::createAttribute($inline, 'background', $tBackground), array($tBorder, self::createAttribute($inline, 'border-width'), self::createAttribute($inline, 'border-color'), self::createAttribute($inline, 'border-style'))));
        ?>
                    </div>
                    <div id="tabs-4">
                        <?php 
        $stripedLine = ' .crayon-striped-line';
        $markedLine = ' .crayon-marked-line';
        $stripedMarkedLine = ' .crayon-marked-line.crayon-striped-line';
        self::createAttributesForm(array(new CrayonHTMLTitle($tLines), new CrayonHTMLSeparator($tNormal), self::createAttribute('', 'background', $tBackground), new CrayonHTMLSeparator($tStriped), self::createAttribute($stripedLine, 'background', $tBackground), new CrayonHTMLSeparator($tMarked), self::createAttribute($markedLine, 'background', $tBackground), array($tBorder, self::createAttribute($markedLine, 'border-width'), self::createAttribute($markedLine, 'border-color'), self::createAttribute($markedLine, 'border-style')), self::createAttribute($markedLine . $top, 'border-top-style', $tTopBorder), self::createAttribute($markedLine . $bottom, 'border-bottom-style', $tBottomBorder), new CrayonHTMLSeparator($tStripedMarked), self::createAttribute($stripedMarkedLine, 'background', $tBackground)));
        ?>
                    </div>
                    <div id="tabs-5">
                        <?php 
        $nums = ' .crayon-table .crayon-nums';
        $stripedNum = ' .crayon-striped-num';
        $markedNum = ' .crayon-marked-num';
        $stripedMarkedNum = ' .crayon-marked-num.crayon-striped-num';
        self::createAttributesForm(array(new CrayonHTMLTitle($tNumbers), array($tBorderRight, self::createAttribute($nums, 'border-right-width'), self::createAttribute($nums, 'border-right-color'), self::createAttribute($nums, 'border-right-style')), new CrayonHTMLSeparator($tNormal), self::createAttribute($nums, 'background', $tBackground), self::createAttribute($nums, 'color', $tText), new CrayonHTMLSeparator($tStriped), self::createAttribute($stripedNum, 'background', $tBackground), self::createAttribute($stripedNum, 'color', $tText), new CrayonHTMLSeparator($tMarked), self::createAttribute($markedNum, 'background', $tBackground), self::createAttribute($markedNum, 'color', $tText), array($tBorder, self::createAttribute($markedNum, 'border-width'), self::createAttribute($markedNum, 'border-color'), self::createAttribute($markedNum, 'border-style')), self::createAttribute($markedNum . $top, 'border-top-style', $tTopBorder), self::createAttribute($markedNum . $bottom, 'border-bottom-style', $tBottomBorder), new CrayonHTMLSeparator($tStripedMarked), self::createAttribute($stripedMarkedNum, 'background', $tBackground), self::createAttribute($stripedMarkedNum, 'color', $tText)));
        ?>
                    </div>
                    <div id="tabs-6">
                        <?php 
        $toolbar = ' .crayon-toolbar';
        $title = ' .crayon-title';
        $button = ' .crayon-button';
        $info = ' .crayon-info';
        $language = ' .crayon-language';
        self::createAttributesForm(array(new CrayonHTMLTitle($tToolbar), new CrayonHTMLSeparator($tFrame), self::createAttribute($toolbar, 'background', $tBackground), array($tBottomBorder, self::createAttribute($toolbar, 'border-bottom-width'), self::createAttribute($toolbar, 'border-bottom-color'), self::createAttribute($toolbar, 'border-bottom-style')), array($tTitle, self::createAttribute($title, 'color'), self::createAttribute($title, 'font-weight'), self::createAttribute($title, 'font-style'), self::createAttribute($title, 'text-decoration')), new CrayonHTMLSeparator($tButtons), self::createAttribute($button, 'background-color', $tBackground), self::createAttribute($button . $hover, 'background-color', $tHover), self::createAttribute($button . $active, 'background-color', $tActive), self::createAttribute($button . $pressed, 'background-color', $tPressed), self::createAttribute($button . $pressed . $hover, 'background-color', $tHoverPressed), self::createAttribute($button . $pressed . $active, 'background-color', $tActivePressed), new CrayonHTMLSeparator($tInformation . ' ' . crayon__("(Used for Copy/Paste)")), self::createAttribute($info, 'background', $tBackground), array($tText, self::createAttribute($info, 'color'), self::createAttribute($info, 'font-weight'), self::createAttribute($info, 'font-style'), self::createAttribute($info, 'text-decoration')), array($tBottomBorder, self::createAttribute($info, 'border-bottom-width'), self::createAttribute($info, 'border-bottom-color'), self::createAttribute($info, 'border-bottom-style')), new CrayonHTMLSeparator($tLanguage), array($tText, self::createAttribute($language, 'color'), self::createAttribute($language, 'font-weight'), self::createAttribute($language, 'font-style'), self::createAttribute($language, 'text-decoration')), self::createAttribute($language, 'background-color', $tBackground)));
        ?>
                    </div>
                </div>
            </td>
        </tr>

    </table>

    <?php 
        exit;
    }