public static function log()
 {
     $log = CrayonLog::log();
     touch(CRAYON_LOG_FILE);
     $exists = file_exists(CRAYON_LOG_FILE);
     $writable = is_writable(CRAYON_LOG_FILE);
     if (!empty($log)) {
         echo '<div id="crayon-log-wrapper">', '<div id="crayon-log"><div id="crayon-log-text">', $log, '</div></div>', '<div id="crayon-log-controls">', '<input type="button" id="crayon-log-toggle" show_txt="', crayon__('Show Log'), '" hide_txt="', crayon__('Hide Log'), '" class="button-secondary" value="', crayon__('Show Log'), '"> ', '<input type="submit" id="crayon-log-clear" name="', self::LOG_CLEAR, '" class="button-secondary" value="', crayon__('Clear Log'), '"> ', '<input type="submit" id="crayon-log-email" name="', self::LOG_EMAIL_ADMIN . '" class="button-secondary" value="', crayon__('Email Admin'), '"> ', '<input type="submit" id="crayon-log-email" name="', self::LOG_EMAIL_DEV, '" class="button-secondary" value="', crayon__('Email Developer'), '"> ', '</div>', '</div>';
     }
     echo '<span', !empty($log) ? ' class="crayon-span"' : '', '>', empty($log) ? crayon__('The log is currently empty.') . ' ' : '';
     if ($exists) {
         $writable ? crayon_e('The log file exists and is writable.') : crayon_e('The log file exists and is not writable.');
     } else {
         crayon_e('The log file does not exist and is not writable.');
     }
     echo '</span>';
 }
		</tr>
<!--		<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>
    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;
    }
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>

<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>
	</tr>
Пример #5
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;
    }