Plugin Directory

Changeset 1327921


Ignore:
Timestamp:
01/13/2016 11:45:30 PM (10 years ago)
Author:
GMDragonX
Message:

Update plugin to version 1.4.1!
Fixed some bugs.

Location:
gmace
Files:
2 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • gmace/trunk/assets/css/style.css

    r1221233 r1327921  
    134134    border-bottom: 1px solid;
    135135}
    136 #filedit #text_file #gm_slider > div {
     136#filedit #text_file #gm_slider .hide-files {
     137    position: absolute;
     138    top: 0;
     139    left: 0;
     140    right: 140px;
     141    bottom: 0;
     142    overflow: hidden;
     143}
     144#filedit #text_file #gm_slider .hide-files > div {
    137145    position: absolute;
     146    top: 0; bottom: 0;
    138147    min-width: 100%;
    139     bottom: 0;
    140148    overflow: hidden;
    141149}
     
    168176}
    169177#filedit #text_file #gm_slider a.close_editor {
    170     position: absolute;
    171     width: 15px;height: 15px;
    172     top: 0;bottom: 0;right: 5px;
    173     margin: auto;
    174     transition: .1s;
    175     font-weight: bold;
    176     font-family: arial;
    177     font-size: 10px;
    178 }
    179 #filedit #text_file #gm_slider a.close_editor:hover {
    180     border-radius: 5px;
     178    position: absolute;
     179    top: -1px; bottom: 0; right: 10px;
     180    width: 15px;
     181    height: 15px;
     182    line-height: 15px;
     183    margin: auto;
     184    opacity: 0;
     185    z-index: 2;
     186   
     187    font-family: FontAwesome;
     188    text-align: center;
     189    font-size: 15px;
     190    color: white;
     191    text-rendering: auto;
     192    -webkit-font-smoothing: antialiased;
     193    -moz-osx-font-smoothing: grayscale;
     194   
     195    transition: 200ms;
     196    -webkit-transition: 200ms;
     197    -moz-transition: 200ms;
     198    -o-transition: 200ms;
     199}
     200#filedit #text_file #gm_slider p.tab_editor:hover a.close_editor {
     201    opacity: 1;
     202}
     203#filedit #text_file #gm_slider a.close_editor:before {
     204    content: "\f00d";
    181205}
    182206#filedit #text_file #gm_hotbar {
     
    305329    margin: 0;
    306330}
    307 [name="linePos"] {
    308     width: 80px;
     331#linePos {
     332    position: absolute;
     333    top: 0;
     334    bottom: 0;
     335    right: 0;
     336    width: 139px;
     337    padding: 0;
     338    padding-left: 15px;
     339    margin: 0;
     340    box-shadow: none;
     341    border: none;
     342    font-family: monospace;
    309343}
    310344
  • gmace/trunk/assets/js/scripts.js

    r1221244 r1327921  
    1 (function($){
    2 
    3     $(document).on("ready", function(){
    4        
    5         if(getCookie("gmace_pars")){
     1(function($)
     2{
     3    $(document).on("ready", function()
     4    {
     5        if(getCookie("gmace_pars"))
     6        {
    67            var THEME_EDITOR = JSON.parse(getCookie("gmace_pars")).theme || "dreamweaver";
    78            $("#filedit").addClass(JSON.parse(getCookie("gmace_pars")).side || "left");
     
    910            $("#gm_actions [name='theme_editor']").val(THEME_EDITOR);
    1011            $("#gm_actions [name='sidebarside']").val(JSON.parse(getCookie("gmace_pars")).side || "left");
    11         }else{
     12        }
     13        else
     14        {
    1215            var THEME_EDITOR = "dreamweaver";
    1316        }
     
    2730        $("#filedit #file ul.folder-objects[data-dir-folder='/www']").parent().addClass("open");
    2831       
    29        
    30         setTrigger();
    31        
    3232        var openTabs = getCookie("opentabs");
    33         if(openTabs){
     33        if(openTabs)
     34        {
    3435            openTabs = JSON.parse(openTabs);
    35             if(openTabs.files.length){
     36            if(openTabs.files.length)
     37            {
    3638                for(var jcount = 0; jcount < openTabs.files.length; jcount++)
    37                     if(openTabs.files[jcount]){
     39                {
     40                    if(openTabs.files[jcount])
     41                    {
    3842                        addNewWindowEditor(openTabs.files[jcount]);
    3943                    }
    40             }else{
     44                }
     45            }
     46            else
     47            {
    4148                addNewWindowEditor();
    4249            }
    43         }else{
     50        }
     51        else
     52        {
    4453            addNewWindowEditor();
    4554        }
     
    4756       
    4857    /* ------------------------ EVENT HOTBAR'S BUTTON ------------------------- */
    49         $("#gm_hotbar div[data-action='full-mode']").on("click", function(){
    50             if($("#filedit").hasClass("full-mode")){
     58        $("#gm_hotbar div[data-action='full-mode']").on("click", function()
     59        {
     60            if($("#filedit").hasClass("full-mode"))
     61            {
    5162                $("#filedit").removeClass("full-mode");
    5263                $("#filedit #text_file").after($("#filedit #file"));
    53             }else{
     64            }
     65            else
     66            {
    5467                $("#filedit").addClass("full-mode");
    5568                $("#filedit #file").appendTo($("#filedit #text_file"));
     
    5770            changePar("resize");
    5871        });
    59         $("#gm_hotbar div[data-action='new-window-editor']").on("click", function(){
     72        $("#gm_hotbar div[data-action='new-window-editor']").on("click", function()
     73        {
    6074            addNewWindowEditor();
    6175        });
    62         $("#gm_hotbar div[data-action='open-actions-menu']").on("click", function(){
    63            
     76        $("#gm_hotbar div[data-action='action-save-file']").on('click',function()
     77            {
     78                writeToFile($("#gm_editors div.shown").data("editor"));
     79            }
     80        );
     81        $("#gm_hotbar div[data-action='open-actions-menu']").on("click", function()
     82        {
    6483            $("#file").removeClass("expand");
    65             $("#gm_actions").toggleClass("expand")
    66                
     84            $("#gm_actions").toggleClass("expand");
    6785        });
    68         $("#gm_hotbar div[data-action='open-file-menu']").on("click", function(){
    69            
     86        $("#gm_hotbar div[data-action='open-file-menu']").on("click", function()
     87        {
    7088            $("#gm_actions").removeClass("expand");
    71             $("#file").toggleClass("expand")
    72            
     89            $("#file").toggleClass("expand");
    7390        });
    7491       
    75        
    76        
    77         $("#savefile").on('click',function(){
    78             writeToFile($("#gm_editors div.shown").data("editor"));
    79         });
    80         setInterval(function(){
    81             $(".gm_success:not(.checked), .gm_error:not(.checked)").each(function(){
     92        $("#gm_slider .hide-files").on("wheel", function(e)
     93            {
     94                var currentPosLeft = $("#gm_slider .hide-files > div").position().left;
     95                var scrollSize = 40;
     96               
     97                if(e.originalEvent.deltaY > 0 && $("#gm_slider .hide-files > div").width() + currentPosLeft > $("#gm_slider .hide-files").width())
     98                {
     99                    $("#gm_slider .hide-files > div").css("left", currentPosLeft - scrollSize);
     100                }
     101                else if(e.originalEvent.deltaY < 0 && currentPosLeft + scrollSize <= 0)
     102                {
     103                    $("#gm_slider .hide-files > div").css("left", currentPosLeft + scrollSize);
     104                }
     105            }
     106        );
     107       
     108        $("#gm_actions [name='theme_editor']").on('change', function()
     109            {
     110                changeGMAceParametrs();
     111                changePar("theme", $(this).val());
     112                THEME_EDITOR = $(this).val();
     113            }
     114        );
     115        $("#gm_actions [name='sidebarside']").on('change', function()
     116            {
     117                changeGMAceParametrs();
     118                $("#filedit").removeClass("left right").addClass($(this).val());
     119            }
     120        );
     121        $("#gm_actions input[name='wrapping']").on('change', function()
     122            {
     123                changePar("wrapping", $(this).prop("checked"));
     124            }
     125        );
     126        $("#gm_actions input[name='printMargin']").on('change', function()
     127            {
     128                changePar("printMargin", $(this).prop("checked"));
     129            }
     130        );
     131        $("#linePos").on('change', function()
     132            {
     133                var sessLen = $("#gm_editors div.shown").data("editor").session.getLength();
     134                if($(this).val() > sessLen)
     135                {
     136                    $(this).data("val", sessLen);
     137                }
     138                $("#gm_editors div.shown").data("editor").gotoLine($(this).val());
     139            }
     140        );
     141        setInterval(function()
     142        {
     143            if($("#linePos").data("val") != $("#linePos").val())
     144            {
     145                $("#linePos").data("val", $("#linePos").val()).trigger("change");
     146            }
     147           
     148            $(".gm_success:not(.checked), .gm_error:not(.checked)").each(function(){
    82149                var e = $(this);
    83150               
     
    88155                setTimeout(function(){ e.trigger("click"); }, 5000);
    89156            });
    90         }, 100);
    91        
    92         $("#gm_actions [name='theme_editor']").on('change', function(){
    93             changeGMAceParametrs();
    94             changePar("theme", $(this).val());
    95             THEME_EDITOR = $(this).val();
    96         });
    97         $("#gm_actions [name='sidebarside']").on('change', function(){
    98             changeGMAceParametrs();
    99             $("#filedit").removeClass("left right").addClass($(this).val());
    100         });
    101         $("#gm_actions input[name='wrapping']").on('change', function(){
    102             changePar("wrapping", $(this).prop("checked"));
    103         });
    104         $("#gm_actions input[name='printMargin']").on('change', function(){
    105             changePar("printMargin", $(this).prop("checked"));
    106         });
    107         $("#gm_actions input[name='linePos']").on('change', function(){
    108             if($(this).val() > $("#gm_editors div.shown").data("editor").session.getLength())
    109                 $(this).val($("#gm_editors div.shown").data("editor").session.getLength());
    110             $("#gm_editors div.shown").data("editor").gotoLine($(this).val());
    111         });
     157        }, 100);
    112158       
    113159       
    114160       
    115161       
    116         function changeGMAceParametrs(){
     162        function changeGMAceParametrs()
     163        {
    117164            var parsArray = JSON.stringify({
    118165                "theme": $("#gm_actions [name='theme_editor']").val(),
     
    120167            });
    121168           
    122             var date = new Date(new Date().getTime() + 604800);
     169            var date = new Date(new Date().getTime() + 31536000000);
    123170            document.cookie = "gmace_pars="+parsArray+"; path=/; expires=" + date.toUTCString();
    124171        }
    125172       
    126173       
    127         function changePar(par, val){
    128             $("#gm_editors > div").each(function(){
    129                 switch(par){
     174        function changePar(par, val)
     175        {
     176            $("#gm_editors > div").each(function()
     177            {
     178                switch(par)
     179                {
    130180                    case "theme":
    131181                        $(this).data("editor").setTheme("ace/theme/"+val);
    132182                    break;
     183                   
    133184                    case "wrapping":
    134185                        $(this).data("editor").getSession().setUseWrapMode(val);
    135186                        $(this).data("editor").resize();
    136187                    break;
     188                   
    137189                    case "resize":
    138190                        $(this).data("editor").resize();
    139191                    break;
     192                   
    140193                    case "printMargin":
    141194                        $(this).data("editor").setShowPrintMargin(val);
     
    147200       
    148201       
    149         function setTrigger(){
    150            
    151             $("ul.folder-objects li").off().on('click', function(e){
    152                 e.preventDefault();
    153                
    154                 if($(this).hasClass("obj-folder") && e.which == 1){
    155                    
    156                     if($(this).children("ul.folder-objects").hasClass("expand")){
    157                         $(this).removeClass("open").children("ul.folder-objects").slideUp().removeClass("expand");
    158                     }else{
    159                         $(this).addClass("open").children("ul.folder-objects").slideDown().addClass("expand");
    160                     }
    161                    
    162                 }else if($(this).hasClass("obj-file")){
    163                     if($("#gm_editors div").length)
    164                         readFromFile($("#gm_editors div.shown").data("editor"), $(this).closest("ul.folder-objects").data("dir-folder") + "/" + $(this).text());
    165                     else
    166                         addNewWindowEditor($(this).closest("ul.folder-objects").data("dir-folder") + "/" + $(this).text());
    167                 }
    168                
    169                 return false;
    170             }).on("mousedown", function(e){
    171                 e.preventDefault();
    172                
    173                 if($(this).hasClass("obj-file") && e.which == 2){
    174                    
    175                     $(this).off("mouseup");
    176                     $(this).on("mouseup", function(e){
    177                         if(e.which == 2){
    178                             addNewWindowEditor($(this).closest("ul.folder-objects").data("dir-folder") + "/" + $(this).text());
    179                         }
    180                     });
    181                    
    182                 }
    183                
    184                 return false;
    185             }).on("contextmenu", function(e){
    186                 if(!e.shiftKey){
    187                     openPropertyFile(e.pageY + 5, e.pageX + 5, $(this));
     202        $("#file").on("mousedown", function(e)
     203            {
     204                var $this = $(e.target);
     205               
     206                if($this.closest("ul.folder-objects li").length)
     207                {
     208                    $this = $this.closest("ul.folder-objects li");
     209                   
     210                    if($this.hasClass("obj-file") && e.which == 2)
     211                    {
     212                        e.preventDefault();
     213                       
     214                        $this.off("mouseup");
     215                        $this.on("mouseup", function(e)
     216                            {
     217                                if(e.which == 2)
     218                                {
     219                                    addNewWindowEditor($this.closest("ul.folder-objects").data("dir-folder") + "/" + $this.text());
     220                                }
     221                            }
     222                        );
     223                       
     224                        return false;
     225                    }
     226                }
     227            }
     228        ).on("click", function(e)
     229            {
     230                var $this = $(e.target);
     231               
     232                if($this.closest("ul.folder-objects li").length)
     233                {
     234                    $this = $this.closest("ul.folder-objects li");
     235                   
     236                    if($this.hasClass("obj-folder") && e.which == 1)
     237                    {
     238                        if($this.children("ul.folder-objects").hasClass("expand"))
     239                        {
     240                            $this.removeClass("open").children("ul.folder-objects").slideUp().removeClass("expand");
     241                        }
     242                        else
     243                        {
     244                            $this.addClass("open").children("ul.folder-objects").slideDown().addClass("expand");
     245                        }
     246                       
     247                    }
     248                    else if($this.hasClass("obj-file"))
     249                    {
     250                        if($("#gm_editors div").length)
     251                            readFromFile($("#gm_editors div.shown").data("editor"), $this.closest("ul.folder-objects").data("dir-folder") + "/" + $this.text());
     252                        else
     253                            addNewWindowEditor($this.closest("ul.folder-objects").data("dir-folder") + "/" + $this.text());
     254                    }
     255                }
     256               
     257            }
     258        ).on("contextmenu", function(e)
     259            {
     260                if(!e.shiftKey && $(e.target).closest("ul.folder-objects li").length){
     261                    openPropertyFile(e.pageY + 5, e.pageX + 5, $(e.target).closest("ul.folder-objects li"));
    188262                    return false;
    189263                }
    190             });
    191         }
    192        
    193        
    194         function addNewWindowEditor(directory){
    195            
     264            }
     265        );
     266       
     267       
     268        function addNewWindowEditor(directory)
     269        {
    196270            $("#gm_editors div.shown").removeClass("shown");
    197271            $("p.tab_editor.select").removeClass("select");
     
    204278           
    205279            $("#gm_editors").append( $("<div>").data("index", ++icount).data("directory", directory).addClass("shown").attr("id", "gmace-editor-"+icount) );
    206             $("#gm_slider > div").append( $("<p>", {
    207                 class: "tab_editor select",
    208                 html: "<a class='close_editor'></a><span>"+nameFile+"</span>",
    209                 click: function(){
    210                     if(!$(this).hasClass("select")){
    211                         $("p.tab_editor.select").removeClass("select");
    212                         $("#gm_editors div.shown").removeClass("shown");
    213                         $("#gm_editors div#gmace-editor-"+$(this).addClass("select").data("index")).addClass("shown").data("editor").focus();
    214                         $("#gm_editors div.shown").data("editor").resize();
    215                     }
    216                 }
    217             }).data("index", icount).attr("id", "gmace-tab-"+icount).on("mousedown", function(e){
    218                 e.preventDefault();
    219                
    220                 if(e.which == 2){
    221                    
    222                     $(this).off("mouseup");
    223                     $(this).on("mouseup", function(e){
    224                         if(e.which == 2){
    225                            
    226                             if($(this).hasClass("select")){
    227                                 $("#gm_editors div#gmace-editor-"+$(this).data("index")).remove();
    228                                 $(this).remove();
    229                                
    230                                 $("#gmace-editor-"+$("#gm_slider p.tab_editor:first-child").addClass("select").data("index")).addClass("shown");
    231                                 $("#gm_editors div.shown").data("editor").resize();
    232                             }else{
    233                                 $("#gm_editors div#gmace-editor-"+$(this).data("index")).remove();
    234                                 $(this).remove();
    235                             }
    236                            
    237                             saveOpenedTab();
    238                         }
    239                     });
    240                    
    241                 }
    242                
    243                 return false;
    244             }));
     280            $("#gm_slider .hide-files > div").append(
     281                $("<p>", {
     282                    class: "tab_editor select",
     283                    html: "<a class='close_editor'></a><span>"+nameFile+"</span>",
     284                    click: function(e)
     285                    {
     286                        var $this = $(e.target);
     287                       
     288                        if($this.is("#gm_slider a.close_editor"))
     289                        {
     290                            $this.parent().trigger("removeTab");
     291                        }
     292                        else if(!$(this).hasClass("select"))
     293                        {
     294                            var currentEditorScreen = $("#gm_editors div#gmace-editor-" + $(this).data("index"));
     295                            var currentLine = currentEditorScreen.data("editor").getCursorPosition().row + 1;
     296                           
     297                            $("p.tab_editor.select").removeClass("select");
     298                            $("#gm_editors div.shown").removeClass("shown");
     299                            $("#linePos").data("val", currentLine).val(currentLine);
     300                            currentEditorScreen.addClass("shown").data("editor").focus();
     301                            currentEditorScreen.data("editor").resize();
     302                            $(this).addClass("select");
     303                        }
     304                    }
     305                }).data("index", icount).attr("id", "gmace-tab-"+icount).on("mousedown", function(e)
     306                    {
     307                        if(e.which == 2)
     308                        {
     309                            $(this).one("mouseup", function(e)
     310                                {
     311                                    if(e.which == 2)
     312                                    {
     313                                        $(this).trigger("removeTab");
     314                                    }
     315                                }
     316                            );
     317                        }
     318                    }
     319                ).on("removeTab", function()
     320                    {
     321                        if($(this).hasClass("select"))
     322                        {
     323                            $("#gm_editors div#gmace-editor-"+$(this).data("index")).remove();
     324                            $(this).remove();
     325                           
     326                            $("#gmace-editor-"+$("#gm_slider p.tab_editor:first-child").addClass("select").data("index")).addClass("shown");
     327                            $("#gm_editors div.shown").data("editor").resize();
     328                        }
     329                        else
     330                        {
     331                            $("#gm_editors div#gmace-editor-"+$(this).data("index")).remove();
     332                            $(this).remove();
     333                        }
     334                       
     335                        saveOpenedTab();
     336                    }
     337                )
     338            );
    245339           
    246340            var editor_n = ace.edit("gmace-editor-"+icount);
     
    282376            });
    283377           
    284             editor_n.on("focus", function(){
    285                 $("#gm_actions, #file").removeClass("expand");
    286                 $("#gm_editors div.focus").removeClass("focus");
    287             });
    288             editor_n.getSession().selection.on('changeCursor', function(e){
    289                 $("#gm_actions input[name='linePos']").val($("#gm_editors div.shown").data("editor").getCursorPosition().row + 1);
    290                 saveOpenedTab();
    291             });
     378            editor_n.on("focus", function()
     379                {
     380                    $("#gm_actions, #file").removeClass("expand");
     381                    $("#gm_editors div.focus").removeClass("focus");
     382                }
     383            );
     384            editor_n.getSession().selection.on('changeCursor', function(e)
     385                {
     386                    var yPos = $("#gm_editors div.shown").data("editor").getCursorPosition().row + 1;
     387                    $("#linePos").data("val", yPos).val(yPos);
     388                    saveOpenedTab();
     389                }
     390            );
    292391           
    293392            $("#gm_editors div#gmace-editor-"+icount).data("editor", editor_n);
     393            $("#filedit #text_file #gm_slider .hide-files > div").width($("p.tab_editor").width() * $("p.tab_editor").length);
    294394            readFromFile(editor_n);
    295395        }
    296396       
    297397       
    298         function readFromFile(editor, directory){
     398        function readFromFile(editor, directory)
     399        {
    299400           
    300401            directory = directory || $("#gm_editors div.shown").data("directory");
     
    324425       
    325426       
    326         function writeToFile(editor){
     427        function writeToFile(editor)
     428        {
     429            var directory = $("#gm_editors div.shown").data("directory");
    327430            $.post(ajaxurl, {
    328431                action: 'gmace_rewrite_file',
    329432                directory: $("#gm_editors div.shown").data("directory"),
    330433                content: editor.getValue()
    331             }, function(response) {
    332                 $("#messages").append("<div class='gm_success'>"+translated_name.strfile+" <i>"+$("#gm_editors div.shown").data("directory")+"</i> "+translated_name.strrewrited+".</div>");
     434            }, function(response)
     435            {
     436                $("#messages").append("<div class='gm_success'>"+translated_name.strfile+" <i>"+directory+"</i> "+translated_name.strrewrited+".</div>");
    333437            });
    334438        }
    335439       
    336440       
    337         function setModeEditor(editor, filedir){
     441        function setModeEditor(editor, filedir)
     442        {
    338443           
    339444            filedir = filedir.split("/");
     
    342447                filedir = filedir[filedir.length - 1];
    343448           
    344             switch(filedir){
    345                 case "css": case "sass": case "less": {
     449            switch(filedir)
     450            {
     451                case "css": case "sass": case "less":
    346452                    editor.getSession().setMode("ace/mode/css");
    347                 }break;
    348                 case "js": {
     453                break;
     454               
     455                case "js":
    349456                    editor.getSession().setMode("ace/mode/javascript");
    350                 }break;
    351                 case "html": case "htm": case "xhtml": {
     457                break;
     458               
     459                case "html": case "htm": case "xhtml":
    352460                    editor.getSession().setMode("ace/mode/html");
    353                 }break;
    354                 case "htaccess": case "htpasswd": {
     461                break;
     462               
     463                case "htaccess": case "htpasswd":
    355464                    editor.getSession().setMode("ace/mode/apache_conf");
    356                 }break;
    357                 case "java": {
     465                break;
     466               
     467                case "java":
    358468                    editor.getSession().setMode("ace/mode/java");
    359                 }break;
    360                 case "py": {
     469                break;
     470               
     471                case "py":
    361472                    editor.getSession().setMode("ace/mode/python");
    362                 }break;
    363                 default: {
     473                break;
     474               
     475                default:
    364476                    editor.getSession().setMode("ace/mode/php");
    365                 }break;
    366             }
    367         }
    368        
    369        
    370         function saveOpenedTab(){
     477                break;
     478            }
     479        }
     480       
     481       
     482        function saveOpenedTab()
     483        {
    371484            var openedtab = { files: [] };
    372485           
    373             $("#gm_editors > div").each(function(){
    374                 openedtab.files[openedtab.files.length] = encodeURIComponent($(this).data("directory"));
    375             });
     486            $("#gm_editors > div").each(function()
     487                {
     488                    openedtab.files[openedtab.files.length] = encodeURIComponent( $(this).data("directory") );
     489                }
     490            );
    376491           
    377492            openedtab = JSON.stringify(openedtab);
    378493           
    379             var date = new Date(new Date().getTime() + 604800);
     494            var date = new Date(new Date().getTime() + 31536000000);
    380495            document.cookie = "opentabs="+openedtab+"; path=/; expires=" + date.toUTCString();
    381496           
     
    383498       
    384499       
    385         function getCookie(name){
     500        function getCookie(name)
     501        {
    386502            var matches = document.cookie.match(new RegExp(
    387503                    "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
     
    391507       
    392508       
    393         function openPropertyFile(y, x, elementFile){
     509        function openPropertyFile(y, x, elementFile)
     510        {
    394511           
    395512            var directory = (elementFile.closest("ul.folder-objects").data("dir-folder") + "/" + elementFile.children("span").text());
     
    422539                    "class" : "cut",
    423540                    text : translated_name.cut
    424                 }).on("click", function(){
     541                }).on("click", function()
     542                {
    425543                    $("li.obj-folder.transparent").removeClass("transparent");
    426544                    elementFile.addClass("transparent");
     
    435553                    text : translated_name.paste,
    436554                    "buffered" : dirNameAction == null || dirAction == null?"false":"true"
    437                 }).on("click", function(){
     555                }).on("click", function()
     556                {
    438557                    if(dirNameAction != null && dirAction != null)
    439558                        $.post(ajaxurl, {
     
    446565                            elementFile.children("ul").remove();
    447566                            elementFile.append(response).trigger("click");
    448                             setTrigger();
    449567                            elementFile.addClass("open").children("ul").addClass("expand");
    450568                           
     
    453571                                "height":"65px"
    454572                            });
    455                             if(dirAction == "copy"){
     573                            if(dirAction == "copy")
     574                            {
    456575                                $("#property_menu").html("<bold><p>"+translated_name.success_copied+"</p></bold>");
    457                             }else if(dirAction == "cut"){
     576                            }
     577                            else if(dirAction == "cut")
     578                            {
    458579                                $("#property_menu").html("<bold><p>"+translated_name.success_moved+"</p></bold>");
    459580                            }
    460581                           
    461                             if(unlinkUl != null){
     582                            if(unlinkUl != null)
     583                            {
    462584                                unlinkUl.remove();
    463585                            }
     
    470592                    "class" : "rename newhead",
    471593                    text : translated_name.rename
    472                 }).on("click", function(){
     594                }).on("click", function()
     595                {
    473596                    $("#property_menu").addClass("info_run").css({
    474597                        "width":"280px",
    475598                        "height":"65px"
    476599                    }).html("<input type='text' value='"+fileName+"'><input type='button' class='button button-primary' value='"+translated_name.apply+"'>");
    477                     $("#property_menu input.button-primary").on("click", function(){
    478                         $.post(ajaxurl, {
    479                             action: 'gmace_rename_and_delete_file',
    480                             type: "rename",
    481                             newname: $("#property_menu input[type='text']").val(),
    482                             directory: fileDir,
    483                             file: fileName
    484                         }, function(response)
    485                         {
    486                             var parent = elementFile.parent("ul").parent();
    487                            
    488                             parent.children("ul").remove();
    489                             parent.append(response);
    490                             setTrigger();
    491                             parent.addClass("open").children("ul").addClass("expand");
    492                            
    493                             $("#property_menu").html("<bold><p>"+translated_name.success_renamed+"</p></bold>");
    494                         });
    495                     });
     600                   
     601                    $("#property_menu input.button-primary").on("click", function()
     602                        {
     603                            $.post(ajaxurl, {
     604                                action: 'gmace_rename_and_delete_file',
     605                                type: "rename",
     606                                newname: $("#property_menu input[type='text']").val(),
     607                                directory: fileDir,
     608                                file: fileName
     609                            }, function(response)
     610                            {
     611                                var parent = elementFile.parent("ul").parent();
     612                               
     613                                parent.children("ul").remove();
     614                                parent.append(response);
     615                                parent.addClass("open").children("ul").addClass("expand");
     616                               
     617                                $("#property_menu").html("<bold><p>"+translated_name.success_renamed+"</p></bold>");
     618                            });
     619                        }
     620                    );
    496621                })
    497622            ).append(
     
    499624                    "class" : "delete",
    500625                    text : translated_name.delete
    501                 }).on("click", function(){
    502                    
     626                }).on("click", function()
     627                {
    503628                    elementFile.addClass("red");
    504629                   
    505630                    if(confirm(translated_name.reallydelete+" "+fileName+"?"))
     631                    {
    506632                        $.post(ajaxurl, {
    507633                            action: 'gmace_rename_and_delete_file',
     
    509635                            directory: fileDir,
    510636                            file: fileName
    511                         }, function(response){
     637                        }, function(response)
     638                        {
    512639                            var parent = elementFile.parent("ul").parent();
    513640                           
    514641                            parent.children("ul").remove();
    515642                            parent.append(response).trigger("click");
    516                             setTrigger();
    517643                            parent.addClass("open").children("ul").addClass("expand");
    518644                           
     
    522648                            }).html("<bold><p>"+translated_name.success_deleted+"</p></bold>");
    523649                        });
     650                    }
    524651                    else
     652                    {
    525653                        elementFile.removeClass("red");
     654                    }
    526655                })
    527656            ).append(
     
    529658                    "class" : "new_file newhead",
    530659                    text : translated_name.new_file
    531                 }).on("click", function(){
     660                }).on("click", function()
     661                {
    532662                    $("#property_menu").addClass("info_run").css({
    533663                        "width":"280px",
     
    547677                            elementFile.children("ul").remove();
    548678                            elementFile.append(response).trigger("click");
    549                             setTrigger();
    550679                            elementFile.addClass("open").children("ul").addClass("expand");
    551680                           
     
    558687                    "class" : "new_folder",
    559688                    text : translated_name.new_folder
    560                 }).on("click", function(){
     689                }).on("click", function()
     690                {
    561691                    $("#property_menu").addClass("info_run").css({
    562692                        "width":"280px",
     
    564694                    }).html("<input type='text'><input type='button' class='button button-primary' value='"+translated_name.create+"'>");
    565695                   
    566                     $("#property_menu input.button-primary").on("click", function(){
    567                         $.post(ajaxurl, {
    568                             action: 'gmace_create_file',
    569                             type: "folder",
    570                             directory: fileDir+"/"+fileName,
    571                             name: $("#property_menu input[type='text']").val()
    572                         }, function(response)
    573                         {
    574                             var parent = elementFile.parent("ul").parent();
    575                            
    576                             elementFile.children("ul").remove();
    577                             elementFile.append(response).trigger("click");
    578                             setTrigger();
    579                             elementFile.addClass("open").children("ul").addClass("expand");
    580                            
    581                             $("#property_menu").html("<bold><p>"+translated_name.success_created+"</p></bold>");
    582                         });
    583                     });
     696                    $("#property_menu input.button-primary").on("click", function()
     697                        {
     698                            $.post(ajaxurl, {
     699                                action: 'gmace_create_file',
     700                                type: "folder",
     701                                directory: fileDir+"/"+fileName,
     702                                name: $("#property_menu input[type='text']").val()
     703                            }, function(response)
     704                            {
     705                                var parent = elementFile.parent("ul").parent();
     706                               
     707                                elementFile.children("ul").remove();
     708                                elementFile.append(response).trigger("click");
     709                                elementFile.addClass("open").children("ul").addClass("expand");
     710                               
     711                                $("#property_menu").html("<bold><p>"+translated_name.success_created+"</p></bold>");
     712                            });
     713                        }
     714                    );
    584715                })
    585716            ).append(
     
    587718                    "class" : "download newhead",
    588719                    text : translated_name.download
    589                 }).on("click", function(){
    590                     window.open("http://www.developer-wp.com/wp-admin/admin.php?page=gmace-editor&file="+fileDir.replace("/www", "")+"/"+fileName, "_blank");
     720                }).on("click", function()
     721                {
     722                    window.open("/wp-admin/admin.php?page=gmace-editor&file="+fileDir.replace("/www", "")+"/"+fileName, "_blank");
    591723                })
    592724            ).append(
     
    594726                    "class" : "unzip",
    595727                    text : translated_name.unzip
    596                 }).on("click", function(){
     728                }).on("click", function()
     729                {
    597730                   
    598731                })
     
    601734                    "class" : "openinnewtab",
    602735                    text : translated_name.openinnewtab
    603                 }).on("click", function(){
     736                }).on("click", function()
     737                {
    604738                    window.open(fileDir.replace("/www", "")+"/"+fileName, "_blank");
    605739                })
     
    608742                    "class" : "property newhead",
    609743                    text : translated_name.properties
    610                 }).on("click", function(){
     744                }).on("click", function()
     745                {
    611746                    $.post(ajaxurl, {
    612747                        action: 'gmace_get_property_file',
    613748                        directory: fileDir,
    614749                        file: fileName
    615                     }, function(response){
     750                    }, function(response)
     751                    {
    616752                        $("#property_menu").addClass("info_run").html(response);
    617753                    });
     
    624760                $("#property_menu").css({"top": "auto", "bottom": 0});
    625761           
    626             if(fileDir + fileName == "/www" && type_obj == "folder"){
     762            if(fileDir + fileName == "/www" && type_obj == "folder")
     763            {
    627764                $("#property_menu .copy, #property_menu .cut, #property_menu .rename, #property_menu .delete").remove();
    628765            }
    629             if(type_obj == "file"){
     766            if(type_obj == "file")
     767            {
    630768                $("#property_menu .paste, #property_menu .new_folder, #property_menu .new_file").remove();
    631769                if($.inArray(elementFile.attr("type"), archiveFormats) < 0)
     770                {
    632771                    $("#property_menu .unzip").remove();
     772                }
    633773                if($.inArray(elementFile.attr("type"), openingFormats) < 0)
     774                {
    634775                    $("#property_menu .openinnewtab").remove();
    635             }else{
     776                }
     777            }
     778            else
     779            {
    636780                $("#property_menu .download, #property_menu .unzip, #property_menu .openinnewtab").remove();
    637781            }
    638782           
    639783            // Deleting property menu
    640             $(document).off("mousedown").on("mousedown", function(e){
    641                 if(!$(e.target).closest("#property_menu").length){
    642                     $("#property_menu").remove();
    643                 }
    644             });
     784            $(document).off("mousedown").on("mousedown", function(e)
     785                {
     786                    if(!$(e.target).closest("#property_menu").length)
     787                    {
     788                        $("#property_menu").remove();
     789                    }
     790                }
     791            );
    645792        }
    646793       
  • gmace/trunk/assets/languages/gmace-en_UK.po

    r1221233 r1327921  
    1818msgid "description"
    1919msgstr "Free PHP-code editor Wordpress"
     20
     21#. Author of the plugin/theme
     22msgid "action-save-file"
     23msgstr "Зберегти файл"
    2024
    2125#. Author of the plugin/theme
  • gmace/trunk/assets/languages/gmace-en_US.po

    r1221233 r1327921  
    1818msgid "description"
    1919msgstr "Free PHP-code editor Wordpress"
     20
     21#. Author of the plugin/theme
     22msgid "action-save-file"
     23msgstr "Save file"
    2024
    2125#. Author of the plugin/theme
  • gmace/trunk/assets/languages/gmace-ru_RU.po

    r1221233 r1327921  
    1818msgid "description"
    1919msgstr "Свободный PHP-редактор кода Wordpress"
     20
     21#. Author of the plugin/theme
     22msgid "action-save-file"
     23msgstr "Сохранить файл"
    2024
    2125#. Author of the plugin/theme
  • gmace/trunk/gmace.php

    r1221233 r1327921  
    44    Plugin URI: http://wordpress.org/plugins/gmace/
    55    Description: Free PHP-editor code Wordpress. A variety of themes, syntax highlighting and a built file manager
    6     Version: 1.4
     6    Version: 1.4.1
    77    Author: German Mesky
    88    Author URI: http://vk.com/false_coder
     
    1010    define('GMACE_DIR', plugin_dir_path(__FILE__));
    1111    define('GMACE_URL', plugin_dir_url(__FILE__));
    12     define('GMACEPATH', str_replace("\www/", "", ABSPATH));
     12    define('GMACEPATH', ABSPATH);
    1313    if(defined("WPLANG"))
    1414        define('GMACELANG', WPLANG);
     
    1717
    1818
    19 if($_GET['file']){
     19if($_GET['file'])
     20{
    2021    include(ABSPATH."/wp-includes/pluggable.php");
    2122    include(GMACE_DIR."inc/download-manager.php");
     
    2324
    2425
    25 
    26 function gmace_init(){
     26function gmace_init()
     27{
    2728     load_plugin_textdomain('gmace', false, dirname(plugin_basename(__FILE__)).'/assets/languages/');
    28 }add_action('plugins_loaded', 'gmace_init');
     29}
     30add_action('plugins_loaded', 'gmace_init');
    2931
    3032
     
    3234function gmace_add_to_menu()
    3335{
    34     if(!is_user_logged_in() || !current_user_can('administrator')){
     36    if(!is_user_logged_in() || !current_user_can('administrator'))
     37    {
    3538        return;
    3639    }
     
    3942    add_action('admin_print_scripts-'.$page, 'gmace_enqueue_script');
    4043   
    41 }add_action('admin_menu', 'gmace_add_to_menu');
     44}
     45add_action('admin_menu', 'gmace_add_to_menu');
    4246
    4347
     
    4549function gmace_enqueue_script()
    4650{
    47     if(!is_user_logged_in() || !current_user_can('administrator')){
     51    if(!is_user_logged_in() || !current_user_can('administrator'))
     52    {
    4853        return;
    4954    }
     
    8287
    8388
    84 function gmace_spread_page(){ include(GMACE_DIR."inc/editor.php"); }
     89function gmace_spread_page()
     90{
     91    include(GMACE_DIR."inc/editor.php");
     92}
    8593
    8694
     
    9098function gmace_read_file()
    9199
    92     if(!is_user_logged_in() || !current_user_can('administrator')){
     100    if(!is_user_logged_in() || !current_user_can('administrator'))
     101    {
    93102        wp_die();
    94103        return;
     
    98107   
    99108    wp_die();
    100 }add_action('wp_ajax_gmace_action_read', 'gmace_read_file');
     109}
     110add_action('wp_ajax_gmace_action_read', 'gmace_read_file');
    101111
    102112
     
    104114function gmace_rewrite_file()
    105115{
    106     if(!is_user_logged_in() || !current_user_can('administrator')){
     116    if(!is_user_logged_in() || !current_user_can('administrator'))
     117    {
    107118        wp_die();
    108119        return;
     
    113124   
    114125    wp_die();
    115 }add_action('wp_ajax_gmace_rewrite_file', 'gmace_rewrite_file');
     126}
     127add_action('wp_ajax_gmace_rewrite_file', 'gmace_rewrite_file');
    116128
    117129
     
    119131function gmace_get_property_file()
    120132{
    121     if(!is_user_logged_in() || !current_user_can('administrator')){
     133    if(!is_user_logged_in() || !current_user_can('administrator'))
     134    {
    122135        wp_die();
    123136        return;
     
    133146    $size = round($size, 1).$sizeNames[$icount];
    134147   
    135     if(filetype($directory) == "dir"){
     148    if(filetype($directory) == "dir")
     149    {
    136150        print("<p><b>".__('name-directory', 'gmace').": </b>$directory</p>");
    137151        print("<p><b>".__('name-size-of-object', 'gmace').": </b>".$size."</p>");
    138152        print("<p><b>".__('name-type-of-object', 'gmace').": </b><span>".__('name-folder', 'gmace')."</span></p>");
    139     }else{
     153    }
     154    else
     155    {
    140156        print("
    141157        <p>
     
    150166   
    151167    wp_die();
    152 }add_action('wp_ajax_gmace_get_property_file', 'gmace_get_property_file');
     168}
     169add_action('wp_ajax_gmace_get_property_file', 'gmace_get_property_file');
    153170
    154171
     
    156173function gmace_renamedelete_obj()
    157174{
    158     if(!is_user_logged_in() || !current_user_can('administrator')){
     175    if(!is_user_logged_in() || !current_user_can('administrator'))
     176    {
    159177        wp_die();
    160178        return;
     
    167185    elseif($_POST['type']=="delete")
    168186    {
    169         if(filetype(GMACEPATH.$_POST['directory']."/".$_POST['file']) == "dir"){
     187        if(filetype(GMACEPATH.$_POST['directory']."/".$_POST['file']) == "dir")
     188        {
    170189            dir_unlink(GMACEPATH.$_POST['directory']."/".$_POST['file']);
    171190            print(gmace_scan_to($_POST['directory']));
    172         }else{
     191        }
     192        else
     193        {
    173194            unlink(GMACEPATH.$_POST['directory']."/".$_POST['file']);
    174195            print(gmace_scan_to($_POST['directory']));
    175196        }
    176     }else print("error");
    177    
    178     wp_die();
    179 }add_action('wp_ajax_gmace_rename_and_delete_file', 'gmace_renamedelete_obj');
     197    }
     198    else print("error");
     199   
     200    wp_die();
     201}
     202add_action('wp_ajax_gmace_rename_and_delete_file', 'gmace_renamedelete_obj');
    180203
    181204
     
    183206function gmace_create_obj()
    184207{
    185     if(!is_user_logged_in() || !current_user_can('administrator')){
     208    if(!is_user_logged_in() || !current_user_can('administrator'))
     209    {
    186210        wp_die();
    187211        return;
     
    190214    $directory = GMACEPATH.$_POST['directory']."/".$_POST['name'];
    191215   
    192     if(($_POST['type']=="folder" && mkdir($directory)) || ($_POST['type']=="file" && fopen($directory, "w")));
     216    if(($_POST['type'] == "folder" && mkdir($directory)) || ($_POST['type']=="file" && fopen($directory, "w")));
    193217    print(gmace_scan_to($_POST['directory']));
    194218   
    195219    wp_die();
    196 }add_action('wp_ajax_gmace_create_file', 'gmace_create_obj');
     220}
     221add_action('wp_ajax_gmace_create_file', 'gmace_create_obj');
    197222
    198223
     
    200225function gmace_paste_obj()
    201226{
    202     if(!is_user_logged_in() || !current_user_can('administrator')){
    203         wp_die();
    204         return;
    205     }
    206    
    207     if(filetype(GMACEPATH.$_POST['from-directory']) == "dir"){
     227    if(!is_user_logged_in() || !current_user_can('administrator'))
     228    {
     229        wp_die();
     230        return;
     231    }
     232   
     233    if(filetype(GMACEPATH.$_POST['from-directory']) == "dir")
     234    {
    208235        dir_move(GMACEPATH.$_POST['from-directory'], GMACEPATH.$_POST['to-directory'], $_POST['type'] == "cut");
    209236        print(gmace_scan_to($_POST['to-directory']));
    210     }else{
    211         if(file_exists(GMACEPATH.$_POST['to-directory']."/".end(explode("/", $_POST['from-directory'])))){
     237    }
     238    else
     239    {
     240        if(file_exists(GMACEPATH.$_POST['to-directory']."/".end(explode("/", $_POST['from-directory']))))
     241        {
    212242            $from_file = fopen(GMACEPATH.$_POST['from-directory'], "r");
    213243            $to_file = fopen(get_new_name(GMACEPATH.$_POST['from-directory'], GMACEPATH.$_POST['to-directory']), "w+");
    214244           
    215245            $text = "";
    216             while(!feof($from_file)){
     246            while(!feof($from_file))
     247            {
    217248                $text .= fgets($from_file, 999);
    218249            }
     
    223254           
    224255            if($_POST['type'] == "cut")
     256            {
    225257                unlink(GMACEPATH.$_POST['from-directory']);
     258            }
    226259           
    227260            print(gmace_scan_to($_POST['to-directory']));
    228         }else{
    229             if(copy(GMACEPATH.$_POST['from-directory'], GMACEPATH.$_POST['to-directory']."/".basename($_POST['from-directory']))){
     261        }
     262        else
     263        {
     264            if(copy(GMACEPATH.$_POST['from-directory'], GMACEPATH.$_POST['to-directory']."/".basename($_POST['from-directory'])))
     265            {
    230266                if($_POST['type'] == "cut")
    231267                    unlink(GMACEPATH.$_POST['from-directory']);
     
    236272   
    237273    wp_die();
    238 }add_action('wp_ajax_gmace_paste_file', 'gmace_paste_obj');
     274}
     275add_action('wp_ajax_gmace_paste_file', 'gmace_paste_obj');
    239276
    240277
     
    242279function gmace_scan_to($directory)
    243280{
    244     if(!is_user_logged_in() || !current_user_can('administrator')){
     281    if(!is_user_logged_in() || !current_user_can('administrator'))
     282    {
    245283        wp_die();
    246284        return;
     
    256294    $obj = scandir(GMACEPATH.$directory);
    257295    if($obj)
    258         foreach($obj as $index => $val){
    259             if(filetype(GMACEPATH.$directory."/".$val) == "dir"){
    260                 if($val != "." && $val != ".."){
     296    {
     297        foreach($obj as $index => $val)
     298        {
     299            if(filetype(GMACEPATH.$directory."/".$val) == "dir")
     300            {
     301                if($val != "." && $val != "..")
     302                {
    261303                    $folders[$folder_id]=$val;
    262304                    $folder_id++;
    263305                }
    264             }else{
     306            }
     307            else
     308            {
    265309                $files[$file_id]=$val;
    266310                $file_id++;
    267311            }
    268312        }
     313    }
    269314
    270315    //------  SORT  -------//
    271     for($i = 0; $i < $folder_id; $i++){
     316    for($i = 0; $i < $folder_id; $i++)
     317    {
    272318        $fd.="<li class='obj-folder'><span>".$folders[$i]."</span>".(gmace_scan_to($directory."/".$folders[$i]))."</li>";
    273319    }
    274     for($i = 0; $i < $file_id; $i++){
     320    for($i = 0; $i < $file_id; $i++)
     321    {
    275322        $fd.="<li class='obj-file' type='".end(explode('.', $files[$i]))."'><span><a>".$files[$i]."</a></span></li>";
    276323    }
     
    283330function dir_move($dirFrom, $dirTo, $flag)
    284331{
    285     if(!is_user_logged_in() || !current_user_can('administrator')){
     332    if(!is_user_logged_in() || !current_user_can('administrator'))
     333    {
    286334        wp_die();
    287335        return;
     
    290338    $errors = 0;
    291339   
    292     if(file_exists($dirTo."/".basename($dirFrom)."/")){
     340    if(file_exists($dirTo."/".basename($dirFrom)."/"))
     341    {
    293342        $dirTo = get_new_name($dirFrom, $dirTo);
    294     }else{
     343    }
     344    else
     345    {
    295346        $dirTo .= "/".basename($dirFrom)."/";
    296347    }
    297348   
    298349    if(!file_exists($dirTo))
     350    {
    299351        mkdir($dirTo);
     352    }
    300353       
    301     foreach(scandir($dirFrom) as $index => $val){
    302         if(filetype($dirFrom."/".$val) == "dir"){
    303             if($val != "." && $val != ".."){
     354    foreach(scandir($dirFrom) as $index => $val)
     355    {
     356        if(filetype($dirFrom."/".$val) == "dir")
     357        {
     358            if($val != "." && $val != "..")
     359            {
    304360                $errors += dir_move($dirFrom."/".$val, $dirTo, $flag);
    305361            }
    306         }else{
     362        }
     363        else
     364        {
    307365            if(!copy($dirFrom."/".$val, $dirTo."/".$val))
     366            {
    308367                $errors++;
     368            }
    309369        }
    310370    }
    311371   
    312372    if($flag)
     373    {
    313374        dir_unlink($dirFrom);
     375    }
    314376   
    315377    return $errors == 0;
     
    320382function get_new_name($dirFrom, $dirTo)
    321383{
    322     if(!is_user_logged_in() || !current_user_can('administrator')){
     384    if(!is_user_logged_in() || !current_user_can('administrator'))
     385    {
    323386        wp_die();
    324387        return;
     
    329392    $newname = explode(".", end($newname_r));
    330393   
    331     if(filetype($dirFrom) == "dir"){
    332         while(file_exists($dirTo."/".$newname[count($newname)-1]."-".$icount)){
     394    if(filetype($dirFrom) == "dir")
     395    {
     396        while(file_exists($dirTo."/".$newname[count($newname)-1]."-".$icount))
     397        {
    333398            $icount++;
    334399        }
     
    337402        $newname_r[count($newname_r) - 1] = implode(".", $newname);
    338403        $newname_r = implode("/", $newname_r);
    339     }else{
    340         while(file_exists($dirTo."/".$newname[count($newname)-2]."-".$icount.".".$newname[count($newname)-1])){
     404    }
     405    else
     406    {
     407        while(file_exists($dirTo."/".$newname[count($newname)-2]."-".$icount.".".$newname[count($newname)-1]))
     408        {
    341409            $icount++;
    342410        }
     
    354422function dir_unlink($directory)
    355423{
    356     if(!is_user_logged_in() || !current_user_can('administrator')){
     424    if(!is_user_logged_in() || !current_user_can('administrator'))
     425    {
    357426        wp_die();
    358427        return;
     
    361430    $errors = 0;
    362431   
    363     foreach(scandir($directory) as $index=>$val){
    364         if(filetype($directory."/".$val) == "dir"){
    365             if($val!="." && $val!=".."){
     432    foreach(scandir($directory) as $index=>$val)
     433    {
     434        if(filetype($directory."/".$val) == "dir")
     435        {
     436            if($val!="." && $val!="..")
     437            {
    366438                $errors += dir_unlink($directory."/".$val);
    367439            }
    368         }else{
     440        }
     441        else
     442        {
    369443            if(!unlink($directory."/".$val))
    370444                $errors++;
     
    373447   
    374448    if(!rmdir($directory))
     449    {
    375450        $errors++;
     451    }
    376452   
    377453    return $errors == 0;
     
    382458function dirsize($directory)
    383459{
    384     if(!is_user_logged_in() || !current_user_can('administrator')){
     460    if(!is_user_logged_in() || !current_user_can('administrator'))
     461    {
    385462        wp_die();
    386463        return;
     
    389466    $total_size;
    390467   
    391     foreach(scandir($directory) as $index=>$val){
    392         if(filetype($directory."/".$val)=="dir"){
    393             if($val != "." && $val != ".."){
     468    foreach(scandir($directory) as $index=>$val)
     469    {
     470        if(filetype($directory."/".$val)=="dir")
     471        {
     472            if($val != "." && $val != "..")
     473            {
    394474                $total_size += dirsize($directory."/".$val);
    395475            }
    396         }else{
     476        }
     477        else
     478        {
    397479            $total_size += filesize($directory."/".$val);
    398480        }
  • gmace/trunk/inc/editor.php

    r1221233 r1327921  
    33    <div id="text_file">
    44        <div id="gm_slider">
    5             <div></div>
     5            <div class="hide-files"><div></div></div>
     6            <input type="number" value="1" id="linePos" min="1">
    67        </div>
    78        <div id="gm_hotbar">
    8             <div title="<?php _e('add-editor', 'gmace'); ?>" data-action="new-window-editor">
    9                 <span class="fa fa-plus"></span>
    10             </div>
    11             <div title="<?php _e('list-files', 'gmace'); ?>" data-action="open-file-menu">
    12                 <span class="fa fa-files-o"></span>
     9            <div title="<?php _e('plugin-settings', 'gmace'); ?>" data-action="open-actions-menu">
     10                <span class="fa fa-cog"></span>
    1311            </div>
    1412            <div title="<?php _e('full-mode', 'gmace'); ?>" data-action="full-mode">
    1513                <span class="fa fa-arrows-alt"></span>
    1614            </div>
    17             <div title="<?php _e('plugin-settings', 'gmace'); ?>" data-action="open-actions-menu">
    18                 <span class="fa fa-cog"></span>
     15            <div title="<?php _e('add-editor', 'gmace'); ?>" data-action="new-window-editor">
     16                <span class="fa fa-plus"></span>
     17            </div>
     18            <div title="<?php _e('action-save-file', 'gmace'); ?>" data-action="action-save-file">
     19                <span class="fa fa-floppy-o"></span>
     20            </div>
     21            <div title="<?php _e('list-files', 'gmace'); ?>" data-action="open-file-menu">
     22                <span class="fa fa-files-o"></span>
    1923            </div>
    2024        </div>
     
    2226        <div id="gm_actions">
    2327            <div>
    24                 <div>
    25                     <p class='gm_p'><?php _e('current-row', 'gmace'); ?>:</p>
    26                     <input type="number" value="1" name="linePos" min="1">
    27                 </div>
    2828                <div>
    2929                    <div>
     
    6464        <div><?php print(gmace_scan_to("/"));?></div>
    6565    </div>
    66     <input id="savefile" type="button" value="<?php _e('action-save', 'gmace'); ?>" class="button button-primary" title="<?php _e('title-how-to-save', 'gmace'); ?>">
    6766</div>
  • gmace/trunk/readme.txt

    r1221249 r1327921  
    1 === Plugin Name ===
     1=== Plugin Name ===
    22Contributors: GMDragonX
    33Tags: gmace, code editor, code, syntax light
    44Requires at least: 4.0
    5 Tested up to: 4.2.4
    6 Stable tag: 1.4
     5Tested up to: 4.4.1
     6Stable tag: 1.4.1
    77License: GNU
    88
     
    1111== Description ==
    1212
    13 Quick code editor of any file on your Wordpress site with syntax highlighting, supports editing multiple files at once and stylish look in any design of your console. To access the editor, you need to scroll the mouse to the "Settings" button and in the dropdown menu, select "Edit GMAce".
     13Quick code editor of any file on your Wordpress site with syntax highlighting, supports editing multiple files at once and stylish look in any design of your console. To access the editor, you need select "Edit GMAce" at admin-panel.
    1414
    1515This plugin has the following advantages over other editors:
    16 - Allows you to edit multiple files simultaneously.
    17 - Allows you to perform operations on files and folders (delete, move, rename, create) directly in the editor.
    18 - Instant change settings after their changes directly in the editor.
    19 - Support some hot keys.
    20 - Syntax highlighting.
     16- Allows you to edit multiple files simultaneously
     17- Allows you to perform operations on files and folders (delete, move, rename, create) directly in the editor
     18- Instant change settings after their changes directly in the editor
     19- Support some hot keys
     20- Syntax highlighting
     21- Save last opened tabs
    2122
    2223== Installation ==
     
    2728== Screenshots ==
    2829
    29 1. Style editor
    30 2. Full screen mode and a list of files
    31 3. Selection of themes
    32 4. Sidebar on the other hand
     301. Style SolarizedLight. Left-Menu.
     312. Style Monokai. Right-Menu. Highlighting the path to the selected file
    3332
    3433== Changelog ==
     34
     35= 1.4.1 =
     36* Fixed bugs
     37* Line-field moved to main panel (on top)
     38* Save-button moved to sidebar
     39* Rewritten code and fixed problem with the path from the site root
     40+ The tab bar can scroll
    3541
    3642= 1.4 =
     
    8591
    8692= Описание =
    87 Быстрый редактор кода любого файла на вашем Wordpress-сайте с подсветкой синтаксиса. Для доступа к редактору, вам нужно навести на кнопку "Настройки" и в выпадающем меню выбрать "Редактор GMAce".
     93Быстрый редактор кода любого файла на вашем Wordpress-сайте с подсветкой синтаксиса. Для доступа к редактору, вам нужно выбрать "Редактор GMAce" в админ-панели.
    8894
    8995Этот плагин имеет такие преимущества перед другими плагинами:
     
    94100- Поддержка некоторых гарячих клавиш.
    95101- Подсветка синтаксиса
     102- Сохранение последник открытых вкладок
    96103
    97104Это основные преимущества.
Note: See TracChangeset for help on using the changeset viewer.