Exemplo n.º 1
0
        $verData = explode(".", $AVersion);
        $verTotal = 0;
        for ($i = 0; $i < Count($verData); $i++) {
            $verTotal *= 1000;
            $verTotal += $verData[$i];
        }
        return $verTotal;
    } else {
        return "2015.0.2.1";
    }
}
function devfmt_DefaultPublicCSS()
{
    return "  .devcode, .devcodelines, .devcodeblock, .devcodetools {\n    padding: 0;\n    margin: 0;\n    font-size: 12px;\n    font-family: courier new;\n  }\n  .devcode {\n    padding: 0px 5px;\n    color: #000;\n    color: #666;\n  }\n  .devcodeoverflow {\n    margin: 1px;\n    overflow: auto;\n    overflow-x: auto;\n    overflow-y: auto;\n  }\n  .devcodelines {\n    padding-left: 5px;\n    padding-right: 5px;\n    background: #888;\n    color: #fff;\n    border-right: 4px solid #6E6;\n  }\n  .devcodelinesodd {\n    background: #999;\n  }\n  .devcodelinesarea {\n    background: #fff;\n  }\n  .devcodelinesareaodd {\n    background: #f0f0f0;\n  }\n  .devcodetools {\n    background: transparent;\n    color: #888;\n    text-align: left;\n  }\n  .devcodetools span {\n    cursor: pointer;\n  }";
}
$DevFmt_DefaultPublicCSS = devfmt_DefaultPublicCSS();
function devfmt_DefaultPublicCSSBlue()
{
    return "  .devcode, .devcodelines, .devcodeblock, .devcodetools {\n    padding: 0;\n    margin: 0;\n    font-size: 12px;\n    font-family: courier new;\n  }\n  .devcode {\n    padding: 0px 5px;\n    color: #000;\n    border: 1px solid #5A9AC0;\n  }\n  .devcodeline {\n    border: 0px;\n  }\n  .devcodeoverflow {\n    margin: 1px;\n    overflow: auto;\n    overflow-x: auto;\n    overflow-y: auto;\n  }\n  .devcodelines {\n    padding-left: 5px;\n    padding-right: 5px;\n    background: #729EB9;\n    color: #fff;\n    border-right: 4px solid #6E6;\n  }\n  .devcodelinesodd {\n    background: #628EA9;\n  }\n  .devcodelinesarea {\n    background: #fff;\n  }\n  .devcodelinesareaodd {\n    background: #f0f0f0;\n  }\n  .devcodetools {\n    background: transparent;\n    color: #000;\n    text-align: left;\n  }\n  .devcodetools span {\n    cursor: pointer;\n  }";
}
$DevFmt_DefaultPublicCSSBlue = devfmt_DefaultPublicCSSBlue();
function devfmt_DefaultPublicCSSSummer()
{
    return "  .devcode, .devcodelines, .devcodeblock, .devcodetools {\n    padding: 0;\n    margin: 0;\n    font-size: 12px;\n    font-family: courier new;\n  }\n  .devcode {\n    padding: 0px 5px;\n    color: #000;\n    border: 1px solid #fa0;\n  }\n  .devcodeline {\n    border: 0px;\n  }\n  .devcodeoverflow {\n    margin: 1px;\n    overflow: auto;\n    overflow-x: auto;\n    overflow-y: auto;\n  }\n  .devcodelines {\n    padding-left: 5px;\n    padding-right: 5px;\n    background: #ff0;\n    font-weight: bold;\n    color: #aa4801;\n    border-right: 4px solid #fd8;\n  }\n  .devcodelinesodd {\n    background: #f70;\n  }\n  .devcodelinesarea {\n    background: #ffd;\n  }\n  .devcodelinesareaodd {\n    background: #ffb;\n  }\n  .devcodetools {\n    background: transparent;\n    color: #000;\n    text-align: left;\n  }\n  .devcodetools span {\n    cursor: pointer;\n  }";
}
$DevFmt_DefaultPublicCSSSummer = devfmt_DefaultPublicCSSSummer();
function devfmt_DevFmtAvaliableLangs()
{
    return array("4cs.php:GADV 4CS", "6502acme.php:MOS 6502 (6510) ACME Cross Assembler format", "6502kickass.php:MOS 6502 (6510) Kick Assembler format", "6502tasm.php:MOS 6502 (6510) TASM/64TASS 1.46 Assembler format", "68000devpac.php:Motorola 68000 - HiSoft Devpac ST 2 Assembler format", "abap.php:ABAP", "actionscript.php:ActionScript", "actionscript3.php:ActionScript 3", "ada.php:Ada", "algol68.php:ALGOL 68", "apache.php:Apache configuration", "applescript.php:AppleScript", "apt_sources.php:Apt sources", "arm.php:ARM ASSEMBLER", "asm.php:ASM", "asp.php:ASP", "asymptote.php:asymptote", "autoconf.php:Autoconf", "autohotkey.php:Autohotkey", "autoit.php:AutoIt", "avisynth.php:AviSynth", "awk.php:awk", "bascomavr.php:BASCOM AVR", "bash.php:Bash", "basic4gl.php:Basic4GL", "bf.php:Brainfuck", "bibtex.php:BibTeX", "blitzbasic.php:BlitzBasic", "bnf.php:bnf", "boo.php:Boo", "c.php:C", "caddcl.php:CAD DCL", "cadlisp.php:CAD Lisp", "cfdg.php:CFDG", "cfm.php:ColdFusion", "chaiscript.php:ChaiScript", "cil.php:CIL", "clojure.php:Clojure", "cmake.php:CMake", "cobol.php:COBOL", "coffeescript.php:CoffeeScript", "cpp-qt.php:C++ (Qt)", "cpp.php:C++", "csharp.php:C#", "css.php:CSS", "cuesheet.php:Cuesheet", "c_loadrunner.php:C (LoadRunner)", "c_mac.php:C (Mac)", "d.php:D", "dcl.php:DCL", "dcpu16.php:DCPU-16 Assembly", "dcs.php:DCS", "delphi.php:Delphi", "diff.php:Diff", "div.php:DIV", "dos.php:DOS", "dot.php:dot", "e.php:E", "ecmascript.php:ECMAScript", "eiffel.php:Eiffel", "email.php:eMail (mbox)", "epc.php:EPC", "erlang.php:Erlang", "euphoria.php:Euphoria", "f1.php:Formula One", "falcon.php:Falcon", "fo.php:FO (abas-ERP)", "fortran.php:Fortran", "freebasic.php:FreeBasic", "freeswitch.php:FreeSWITCH", "fsharp.php:F#", "gambas.php:GAMBAS", "gdb.php:GDB", "genero.php:genero", "genie.php:Genie", "gettext.php:GNU Gettext", "glsl.php:glSlang", "gml.php:GML", "gnuplot.php:Gnuplot", "go.php:Go", "groovy.php:Groovy", "gwbasic.php:GwBasic", "haskell.php:Haskell", "haxe.php:Haxe", "hicest.php:HicEst", "hq9plus.php:HQ9+", "html4strict.php:HTML", "html5.php:HTML5", "icon.php:Icon", "idl.php:Uno Idl", "ini.php:INI", "inno.php:Inno", "intercal.php:INTERCAL", "io.php:Io", "j.php:J", "java.php:Java", "java5.php:Java(TM) 2 Platform Standard Edition 5.0", "javascript.php:Javascript", "jquery.php:jQuery", "kixtart.php:KiXtart", "klonec.php:KLone C", "klonecpp.php:KLone C++", "latex.php:LaTeX", "lb.php:Liberty BASIC", "ldif.php:LDIF", "lisp.php:Lisp", "llvm.php:LLVM Intermediate Representation", "locobasic.php:Locomotive Basic", "logtalk.php:Logtalk", "lolcode.php:LOLcode", "lotusformulas.php:Lotus Notes @Formulas", "lotusscript.php:LotusScript", "lscript.php:LScript", "lsl2.php:LSL2", "lua.php:Lua", "m68k.php:Motorola 68000 Assembler", "magiksf.php:MagikSF", "make.php:GNU make", "mapbasic.php:MapBasic", "matlab.php:Matlab M", "mirc.php:mIRC Scripting", "mmix.php:MMIX", "modula2.php:Modula-2", "modula3.php:Modula-3", "mpasm.php:Microchip Assembler", "mxml.php:MXML", "mysql.php:MySQL", "nagios.php:Nagios", "netrexx.php:NetRexx", "newlisp.php:newlisp", "nsis.php:NSIS", "oberon2.php:Oberon-2", "objc.php:Objective-C", "objeck.php:Objeck Programming Language", "ocaml-brief.php:OCaml (brief)", "ocaml.php:OCaml", "octave.php:GNU Octave", "oobas.php:OpenOffice.org Basic", "oorexx.php:ooRexx", "oracle11.php:Oracle 11 SQL", "oracle8.php:Oracle 8 SQL", "oxygene.php:Oxygene (Delphi Prism)", "oz.php:OZ", "parasail.php:ParaSail", "parigp.php:PARI/GP", "pascal.php:Pascal", "pcre.php:PCRE", "per.php:per", "perl.php:Perl", "perl6.php:Perl 6", "pf.php:OpenBSD Packet Filter", "php-brief.php:PHP (brief)", "php.php:PHP", "pic16.php:PIC16", "pike.php:Pike", "pixelbender.php:Pixel Bender 1.0", "pli.php:PL/I", "plsql.php:PL/SQL", "postgresql.php:PostgreSQL", "povray.php:POVRAY", "powerbuilder.php:PowerBuilder", "powershell.php:PowerShell", "proftpd.php:ProFTPd configuration", "progress.php:Progress", "prolog.php:Prolog", "properties.php:PROPERTIES", "providex.php:ProvideX", "purebasic.php:PureBasic", "pys60.php:Python for S60", "python.php:Python", "q.php:q/kdb+", "qbasic.php:QBasic/QuickBASIC", "rails.php:Rails", "rebol.php:REBOL", "reg.php:Microsoft Registry", "rexx.php:rexx", "robots.php:robots.txt", "rpmspec.php:RPM Specification File", "rsplus.php:R / S+", "ruby.php:Ruby", "sas.php:SAS", "scala.php:Scala", "scheme.php:Scheme", "scilab.php:SciLab", "sdlbasic.php:sdlBasic", "smalltalk.php:Smalltalk", "smarty.php:Smarty", "spark.php:SPARK", "sparql.php:SPARQL", "sql.php:SQL", "stonescript.php:StoneScript", "systemverilog.php:SystemVerilog", "tcl.php:TCL", "teraterm.php:Tera Term Macro", "text.php:Text", "thinbasic.php:thinBasic", "tsql.php:T-SQL", "typoscript.php:TypoScript", "unicon.php:Unicon (Unified Extended Dialect of Icon)", "upc.php:UPC", "urbi.php:Urbi", "uscript.php:Unreal Script", "vala.php:Vala", "vb.php:Visual Basic", "vbnet.php:vb.net", "vedit.php:Vedit macro language", "verilog.php:Verilog", "vhdl.php:VHDL", "vim.php:Vim Script", "visualfoxpro.php:Visual Fox Pro", "visualprolog.php:Visual Prolog", "whitespace.php:Whitespace", "whois.php:Whois (RPSL format)", "winbatch.php:Winbatch", "xbasic.php:XBasic", "xml.php:XML", "xorg_conf.php:Xorg configuration", "xpp.php:X++", "yaml.php:YAML", "z80.php:ZiLOG Z80 Assembler", "zxbasic.php:ZXBasic");
}
function devfmt_ReadConfig()
Exemplo n.º 2
0
function devfmt_addPage()
{
    global $DevFmt_Config, $DevFmt_ParsedCode, $DevFmt_SuppLangs;
    if (!current_user_can('manage_options')) {
        return false;
    }
    devfmt_ReadConfigAndLangs();
    if (isset($_POST)) {
        if (isset($_POST['UpdateConfig'])) {
            check_admin_referer('devfmt-update-config');
            $DevFmt_Config['geshilangpath'] = str_replace("\\\\", "\\", $_POST['geshilangpath']);
            $DevFmt_Config['geshiuselink'] = isset($_POST['geshiuselink']) ? "1" : "0";
            $DevFmt_Config['displaylinenumbers'] = isset($_POST['displaylinenumbers']) ? "1" : "0";
            $DevFmt_Config['usedevformat'] = isset($_POST['usedevformat']) ? "1" : "0";
            $DevFmt_Config['devfmtcss'] = $_POST['devfmtcss'];
            $DevFmt_Config['linkjquery'] = isset($_POST['linkjquery']) ? "1" : "0";
            $DevFmt_Config['highlighttags'] = isset($_POST['highlighttags']) ? "1" : "0";
            $DevFmt_Config['copyclipboartext'] = $_POST['copyclipboartext'];
            $DevFmt_Config['hookrss2'] = isset($_POST['hookrss2']) ? "1" : "0";
            $DevFmt_Config['parsepre'] = isset($_POST['parsepre']) ? "1" : "0";
            $DevFmt_Config['showtools'] = isset($_POST['showtools']) ? "1" : "0";
            $DevFmt_Config['useajaxparse'] = isset($_POST['useajaxparse']) ? "1" : "0";
            devfmt_UpdateConfig();
        }
    }
    if ($DevFmt_Config['geshilangpath'] == "") {
        $DevFmt_Config['geshilangpath'] = DEVFMT_GESHIPATH;
    }
    ?>
	<div class="wrap">
    <div id="icon-options-general" class="icon32"><br /></div>
		<h2>DevFormatter <span style="font-size:15px"><em><?php 
    echo devfmt_Version();
    ?>
</em></span></h2>
    <h3>Configurations</h3>
    <form method="post" action="options-general.php?page=devformatter/devformatter.php">
    <?php 
    wp_nonce_field('devfmt-update-config');
    ?>
    <fieldset class="options">
    <table>
    <tbody>
    <tr valign="top">
    <th scope="row" align="right"><br />DevFormatter:</th>
    <td>
      <table class="form-table">
      <tbody>

      <tr valign="top">
      <td scope="row"><strong><input name="usedevformat" type="checkbox"<?php 
    echo $DevFmt_Config['usedevformat'] ? " checked" : "";
    ?>
/> <label for="usedevformat">Use DevFormatter System</label></strong><br />
      Checkout the diference:<br />
      <table width="100%"><tbody><tr>
      <td valign="top">
      <?php 
    $ExampleCode = "Here is a sample of my <strong>PHP code</strong>:\r\n<code lang=\"php\">  function GimmeGimmeAText(){\r\n    return \"Take here, a text.\";\r\n  }\r\n  echo GimmeGimmeAText();</code>\r\nCan you take it?\r\n";
    ?>
      <strong>Page/Post content:</strong>
      <pre style="background:#fff;padding:4px;border:1px solid #ccc"><?php 
    echo htmlentities($ExampleCode);
    ?>
</pre>
      </td>
      </tr><tr>
      <td valign="top">
      <strong>DevFormatter display:</strong>
      <div style="background:#fff;padding:4px;border:1px solid #ccc" lang="PHP"><?php 
    $DevFmt_ParsedCode = devfmt_ContentGrabCode($ExampleCode);
    $ContentCheck = devfmt_ContentCheckCode($DevFmt_ParsedCode[0], true, null);
    echo $ContentCheck[1];
    ?>
</div>
      <script language="JavaScript"><!--
        if(typeof(jQuery) != "undefined"){
          jQuery(function($){ devfmt_createTools('devcode'); })
        }else
          alert("jQuery problem.");
      //--></script>
      </td>
      </tr><tr>
      <td valign="top">
      <strong>WordPress display:</strong>
      <div style="background:#fff;padding:4px;border:1px solid #ccc;" lang="PHP"><?php 
    $DevFmt_ParsedCode = devfmt_ContentGrabCode($ExampleCode);
    $ContentCheck = devfmt_ContentCheckCode($DevFmt_ParsedCode[0], true, null);
    if ($ContentCheck[0]) {
        echo wpautop(wptexturize($ContentCheck[1]));
    }
    ?>
</div>
      </td>
      </tr></tbody></table>
      </td>
      </tr>

      <tr valign="top">
      <td scope="row"><strong><input name="displaylinenumbers" type="checkbox"<?php 
    echo $DevFmt_Config['displaylinenumbers'] ? " checked" : "";
    ?>
/> <label for="displaylinenumbers">Display Line Numbers</label></strong><br />
      This option can be overwrited by forcing line display selecting "<strong>Display Line numbers?</strong>" on the page/post Editor.
      </td>
      </tr>

      <tr valign="top">
      <td scope="row"><strong><label for="copyclipboartext">Copy to Clipboard Text</label></strong><br />
      <input name="copyclipboartext" type="text" value="<?php 
    echo $DevFmt_Config['copyclipboartext'];
    ?>
" size="80" />
      </td>
      </tr>

      <tr valign="top">
      <td scope="row"><strong><input name="showtools" type="checkbox"<?php 
    echo $DevFmt_Config['showtools'] ? " checked" : "";
    ?>
/> <label for="showtools">Show toolbar before code</label></strong><br />
      This option will create a toolbar with copy code and plain display buttons.
      </td>
      </tr>

      <tr valign="top">
      <td scope="row"><strong><label for="copyclipboartext">Custom CSS</label></strong><br />
      <textarea name="devfmtcss" rows="6" cols="60"><?php 
    echo $DevFmt_Config['devfmtcss'];
    ?>
</textarea>
      <br /><input type="button" value="Default CSS" onclick="devfmt_cssdefault()">&nbsp;-&nbsp;<input type="button" value="Blue Theme CSS" onclick="devfmt_cssdefaultblue()">&nbsp;-&nbsp;<input type="button" value="Summer Theme CSS" onclick="devfmt_cssdefaultsummer()">
      <br />If you have recently updated DevFormatter click <strong>"Default CSS" or "Blue Theme CSS"</strong> to get new improvements on CSS layout configurations.
      <script language="JavaScript"><!--
        devfmt_cssdefault = function(){ document.forms[0].devfmtcss.value = "<?php 
    echo str_replace("\n", "\\r\\n\" + \r\n \"", devfmt_DefaultPublicCSS());
    ?>
"; }
        devfmt_cssdefaultblue = function(){ document.forms[0].devfmtcss.value = "<?php 
    echo str_replace("\n", "\\r\\n\" + \r\n \"", devfmt_DefaultPublicCSSBlue());
    ?>
"; }
        devfmt_cssdefaultsummer = function(){ document.forms[0].devfmtcss.value = "<?php 
    echo str_replace("\n", "\\r\\n\" + \r\n \"", devfmt_DefaultPublicCSSSummer());
    ?>
"; }
      //--></script>
      </td>
      </tr>

      <tr valign="top">
      <td scope="row"><strong><input name="hookrss2" type="checkbox"<?php 
    echo $DevFmt_Config['hookrss2'] ? " checked" : "";
    ?>
/> <label for="hookrss2">Format code for with RSS 2.0</label></strong><br />
      This option will format blocks of code on RSS 2.0 output (Direct RSS2.0 entry only with IE7+).
      </td>
      </tr>

      <tr valign="top">
      <td scope="row"><strong><input name="parsepre" type="checkbox"<?php 
    echo $DevFmt_Config['parsepre'] ? " checked" : "";
    ?>
/> <label for="parsepre">Parse PRE Tags with language attribute as code block</label></strong><br />
      Format PRE Tag with language attribute as blocks of code (Compatibility with some Writer applications as Live Writer).
      </td>
      </tr>

      <tr valign="top">
      <td scope="row"><strong><input name="linkjquery" type="checkbox"<?php 
    echo $DevFmt_Config['linkjquery'] ? " checked" : "";
    ?>
/> <label for="linkjquery">Create a link for jQuery</label></strong><br />
      You need to enable this option if you don't already use jQuery on your blog.
      <br /><small><em>Credits for jQuery: <a href="http://jquery.com/">http://jquery.com/</a></em></small>
      </td>
      </tr>

      <tr valign="top">
      <td scope="row"><strong><input name="useajaxparse" type="checkbox"<?php 
    echo $DevFmt_Config['useajaxparse'] ? " checked" : "";
    ?>
/> <label for="useajaxparse">Use AJAX DevFormatter System</label></strong><br />
      You need to enable this option to format the code with the parse ajax system, active it when your WP become slow with the current settings.<br />
      <em>(Is really recommended to use a Cache Plugin to get a better performance)</em>
      </td>
      </tr>

      </tbody>
      </table>
    </td>
    </tr>

    <tr valign="top">
    <th scope="row" align="right"><br />GeSHI:</th>
    <td>
      <table class="form-table">
      <tbody>
      <tr valign="top">
      <td scope="row"><strong><label for="geshilangpath">GeSHI Languages Path</label></strong><br />
      <input name="geshilangpath" type="text" value="<?php 
    echo $DevFmt_Config['geshilangpath'];
    ?>
" size="80" />
      <br />Your default path = <?php 
    echo DEVFMT_GESHIPATH;
    ?>
      <br /><span style="color:red">If the directory permission block php to write files, you'll have to upload files to the site ftp yourself (Get the <input type="button" onclick="javascript:window.open('http://svn.wp-plugins.org/devformatter/branches/langs/langs.zip')" value="full language pack here"/> if you want)</span>.
      </td>
      </tr>
      <tr valign="top">
      <td scope="row"><strong><input name="geshiuselink" type="checkbox"<?php 
    echo $DevFmt_Config['geshiuselink'] ? " checked" : "";
    ?>
/> <label for="geshiuselink">Display Links on reserved words</label></strong><br />
      Create a link on a reserved work of the language to a website helper.
      </td>
      </tr>
      <tr valign="top">
      <td scope="row"><strong><label for="geshiuselink">Downloaded Languages</label></strong><br />
      You have downloaded <strong><?php 
    echo Count($DevFmt_SuppLangs);
    ?>
</strong> of <?php 
    echo Count(devfmt_DevFmtAvaliableLangs());
    ?>
 supported languages.
      <div style="background:#fff;border:1px solid #ccc;height:200px;overflow:auto">
<?php 
    $FavLangs = array();
    foreach ($DevFmt_SuppLangs as $Lang) {
        if ($Lang['fav']) {
            $FavLangs[] = $Lang['langname'];
        }
        echo "<li><strong>&middot;" . $Lang['langname'] . "</strong><br /><dd>\r\n        " . DEVFMT_GESHIPATH . DIRECTORY_SEPARATOR . $Lang['langfile'] . "</dd></li>";
    }
    ?>
      </div>
      <strong>Favorite language(s):</strong>
      '<?php 
    echo implode("', '", $FavLangs);
    ?>
'
      <br /><small><em>Credits for GeSHi: <a href="http://qbnz.com/highlighter/">http://qbnz.com/highlighter/</a></em></small>
      </td>
      </tr>
      </tbody>
      </table>
    </td>
    </tr>

    </tbody>
    </table>
    </fieldset>
    <p class="submit"><input type="submit" name="UpdateConfig" class="button-primary" value="Save Changes" /></p>
    </form>
  </div>
<?php 
}