Plugin Directory

Changeset 2066487


Ignore:
Timestamp:
04/10/2019 11:44:37 AM (7 years ago)
Author:
rmanaf
Message:

2.4.0

Location:
code-injection
Files:
48 added
13 edited

Legend:

Unmodified
Added
Removed
  • code-injection/trunk/assets/code-editor.css

    r2054055 r2066487  
     1.dcp-ci-editor {
     2    height: 100%;
     3    min-height: 500px;
     4}
     5
     6.dcp-ci-toolbar {
     7    background-color: #1e1e1e!important;
     8    border-bottom: 1px solid #383838 !important;
     9}
     10
     11.dcp-ci-toolbar > button{
     12    color: white;
     13}
     14
     15#postdivrich.fullscreen {
     16    position: fixed;
     17    top: 0;
     18    left: 0;
     19    right: 0;
     20    bottom: 0;
     21    z-index: 9999;
     22    padding-top: 30px;
     23    padding-bottom: 35px;
     24    box-sizing: border-box;
     25}
    126
    227input.apple-switch:focus{
     
    5479       content:"";
    5580   }
     81
     82
     83   @media screen and (max-width: 782px){
     84        #postdivrich.fullscreen {
     85            padding-top: 46px;
     86        }
     87        .quicktags-toolbar {
     88            min-height: 35px!important;
     89        }
     90    }
  • code-injection/trunk/assets/code-editor.js

    r2051415 r2066487  
    11; (($) => {
    2 
     2    "user strict"
     3    var parent, editor, textarea, toolbar, fullscreen, code;
    34    $(document).ready(() => {
    45
    5         $('.quicktags-toolbar').remove();
     6       
    67
    7         $('#wp-content-editor-tools').remove();
     8        // fix jquery ui conflict
     9        $('body').removeClass('wp-core-ui');
     10
     11        $('.postbox-container').each((i,e) => {
     12            $(e).addClass("wp-core-ui");
     13        })
     14
     15        // hide unneeded elements
     16        $('.quicktags-toolbar').hide();
     17        $('.wp-editor-area').hide();
     18        $('#wp-content-editor-tools').hide();
     19        $('#wp-content-wrap').hide();
    820
    921        $('#post-status-info').remove();
    1022
    11         $('.wp-editor-area').each((i, e) => {
     23        // create new elements
     24        parent = $('#postdivrich');
    1225
    13             CodeMirror.fromTextArea(e, {
    14                 lineNumbers: true,
    15                 autoCloseBrackets: true,
    16                 matchBrackets: true,
    17                 matchTags: true,
    18                 autoCloseTags: true,
    19                 mode: "application/x-httpd-php",
    20                 theme: 'dracula',
    21                 keyMap: 'sublime',
    22                 viewportMargin: Infinity
    23             })
     26        textarea = $('.wp-editor-area');
     27
     28        toolbar = $('<div>')
     29            .addClass('quicktags-toolbar dcp-ci-toolbar')
     30            .appendTo(parent);
     31
     32        container = $('<div>')
     33            .addClass('dcp-ci-editor')
     34            .appendTo(parent);
     35       
     36        fullscreen = $('<div>')
     37            .addClass('full-screen ed_button qt-dfw')
     38            .appendTo(toolbar)
     39            .click((e)=>{
     40                e.preventDefault();
     41                parent.toggleClass('fullscreen');
     42                editor.layout();
     43            });
     44
     45        // store initial value
     46        code = textarea.text();
     47
     48        require([ 'vs/editor/editor.main' ], () => {
     49
     50            // create editor
     51            editor = monaco.editor.create(container[0], {
     52                value: textarea.text(),
     53                theme: 'vs-dark',
     54                language: 'php'
     55            });
     56
     57            // update code
     58            editor.getModel().onDidChangeContent((event) => {
     59                textarea.text(editor.getModel().getValue());
     60            });
     61
     62            editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_S, () => {
     63
     64                // prevent submission if the code has no changes
     65                if(textarea.text() === code)
     66                {
     67                    return;
     68                }
     69
     70                $('#publish').trigger('click');
     71
     72            });
     73
     74            editor.addCommand(monaco.KeyMod.Alt | monaco.KeyMod.Shift | monaco.KeyCode.KEY_F, () => {
     75               
     76                // TODO: add auto format
     77               
     78            });
    2479
    2580        });
    2681
    27     })
     82        $(window).on( 'resize' , () => {
     83            if (editor) {
     84                editor.layout();
     85            }
     86        });
     87
     88    });
    2889
    2990})(jQuery);
  • code-injection/trunk/assets/wp-code-injection-admin.css

    r2051415 r2066487  
    1 .CodeMirror {
    2     height: 600px !important;
    3   }
     1.gdcp-heatmap-container {
     2  width: 332px;
     3  height: 84px;
     4}
    45
    5   .CodeMirror-fullscreen {
    6     position: fixed;
    7     top: 0; left: 0; right: 0; bottom: 0;
    8     height: auto;
    9     z-index: 9;
    10   }
     6.gdcp-heatmap-row {
     7  display: block;
     8  padding: 0;
     9  margin: 0;
     10  float: left;
     11  clear: both;
     12}
    1113
    12   .gdcp-heatmap-container {
    13     width: 332px;
    14     height: 84px;
    15   }
     14.gdcp-heatmap-row .dow {
     15  float: left;
     16  padding: 0;
     17  margin: 0;
     18  font-size: 10px;
     19  line-height: 11px;
     20  margin-right: 2px;
     21  width: 30px;
     22  text-align: left;
     23  color: #aaa;
     24}
    1625
    17   .gdcp-heatmap-row {
    18     display: block;
    19     padding: 0;
    20     margin: 0;
    21     float: left;
    22     clear: both;
    23   }
     26.gdcp-heatmap-cell {
     27  display: block;
     28  padding: 0;
     29  margin: 1px;
     30  float:left;
     31  background-color: #ebedf0;
     32  width:10px;
     33  height:10px;
     34  position: relative;
     35}
    2436
    25   .gdcp-heatmap-row .dow {
    26     float: left;
    27     padding: 0;
    28     margin: 0;
    29     font-size: 10px;
    30     line-height: 11px;
    31     margin-right: 2px;
    32     width: 30px;
    33     text-align: left;
    34     color: #aaa;
    35   }
     37.gdcp-heatmap-cell .info {
     38  display: none;
     39  position: absolute;
     40  bottom: 17px;
     41  left: 50%;
     42  transform: translate(-50% , 0);
     43  -webkit-transform: translate(-50% , 0);
     44  border-radius: 4px;
     45  background-color: #1f1f1f;
     46  background-color: rgba(0,0,0,.78);
     47  padding: 10px;
     48  box-sizing: border-box;
     49  width: 170px;
     50  color: #ccc;
     51  text-align: center;
     52  z-index: 100;
     53  margin: 0;
     54}
    3655
    37   .gdcp-heatmap-cell {
    38     display: block;
    39     padding: 0;
    40     margin: 1px;
    41     float:left;
    42     background-color: #ebedf0;
    43     width:10px;
    44     height:10px;
    45     position: relative;
    46   }
     56.gdcp-chart-colors {
     57  font-size: 10px;
     58  line-height: 8px;
     59  margin-top: 4px;
     60  display: inline-block;
     61  margin-left: 50px;
     62}
    4763
    48   .gdcp-heatmap-cell .info {
    49     display: none;
    50     position: absolute;
    51     bottom: 17px;
    52     left: 50%;
    53     transform: translate(-50% , 0);
    54     -webkit-transform: translate(-50% , 0);
    55     border-radius: 4px;
    56     background-color: #1f1f1f;
    57     background-color: rgba(0,0,0,.78);
    58     padding: 10px;
    59     box-sizing: border-box;
    60     width: 170px;
    61     color: #ccc;
    62     text-align: center;
    63     z-index: 100;
    64     margin: 0;
    65   }
     64.gdcp-chart-colors .gradient {
     65  width: 10px;
     66  height: 10px;
     67  display: block;
     68}
    6669
    67   .gdcp-chart-colors {
    68     font-size: 10px;
    69     line-height: 8px;
    70     margin-top: 4px;
    71     display: inline-block;
    72     margin-left: 50px;
    73   }
     70.gdcp-chart-colors i {
     71  float:left;
     72  margin:1px;
     73}
    7474
    75   .gdcp-chart-colors .gradient {
    76     width: 10px;
    77     height: 10px;
    78     display: block;
    79   }
     75.gdcp-heatmap-cell .info .time {
     76  color:#aaa;
     77}
    8078
    81   .gdcp-chart-colors i {
    82     float:left;
    83     margin:1px;
    84   }
     79  .gdcp-heatmap-cell .info .arrow-down {
     80  width: 0;
     81  height: 0;
     82  border-left: 6px solid transparent;
     83  border-right: 6px solid transparent;
     84  border-top: 6px solid rgba(0,0,0,.8);
     85  display: block;
     86  margin: 0;
     87  padding: 0;
     88  position: absolute;
     89  left: 50%;
     90  top: 100%;
     91  transform: translate(-50% , 0);
     92}
    8593
    86   .gdcp-heatmap-cell .info .time {
    87     color:#aaa;
    88   }
     94.gdcp-heatmap-cell:hover .info {
    8995
    90    .gdcp-heatmap-cell .info .arrow-down {
    91     width: 0;
    92     height: 0;
    93     border-left: 6px solid transparent;
    94     border-right: 6px solid transparent;
    95     border-top: 6px solid rgba(0,0,0,.8);
    96     display: block;
    97     margin: 0;
    98     padding: 0;
    99     position: absolute;
    100     left: 50%;
    101     top: 100%;
    102     transform: translate(-50% , 0);
    103   }
     96  display:block;
    10497
    105   .gdcp-heatmap-cell:hover .info {
    106 
    107     display:block;
    108 
    109   }
     98}
    11099
    111100
    112   .gdcp-version-box {
    113     font-size: 12px;
    114     padding: 2px;
    115     padding-left: 8px;
    116     padding-right: 8px;
    117     margin-left: 8px;
    118     background-color: #00b2ff;
    119     color: white;
    120     border-radius: 2px;
    121     text-decoration: none;
    122   }
     101.gdcp-version-box {
     102  font-size: 12px;
     103  padding: 2px;
     104  padding-left: 8px;
     105  padding-right: 8px;
     106  margin-left: 8px;
     107  background-color: #00b2ff;
     108  color: white;
     109  border-radius: 2px;
     110  text-decoration: none;
     111}
    123112
    124   .tag-editor .tag-editor-delete i {
    125     line-height: unset !important;
    126   }
     113.tag-editor .tag-editor-delete i {
     114  line-height: unset !important;
     115}
    127116
    128   .ack-head-wrapper {
    129     display: inline-block;
    130     width: 100%;
    131   }
    132  
    133   .ack-head-wrapper .ack-title {
    134     float: left;
    135   }
     117.ack-head-wrapper {
     118  display: inline-block;
     119  width: 100%;
     120}
    136121
    137   .ack-head-wrapper .ack-new {
    138     float: right;
    139   }
     122.ack-head-wrapper .ack-title {
     123  float: left;
     124}
    140125
    141   p.description code {
    142     font-style: normal;
    143   }
     126.ack-head-wrapper .ack-new {
     127  float: right;
     128}
     129
     130p.description code {
     131  font-style: normal;
     132}
  • code-injection/trunk/includes/assets-manager.php

    r2054055 r2066487  
    11<?php
     2
    23/**
    34 * Apache License, Version 2.0
    45 *
    5  * Copyright (C) 2018 Arman Afzal <rman.afzal@gmail.com>
     6 * Copyright (C) 2018 Arman Afzal <arman.afzal@gmail.com>
    67 *
    78 * Licensed under the Apache License, Version 2.0 (the "License");
     
    1617 * See the License for the specific language governing permissions and
    1718 * limitations under the License.
    18  *
    19  *
    20  * Third Party Licenses :
    21  *
    22  * tagEditor :
    23  *
    24  * MIT License
    25  *
    26  *
    27  *
    28  * CodeMirror :
    29  *
    30  * MIT License
    31  *
    32  * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others
    33  *
    34  * Permission is hereby granted, free of charge, to any person obtaining a copy
    35  * of this software and associated documentation files (the "Software"), to deal
    36  * in the Software without restriction, including without limitation the rights
    37  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    38  * copies of the Software, and to permit persons to whom the Software is
    39  * furnished to do so, subject to the following conditions:
    40  *
    41  * The above copyright notice and this permission notice shall be included in
    42  * all copies or substantial portions of the Software.
    43  *
    44  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    45  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    46  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    47  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    48  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    49  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    50  * THE SOFTWARE.
    51  */
    52  
    53  /**
    54  * @author Arman Afzal <rman.afzal@gmail.com>
    55  * @package WP_Divan_Control_Panel
    5619 */
    5720
     
    6528        private $plugin;
    6629
    67         public static $codemirror_bundle = [
    68             'dcp-codemirror','dcp-codemirror-addon-fold','dcp-codemirror-addon-closebrackets',
    69             'dcp-codemirror-addon-matchbrackets','dcp-codemirror-addon-matchtags',
    70             'dcp-codemirror-addon-closetag','dcp-codemirror-addon-search',
    71             'dcp-codemirror-addon-fullscreen','dcp-codemirror-keymap',
    72             'dcp-codemirror-mode-xml','dcp-codemirror-mode-js',
    73             'dcp-codemirror-mode-css','dcp-codemirror-mode-htmlmixed',
    74             'dcp-codemirror-mode-clike', 'dcp-codemirror-mode-php'
    75         ];
    76 
    7730        function __construct($plugin , $version)
    7831        {
    7932
    8033            $this->version = $version;
    81             $this->plugin = $plugin;
    8234
    83             add_action( 'admin_enqueue_scripts', [$this , 'register_assets']);
    84             add_action( 'admin_enqueue_scripts', [$this , 'print_scripts']);
     35            $this->plugin  = $plugin;
     36
     37            add_action( 'admin_enqueue_scripts', [$this , 'print_scripts'] , 50);
    8538
    8639        }
     
    9346            $ver = $this->version;
    9447
    95             // codemirror
    96             wp_register_style('dcp-codemirror', plugins_url('assets/codemirror/lib/codemirror.css', $this->plugin), [], $ver, 'all');       
    97             wp_register_style('dcp-codemirror-dracula', plugins_url('assets/codemirror/theme/dracula.css', $this->plugin), [], $ver, 'all');
    98 
     48            // monaco editor
     49            wp_register_style('dcp-monaco-editor', plugins_url('assets/monaco-editor/vs/editor/editor.main.css', $this->plugin), [], $ver, 'all');
     50           
    9951            // tagEditor
    10052            wp_register_style('dcp-tag-editor', plugins_url('assets/jquery.tag-editor.css', $this->plugin), [], $ver, 'all');
    101            
    102            
    103             wp_register_style('custom-code-editor', plugins_url('assets/code-editor.css', $this->plugin), [], $ver, 'all');
     53             
     54            wp_register_style('dcp-custom-code-editor', plugins_url('assets/code-editor.css', $this->plugin), [], $ver, 'all');
    10455           
    10556
     
    11364            $ver = $this->version;
    11465
    115             // codemirror
    116             wp_register_script('dcp-codemirror', plugins_url('assets/codemirror/lib/codemirror.js', $this->plugin), ['jquery'], $ver, false);
    117 
    118             // codemirror > addons
    119             wp_register_script('dcp-codemirror-addon-fold', plugins_url('assets/codemirror/addons/fold/xml-fold.js', $this->plugin), [], $ver, false);
    120             wp_register_script('dcp-codemirror-addon-closebrackets', plugins_url('assets/codemirror/addons/edit/closebrackets.js', $this->plugin), [], $ver, false);
    121             wp_register_script('dcp-codemirror-addon-matchbrackets', plugins_url('assets/codemirror/addons/edit/matchbrackets.js', $this->plugin), [], $ver, false);
    122             wp_register_script('dcp-codemirror-addon-matchtags', plugins_url('assets/codemirror/addons/edit/matchtags.js', $this->plugin), [], $ver, false);
    123             wp_register_script('dcp-codemirror-addon-closetag', plugins_url('assets/codemirror/addons/edit/closetag.js', $this->plugin), [], $ver, false);
    124             wp_register_script('dcp-codemirror-addon-search', plugins_url('assets/codemirror/addons/search/match-highlighter.js', $this->plugin), [], $ver, false);
    125             wp_register_script('dcp-codemirror-addon-fullscreen', plugins_url('assets/codemirror/addons/display/fullscreen.js', $this->plugin), [], $ver, false);
    126 
    127             // codemirror > keymap
    128             wp_register_script('dcp-codemirror-keymap', plugins_url('assets/codemirror/keymap/sublime.js', $this->plugin), [], $ver, false);
    129 
    130             // codemirror > mode
    131             wp_register_script('dcp-codemirror-mode-xml', plugins_url('assets/codemirror/mode/xml/xml.js', $this->plugin), [], $ver, false);
    132             wp_register_script('dcp-codemirror-mode-js', plugins_url('assets/codemirror/mode/javascript/javascript.js', $this->plugin), [], $ver, false);
    133             wp_register_script('dcp-codemirror-mode-css', plugins_url('assets/codemirror/mode/css/css.js', $this->plugin), [], $ver, false);
    134             wp_register_script('dcp-codemirror-mode-htmlmixed', plugins_url('assets/codemirror/mode/htmlmixed/htmlmixed.js', $this->plugin), [], $ver, false);
    135             wp_register_script('dcp-codemirror-mode-clike', plugins_url('assets/codemirror/mode/clike/clike.js', $this->plugin), [], $ver, false);
    136             wp_register_script('dcp-codemirror-mode-php', plugins_url('assets/codemirror/mode/php/php.js', $this->plugin), [], $ver, false);
    137 
     66            // monaco-editor
     67            wp_register_script('dcp-monaco-editor-loader', plugins_url('assets/monaco-editor/vs/loader.js', $this->plugin), ['jquery'], $ver, true);
     68            wp_register_script('dcp-monaco-editor-nls', plugins_url('assets/monaco-editor/vs/editor/editor.main.nls.js', $this->plugin), ['jquery'], $ver, true);
     69            wp_register_script('dcp-monaco-editor', plugins_url('assets/monaco-editor/vs/editor/editor.main.js', $this->plugin), ['jquery'], $ver, true);
     70           
    13871            // tagEditor
    13972            wp_register_script('dcp-caret', plugins_url('assets/jquery.caret.min.js', $this->plugin), ['jquery'], $ver, false);
    14073            wp_register_script('dcp-tag-editor', plugins_url('assets/jquery.tag-editor.min.js', $this->plugin), ['jquery','dcp-caret'], $ver, false);
    141 
    14274
    14375            wp_register_script('dcp-code-injection-editor', plugins_url('assets/code-editor.js', $this->plugin), [], $ver, false);
     
    15082         * @since 2.2.8
    15183         */
    152         function register_assets()
     84        private function register_assets()
    15385        {
    15486
     
    16799
    168100            $ver = $this->version;
     101
     102            $this->register_assets();
    169103
    170104            wp_enqueue_script('dcp-code-injection-essentials', plugins_url('assets/essentials.js', $this->plugin), ['jquery'] , $ver, true);
  • code-injection/trunk/includes/calendar-heatmap.php

    r2054055 r2066487  
    11<?php
     2
    23/**
    34 * Apache License, Version 2.0
    45 *
    5  * Copyright (C) 2018 Arman Afzal <rman.afzal@gmail.com>
     6 * Copyright (C) 2018 Arman Afzal <arman.afzal@gmail.com>
    67 *
    78 * Licensed under the Apache License, Version 2.0 (the "License");
     
    1617 * See the License for the specific language governing permissions and
    1718 * limitations under the License.
    18  *
    19  *
    20  * Third Party Licenses :
    21  *
    22  * tagEditor :
    23  *
    24  * MIT License
    25  *
    26  *
    27  *
    28  * CodeMirror :
    29  *
    30  * MIT License
    31  *
    32  * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others
    33  *
    34  * Permission is hereby granted, free of charge, to any person obtaining a copy
    35  * of this software and associated documentation files (the "Software"), to deal
    36  * in the Software without restriction, including without limitation the rights
    37  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    38  * copies of the Software, and to permit persons to whom the Software is
    39  * furnished to do so, subject to the following conditions:
    40  *
    41  * The above copyright notice and this permission notice shall be included in
    42  * all copies or substantial portions of the Software.
    43  *
    44  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    45  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    46  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    47  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    48  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    49  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    50  * THE SOFTWARE.
    51  */
    52 
    53  /**
    54  * @author Arman Afzal <rman.afzal@gmail.com>
    55  * @package WP_Divan_Control_Panel
    5619 */
    5720
  • code-injection/trunk/includes/code-metabox.php

    r2054055 r2066487  
    1717 * See the License for the specific language governing permissions and
    1818 * limitations under the License.
    19  *
    20  *
    21  * Third Party Licenses :
    22  *
    23  * tagEditor :
    24  *
    25  * MIT License
    26  *
    27  *
    28  *
    29  * CodeMirror :
    30  *
    31  * MIT License
    32  *
    33  * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others
    34  *
    35  * Permission is hereby granted, free of charge, to any person obtaining a copy
    36  * of this software and associated documentation files (the "Software"), to deal
    37  * in the Software without restriction, including without limitation the rights
    38  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    39  * copies of the Software, and to permit persons to whom the Software is
    40  * furnished to do so, subject to the following conditions:
    41  *
    42  * The above copyright notice and this permission notice shall be included in
    43  * all copies or substantial portions of the Software.
    44  *
    45  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    46  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    47  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    48  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    49  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    50  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    51  * THE SOFTWARE.
    5219 */
    53 
    54 /**
    55  * @author Arman Afzal <rman.afzal@gmail.com>
    56  * @package WP_Divan_Control_Panel
    57  */
    58 
    5920
    6021if (!class_exists('WP_CI_Code_Metabox')) {
     
    216177                    <label>
    217178                        <input <?php checked($code_is_plugin , true); ?> type="checkbox" id="code_is_plugin" name="code_is_plugin" value="1" />
    218                         <?php _e("Is Plugin" , self::$text_domain); ?>
     179                        <?php _e("As Plugin" , self::$text_domain); ?>
    219180                    </label>
    220181
  • code-injection/trunk/includes/code-type.php

    r2054055 r2066487  
    1717 * See the License for the specific language governing permissions and
    1818 * limitations under the License.
    19  *
    20  *
    21  * Third Party Licenses :
    22  *
    23  * tagEditor :
    24  *
    25  * MIT License
    26  *
    27  *
    28  *
    29  * CodeMirror :
    30  *
    31  * MIT License
    32  *
    33  * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others
    34  *
    35  * Permission is hereby granted, free of charge, to any person obtaining a copy
    36  * of this software and associated documentation files (the "Software"), to deal
    37  * in the Software without restriction, including without limitation the rights
    38  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    39  * copies of the Software, and to permit persons to whom the Software is
    40  * furnished to do so, subject to the following conditions:
    41  *
    42  * The above copyright notice and this permission notice shall be included in
    43  * all copies or substantial portions of the Software.
    44  *
    45  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    46  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    47  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    48  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    49  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    50  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    51  * THE SOFTWARE.
    5219 */
    53 
    54 /**
    55  * @author Arman Afzal <rman.afzal@gmail.com>
    56  * @package WP_Divan_Control_Panel
    57  */
    58 
    5920
    6021if (!class_exists('WP_CI_Code_Type')) {
     
    6324    {
    6425
     26        private $plugin;
     27
    6528        private static $text_domain;
    6629
    6730        private static $not_ready_states = ['private', 'draft', 'trash', 'pending'];
    6831
    69         function __construct()
    70         {
     32        function __construct($plugin)
     33        {
     34
     35            $this->plugin = $plugin;
    7136
    7237            self::$text_domain = WP_Code_Injection_Plugin::$text_domain;
     
    7641            add_action('admin_head', [$this, 'admin_head']);
    7742
     43            add_action('admin_enqueue_scripts', [$this, 'print_scripts'] , 51);
     44
    7845            add_filter('title_save_pre', [$this, 'auto_generate_post_title']);
    7946
     
    8653            add_action('manage_code_posts_custom_column' , [$this, 'manage_code_posts_custom_column'], 10, 2 );
    8754
    88             add_action('admin_enqueue_scripts', [$this, 'print_scripts'], 50);
    89 
    90             add_action( 'restrict_manage_posts',  [$this, 'filter_codes_by_taxonomies'] , 10, 2);
     55            add_action('restrict_manage_posts',  [$this, 'filter_codes_by_taxonomies'] , 10, 2);
    9156
    9257        }
     
    9762
    9863            if (!$this->is_code_page()) {
    99                 return;
    100             }
    101 
    102             $ver = WP_Code_Injection_Plugin::get_version();
    103 
    104             wp_enqueue_style('dcp-codemirror');
    105             wp_enqueue_style('dcp-codemirror-dracula');
    106             wp_enqueue_style('custom-code-editor');
    107 
    108             //codemirror
    109             foreach(WP_CI_Assets_Manager::$codemirror_bundle as $script)
    110             {
    111                 wp_enqueue_script($script);
    112             }
    113            
     64               return;
     65            }
     66
     67            wp_enqueue_style('dcp-monaco-editor');
     68            wp_enqueue_style('dcp-custom-code-editor');
     69
     70            wp_enqueue_script('dcp-monaco-editor-loader');
     71            wp_enqueue_script('dcp-monaco-editor-nls');
     72            wp_enqueue_script('dcp-monaco-editor');
    11473            wp_enqueue_script('dcp-code-injection-editor');
    11574
     
    158117            $this->remove_mediabuttons();
    159118
     119            if (!$this->is_code_page()) {
     120                return;
     121            }
     122
     123            ?>
     124
     125            <script>
     126                var require = { paths: {
     127                    'vs': '<?php echo plugins_url( 'assets/monaco-editor/vs', $this->plugin ) ?>',
     128                    'js': '<?php echo plugins_url( 'assets/js', $this->plugin ) ?>'
     129                }};
     130            </script>
     131
     132            <?php
     133
    160134        }
    161135
     
    192166                    $cid_text = __("Copy CID" , self::$text_domain);
    193167
    194                     $actions['copy_cid'] = "<a href=\"javascript:window.ci.ctc('#cid');\" title=\"$cid_title\" rel=\"permalink\">$cid_text</a>";
     168                    $actions['copy_cid'] = "<a href=\"javascript:window.ci.ctc('#cid-$post->ID');\" title=\"$cid_title\" rel=\"permalink\">$cid_text</a>";
    195169
    196170                }
     
    525499                            <dt>
    526500                            <dd>
    527                                 <code id='cid' style="font-size:11px;"><?php echo $code->post_title; ?></code>
     501                                <code id="<?php echo "cid-$code->ID"; ?>" style="font-size:11px;"><?php echo $code->post_title; ?></code>
    528502                            <dd>
    529503                        </dl>
  • code-injection/trunk/includes/database.php

    r2054055 r2066487  
    11<?php
     2
    23/**
    34 * Apache License, Version 2.0
    45 *
    5  * Copyright (C) 2018 Arman Afzal <rman.afzal@gmail.com>
     6 * Copyright (C) 2018 Arman Afzal <arman.afzal@gmail.com>
    67 *
    78 * Licensed under the Apache License, Version 2.0 (the "License");
     
    1617 * See the License for the specific language governing permissions and
    1718 * limitations under the License.
    18  *
    19  *
    20  * Third Party Licenses :
    21  *
    22  * tagEditor :
    23  *
    24  * MIT License
    25  *
    26  *
    27  *
    28  * CodeMirror :
    29  *
    30  * MIT License
    31  *
    32  * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others
    33  *
    34  * Permission is hereby granted, free of charge, to any person obtaining a copy
    35  * of this software and associated documentation files (the "Software"), to deal
    36  * in the Software without restriction, including without limitation the rights
    37  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    38  * copies of the Software, and to permit persons to whom the Software is
    39  * furnished to do so, subject to the following conditions:
    40  *
    41  * The above copyright notice and this permission notice shall be included in
    42  * all copies or substantial portions of the Software.
    43  *
    44  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    45  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    46  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    47  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    48  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    49  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    50  * THE SOFTWARE.
    51  */
    52  
    53  /**
    54  * @author Arman Afzal <rman.afzal@gmail.com>
    55  * @package WP_Divan_Control_Panel
    5619 */
    5720
  • code-injection/trunk/readme.txt

    r2054055 r2066487  
    55Tested up to: 5.1.1
    66Requires PHP: 5.2.4
    7 Stable tag: 2.3.0
     7Stable tag: 2.4.0
    88License: Apache License, Version 2.0
    9 License URI: http://www.apache.org/licenses/LICENSE-2.0
     9License URI: https://github.com/Rmanaf/wp-code-injection/blob/master/LICENSE
    1010
    1111Allows You to inject code snippets into the pages by just using the WordPress shortcode.
     
    1313== Changelog ==
    1414
    15  = 2.3.0 =
     15= 2.4.0 =
     16* [feature] The editor fullscreen button
     17* The editor library has changed to monaco-editor
     18
     19= 2.3.1 =
     20* [fix] Copy CID bug
     21
     22= 2.3.0 =
    1623* [feature] Code as plugin
    1724
     
    2027== Screenshots ==
    2128
    22 1. Injection shortcode sample
     291. The Code Editor
  • code-injection/trunk/uninstall.php

    r2054055 r2066487  
    1717 * See the License for the specific language governing permissions and
    1818 * limitations under the License.
    19  *
    20  *
    21  * Third Party Licenses :
    22  *
    23  * tagEditor :
    24  *
    25  * MIT License
    26  *
    27  *
    28  *
    29  * CodeMirror :
    30  *
    31  * MIT License
    32  *
    33  * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others
    34  *
    35  * Permission is hereby granted, free of charge, to any person obtaining a copy
    36  * of this software and associated documentation files (the "Software"), to deal
    37  * in the Software without restriction, including without limitation the rights
    38  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    39  * copies of the Software, and to permit persons to whom the Software is
    40  * furnished to do so, subject to the following conditions:
    41  *
    42  * The above copyright notice and this permission notice shall be included in
    43  * all copies or substantial portions of the Software.
    44  *
    45  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    46  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    47  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    48  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    49  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    50  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    51  * THE SOFTWARE.
    5219 */
    53 
    54 /**
    55  * @author Arman Afzal <rman.afzal@gmail.com>
    56  * @package WP_Divan_Control_Panel
    57  */
    58 
    5920
    6021if (!defined('WP_UNINSTALL_PLUGIN')) {
    6122    die;
    6223}
    63 
    6424
    6525// "CI" options
  • code-injection/trunk/wp-code-injection-plugin-widget.php

    r2054055 r2066487  
    1717 * See the License for the specific language governing permissions and
    1818 * limitations under the License.
    19  *
    20  *
    21  * Third Party Licenses :
    22  *
    23  * tagEditor :
    24  *
    25  * MIT License
    26  *
    27  *
    28  *
    29  * CodeMirror :
    30  *
    31  * MIT License
    32  *
    33  * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others
    34  *
    35  * Permission is hereby granted, free of charge, to any person obtaining a copy
    36  * of this software and associated documentation files (the "Software"), to deal
    37  * in the Software without restriction, including without limitation the rights
    38  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    39  * copies of the Software, and to permit persons to whom the Software is
    40  * furnished to do so, subject to the following conditions:
    41  *
    42  * The above copyright notice and this permission notice shall be included in
    43  * all copies or substantial portions of the Software.
    44  *
    45  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    46  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    47  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    48  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    49  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    50  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    51  * THE SOFTWARE.
    52  */
    53 
    54 /**
    55  * @author Arman Afzal <rman.afzal@gmail.com>
    56  * @package WP_Divan_Control_Panel
    5719 */
    5820
  • code-injection/trunk/wp-code-injection.php

    r2054055 r2066487  
    44 * Apache License, Version 2.0
    55 *
    6  * Copyright (C) 2018 Arman Afzal <rman.afzal@gmail.com>
     6 * Copyright (C) 2018 Arman Afzal <arman.afzal@gmail.com>
    77 *
    88 * Licensed under the Apache License, Version 2.0 (the "License");
     
    1717 * See the License for the specific language governing permissions and
    1818 * limitations under the License.
    19  *
    20  *
    21  * Third Party Licenses :
    22  *
    23  * tagEditor :
    24  *
    25  * MIT License
    26  *
    27  *
    28  *
    29  * CodeMirror :
    30  *
    31  * MIT License
    32  *
    33  * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others
    34  *
    35  * Permission is hereby granted, free of charge, to any person obtaining a copy
    36  * of this software and associated documentation files (the "Software"), to deal
    37  * in the Software without restriction, including without limitation the rights
    38  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    39  * copies of the Software, and to permit persons to whom the Software is
    40  * furnished to do so, subject to the following conditions:
    41  *
    42  * The above copyright notice and this permission notice shall be included in
    43  * all copies or substantial portions of the Software.
    44  *
    45  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    46  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    47  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    48  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    49  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    50  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    51  * THE SOFTWARE.
    5219 */
    5320
     
    5623    Plugin URI: https://wordpress.org/plugins/code-injection
    5724    Description: Allows You to inject code snippets into the pages by just using the Wordpress shortcode
    58     Version: 2.3.0
     25    Version: 2.4.0
    5926    Author: Arman Afzal
    6027    Author URI: https://github.com/Rmanaf
    6128    License: Apache License, Version 2.0
    6229    Text Domain: code-injection
    63  */
    64 
    65 /**
    66  * @author Arman Afzal <rman.afzal@gmail.com>
    67  * @package WP_Divan_Control_Panel
    6830 */
    6931
     
    9254
    9355        private static $role_version = '1.0.0';
    94        
    95         private static $client_version = '1.0.0';
    96 
     56
     57        private static $client_version = '2.4.0';
    9758
    9859
     
    10465             * @since 2.2.8
    10566             */
    106             $this->custom_post_type = new WP_CI_Code_Type();
     67            $this->custom_post_type = new WP_CI_Code_Type(__FILE__);
    10768
    10869
     
    203164                eval("?" . ">" . $html);
    204165
    205                 try{
     166                try
     167                {
    206168
    207169                    $html = ob_get_contents();
     
    681643            foreach($plugins as $p)
    682644            {   
     645
     646                $code_options = WP_CI_Code_Metabox::get_code_options($p->ID);
     647
     648                $code_options['code_enabled'] = false;
     649
     650                update_post_meta( $p->ID, "code_options", $code_options);
     651
    683652                eval("?" . ">" . $p->post_content );
     653
     654                $code_options['code_enabled'] = true;
     655
     656                update_post_meta( $p->ID, "code_options", $code_options);
     657   
    684658            }
    685659
Note: See TracChangeset for help on using the changeset viewer.