Changeset 2066487
- Timestamp:
- 04/10/2019 11:44:37 AM (7 years ago)
- Location:
- code-injection
- Files:
-
- 48 added
- 13 edited
-
assets/screenshot-1.png (modified) (previous)
-
trunk/assets/code-editor.css (modified) (2 diffs)
-
trunk/assets/code-editor.js (modified) (1 diff)
-
trunk/assets/js (added)
-
trunk/assets/monaco-editor (added)
-
trunk/assets/monaco-editor/vs (added)
-
trunk/assets/monaco-editor/vs/base (added)
-
trunk/assets/monaco-editor/vs/base/worker (added)
-
trunk/assets/monaco-editor/vs/base/worker/workerMain.js (added)
-
trunk/assets/monaco-editor/vs/basic-languages (added)
-
trunk/assets/monaco-editor/vs/basic-languages/css (added)
-
trunk/assets/monaco-editor/vs/basic-languages/css/css.js (added)
-
trunk/assets/monaco-editor/vs/basic-languages/html (added)
-
trunk/assets/monaco-editor/vs/basic-languages/html/html.js (added)
-
trunk/assets/monaco-editor/vs/basic-languages/javascript (added)
-
trunk/assets/monaco-editor/vs/basic-languages/javascript/javascript.js (added)
-
trunk/assets/monaco-editor/vs/basic-languages/mysql (added)
-
trunk/assets/monaco-editor/vs/basic-languages/mysql/mysql.js (added)
-
trunk/assets/monaco-editor/vs/basic-languages/php (added)
-
trunk/assets/monaco-editor/vs/basic-languages/php/php.js (added)
-
trunk/assets/monaco-editor/vs/basic-languages/scss (added)
-
trunk/assets/monaco-editor/vs/basic-languages/scss/scss.js (added)
-
trunk/assets/monaco-editor/vs/basic-languages/xml (added)
-
trunk/assets/monaco-editor/vs/basic-languages/xml/xml.js (added)
-
trunk/assets/monaco-editor/vs/editor (added)
-
trunk/assets/monaco-editor/vs/editor/editor.main.css (added)
-
trunk/assets/monaco-editor/vs/editor/editor.main.js (added)
-
trunk/assets/monaco-editor/vs/editor/editor.main.nls.de.js (added)
-
trunk/assets/monaco-editor/vs/editor/editor.main.nls.es.js (added)
-
trunk/assets/monaco-editor/vs/editor/editor.main.nls.fr.js (added)
-
trunk/assets/monaco-editor/vs/editor/editor.main.nls.it.js (added)
-
trunk/assets/monaco-editor/vs/editor/editor.main.nls.ja.js (added)
-
trunk/assets/monaco-editor/vs/editor/editor.main.nls.js (added)
-
trunk/assets/monaco-editor/vs/editor/editor.main.nls.ko.js (added)
-
trunk/assets/monaco-editor/vs/editor/editor.main.nls.ru.js (added)
-
trunk/assets/monaco-editor/vs/editor/editor.main.nls.zh-cn.js (added)
-
trunk/assets/monaco-editor/vs/editor/editor.main.nls.zh-tw.js (added)
-
trunk/assets/monaco-editor/vs/language (added)
-
trunk/assets/monaco-editor/vs/language/css (added)
-
trunk/assets/monaco-editor/vs/language/css/cssMode.js (added)
-
trunk/assets/monaco-editor/vs/language/css/cssWorker.js (added)
-
trunk/assets/monaco-editor/vs/language/html (added)
-
trunk/assets/monaco-editor/vs/language/html/htmlMode.js (added)
-
trunk/assets/monaco-editor/vs/language/html/htmlWorker.js (added)
-
trunk/assets/monaco-editor/vs/language/json (added)
-
trunk/assets/monaco-editor/vs/language/json/jsonMode.js (added)
-
trunk/assets/monaco-editor/vs/language/json/jsonWorker.js (added)
-
trunk/assets/monaco-editor/vs/language/typescript (added)
-
trunk/assets/monaco-editor/vs/language/typescript/tsMode.js (added)
-
trunk/assets/monaco-editor/vs/language/typescript/tsWorker.js (added)
-
trunk/assets/monaco-editor/vs/loader.js (added)
-
trunk/assets/wp-code-injection-admin.css (modified) (1 diff)
-
trunk/includes/assets-manager.php (modified) (7 diffs)
-
trunk/includes/calendar-heatmap.php (modified) (2 diffs)
-
trunk/includes/code-metabox.php (modified) (2 diffs)
-
trunk/includes/code-type.php (modified) (8 diffs)
-
trunk/includes/database.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/uninstall.php (modified) (1 diff)
-
trunk/wp-code-injection-plugin-widget.php (modified) (1 diff)
-
trunk/wp-code-injection.php (modified) (7 diffs)
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 } 1 26 2 27 input.apple-switch:focus{ … … 54 79 content:""; 55 80 } 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 1 1 ; (($) => { 2 2 "user strict" 3 var parent, editor, textarea, toolbar, fullscreen, code; 3 4 $(document).ready(() => { 4 5 5 $('.quicktags-toolbar').remove();6 6 7 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(); 8 20 9 21 $('#post-status-info').remove(); 10 22 11 $('.wp-editor-area').each((i, e) => { 23 // create new elements 24 parent = $('#postdivrich'); 12 25 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 }); 24 79 25 80 }); 26 81 27 }) 82 $(window).on( 'resize' , () => { 83 if (editor) { 84 editor.layout(); 85 } 86 }); 87 88 }); 28 89 29 90 })(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 } 4 5 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 } 11 13 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 } 16 25 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 } 24 36 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 } 36 55 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 } 47 63 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 } 66 69 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 } 74 74 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 } 80 78 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 } 85 93 86 .gdcp-heatmap-cell .info .time { 87 color:#aaa; 88 } 94 .gdcp-heatmap-cell:hover .info { 89 95 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; 104 97 105 .gdcp-heatmap-cell:hover .info { 106 107 display:block; 108 109 } 98 } 110 99 111 100 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 } 123 112 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 } 127 116 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 } 136 121 137 .ack-head-wrapper .ack-new{138 float: right;139 }122 .ack-head-wrapper .ack-title { 123 float: left; 124 } 140 125 141 p.description code { 142 font-style: normal; 143 } 126 .ack-head-wrapper .ack-new { 127 float: right; 128 } 129 130 p.description code { 131 font-style: normal; 132 } -
code-injection/trunk/includes/assets-manager.php
r2054055 r2066487 1 1 <?php 2 2 3 /** 3 4 * Apache License, Version 2.0 4 5 * 5 * Copyright (C) 2018 Arman Afzal < rman.afzal@gmail.com>6 * Copyright (C) 2018 Arman Afzal <arman.afzal@gmail.com> 6 7 * 7 8 * Licensed under the Apache License, Version 2.0 (the "License"); … … 16 17 * See the License for the specific language governing permissions and 17 18 * limitations under the License. 18 *19 *20 * Third Party Licenses :21 *22 * tagEditor :23 *24 * MIT License25 *26 *27 *28 * CodeMirror :29 *30 * MIT License31 *32 * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others33 *34 * Permission is hereby granted, free of charge, to any person obtaining a copy35 * of this software and associated documentation files (the "Software"), to deal36 * in the Software without restriction, including without limitation the rights37 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell38 * copies of the Software, and to permit persons to whom the Software is39 * furnished to do so, subject to the following conditions:40 *41 * The above copyright notice and this permission notice shall be included in42 * all copies or substantial portions of the Software.43 *44 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR45 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,46 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE47 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER48 * 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 IN50 * THE SOFTWARE.51 */52 53 /**54 * @author Arman Afzal <rman.afzal@gmail.com>55 * @package WP_Divan_Control_Panel56 19 */ 57 20 … … 65 28 private $plugin; 66 29 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 77 30 function __construct($plugin , $version) 78 31 { 79 32 80 33 $this->version = $version; 81 $this->plugin = $plugin;82 34 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); 85 38 86 39 } … … 93 46 $ver = $this->version; 94 47 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 99 51 // tagEditor 100 52 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'); 104 55 105 56 … … 113 64 $ver = $this->version; 114 65 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 138 71 // tagEditor 139 72 wp_register_script('dcp-caret', plugins_url('assets/jquery.caret.min.js', $this->plugin), ['jquery'], $ver, false); 140 73 wp_register_script('dcp-tag-editor', plugins_url('assets/jquery.tag-editor.min.js', $this->plugin), ['jquery','dcp-caret'], $ver, false); 141 142 74 143 75 wp_register_script('dcp-code-injection-editor', plugins_url('assets/code-editor.js', $this->plugin), [], $ver, false); … … 150 82 * @since 2.2.8 151 83 */ 152 function register_assets()84 private function register_assets() 153 85 { 154 86 … … 167 99 168 100 $ver = $this->version; 101 102 $this->register_assets(); 169 103 170 104 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 1 1 <?php 2 2 3 /** 3 4 * Apache License, Version 2.0 4 5 * 5 * Copyright (C) 2018 Arman Afzal < rman.afzal@gmail.com>6 * Copyright (C) 2018 Arman Afzal <arman.afzal@gmail.com> 6 7 * 7 8 * Licensed under the Apache License, Version 2.0 (the "License"); … … 16 17 * See the License for the specific language governing permissions and 17 18 * limitations under the License. 18 *19 *20 * Third Party Licenses :21 *22 * tagEditor :23 *24 * MIT License25 *26 *27 *28 * CodeMirror :29 *30 * MIT License31 *32 * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others33 *34 * Permission is hereby granted, free of charge, to any person obtaining a copy35 * of this software and associated documentation files (the "Software"), to deal36 * in the Software without restriction, including without limitation the rights37 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell38 * copies of the Software, and to permit persons to whom the Software is39 * furnished to do so, subject to the following conditions:40 *41 * The above copyright notice and this permission notice shall be included in42 * all copies or substantial portions of the Software.43 *44 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR45 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,46 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE47 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER48 * 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 IN50 * THE SOFTWARE.51 */52 53 /**54 * @author Arman Afzal <rman.afzal@gmail.com>55 * @package WP_Divan_Control_Panel56 19 */ 57 20 -
code-injection/trunk/includes/code-metabox.php
r2054055 r2066487 17 17 * See the License for the specific language governing permissions and 18 18 * limitations under the License. 19 *20 *21 * Third Party Licenses :22 *23 * tagEditor :24 *25 * MIT License26 *27 *28 *29 * CodeMirror :30 *31 * MIT License32 *33 * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others34 *35 * Permission is hereby granted, free of charge, to any person obtaining a copy36 * of this software and associated documentation files (the "Software"), to deal37 * in the Software without restriction, including without limitation the rights38 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell39 * copies of the Software, and to permit persons to whom the Software is40 * furnished to do so, subject to the following conditions:41 *42 * The above copyright notice and this permission notice shall be included in43 * all copies or substantial portions of the Software.44 *45 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR46 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,47 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE48 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER49 * 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 IN51 * THE SOFTWARE.52 19 */ 53 54 /**55 * @author Arman Afzal <rman.afzal@gmail.com>56 * @package WP_Divan_Control_Panel57 */58 59 20 60 21 if (!class_exists('WP_CI_Code_Metabox')) { … … 216 177 <label> 217 178 <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); ?> 219 180 </label> 220 181 -
code-injection/trunk/includes/code-type.php
r2054055 r2066487 17 17 * See the License for the specific language governing permissions and 18 18 * limitations under the License. 19 *20 *21 * Third Party Licenses :22 *23 * tagEditor :24 *25 * MIT License26 *27 *28 *29 * CodeMirror :30 *31 * MIT License32 *33 * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others34 *35 * Permission is hereby granted, free of charge, to any person obtaining a copy36 * of this software and associated documentation files (the "Software"), to deal37 * in the Software without restriction, including without limitation the rights38 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell39 * copies of the Software, and to permit persons to whom the Software is40 * furnished to do so, subject to the following conditions:41 *42 * The above copyright notice and this permission notice shall be included in43 * all copies or substantial portions of the Software.44 *45 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR46 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,47 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE48 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER49 * 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 IN51 * THE SOFTWARE.52 19 */ 53 54 /**55 * @author Arman Afzal <rman.afzal@gmail.com>56 * @package WP_Divan_Control_Panel57 */58 59 20 60 21 if (!class_exists('WP_CI_Code_Type')) { … … 63 24 { 64 25 26 private $plugin; 27 65 28 private static $text_domain; 66 29 67 30 private static $not_ready_states = ['private', 'draft', 'trash', 'pending']; 68 31 69 function __construct() 70 { 32 function __construct($plugin) 33 { 34 35 $this->plugin = $plugin; 71 36 72 37 self::$text_domain = WP_Code_Injection_Plugin::$text_domain; … … 76 41 add_action('admin_head', [$this, 'admin_head']); 77 42 43 add_action('admin_enqueue_scripts', [$this, 'print_scripts'] , 51); 44 78 45 add_filter('title_save_pre', [$this, 'auto_generate_post_title']); 79 46 … … 86 53 add_action('manage_code_posts_custom_column' , [$this, 'manage_code_posts_custom_column'], 10, 2 ); 87 54 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); 91 56 92 57 } … … 97 62 98 63 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'); 114 73 wp_enqueue_script('dcp-code-injection-editor'); 115 74 … … 158 117 $this->remove_mediabuttons(); 159 118 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 160 134 } 161 135 … … 192 166 $cid_text = __("Copy CID" , self::$text_domain); 193 167 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>"; 195 169 196 170 } … … 525 499 <dt> 526 500 <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> 528 502 <dd> 529 503 </dl> -
code-injection/trunk/includes/database.php
r2054055 r2066487 1 1 <?php 2 2 3 /** 3 4 * Apache License, Version 2.0 4 5 * 5 * Copyright (C) 2018 Arman Afzal < rman.afzal@gmail.com>6 * Copyright (C) 2018 Arman Afzal <arman.afzal@gmail.com> 6 7 * 7 8 * Licensed under the Apache License, Version 2.0 (the "License"); … … 16 17 * See the License for the specific language governing permissions and 17 18 * limitations under the License. 18 *19 *20 * Third Party Licenses :21 *22 * tagEditor :23 *24 * MIT License25 *26 *27 *28 * CodeMirror :29 *30 * MIT License31 *32 * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others33 *34 * Permission is hereby granted, free of charge, to any person obtaining a copy35 * of this software and associated documentation files (the "Software"), to deal36 * in the Software without restriction, including without limitation the rights37 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell38 * copies of the Software, and to permit persons to whom the Software is39 * furnished to do so, subject to the following conditions:40 *41 * The above copyright notice and this permission notice shall be included in42 * all copies or substantial portions of the Software.43 *44 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR45 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,46 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE47 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER48 * 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 IN50 * THE SOFTWARE.51 */52 53 /**54 * @author Arman Afzal <rman.afzal@gmail.com>55 * @package WP_Divan_Control_Panel56 19 */ 57 20 -
code-injection/trunk/readme.txt
r2054055 r2066487 5 5 Tested up to: 5.1.1 6 6 Requires PHP: 5.2.4 7 Stable tag: 2. 3.07 Stable tag: 2.4.0 8 8 License: Apache License, Version 2.0 9 License URI: http ://www.apache.org/licenses/LICENSE-2.09 License URI: https://github.com/Rmanaf/wp-code-injection/blob/master/LICENSE 10 10 11 11 Allows You to inject code snippets into the pages by just using the WordPress shortcode. … … 13 13 == Changelog == 14 14 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 = 16 23 * [feature] Code as plugin 17 24 … … 20 27 == Screenshots == 21 28 22 1. Injection shortcode sample29 1. The Code Editor -
code-injection/trunk/uninstall.php
r2054055 r2066487 17 17 * See the License for the specific language governing permissions and 18 18 * limitations under the License. 19 *20 *21 * Third Party Licenses :22 *23 * tagEditor :24 *25 * MIT License26 *27 *28 *29 * CodeMirror :30 *31 * MIT License32 *33 * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others34 *35 * Permission is hereby granted, free of charge, to any person obtaining a copy36 * of this software and associated documentation files (the "Software"), to deal37 * in the Software without restriction, including without limitation the rights38 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell39 * copies of the Software, and to permit persons to whom the Software is40 * furnished to do so, subject to the following conditions:41 *42 * The above copyright notice and this permission notice shall be included in43 * all copies or substantial portions of the Software.44 *45 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR46 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,47 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE48 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER49 * 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 IN51 * THE SOFTWARE.52 19 */ 53 54 /**55 * @author Arman Afzal <rman.afzal@gmail.com>56 * @package WP_Divan_Control_Panel57 */58 59 20 60 21 if (!defined('WP_UNINSTALL_PLUGIN')) { 61 22 die; 62 23 } 63 64 24 65 25 // "CI" options -
code-injection/trunk/wp-code-injection-plugin-widget.php
r2054055 r2066487 17 17 * See the License for the specific language governing permissions and 18 18 * limitations under the License. 19 *20 *21 * Third Party Licenses :22 *23 * tagEditor :24 *25 * MIT License26 *27 *28 *29 * CodeMirror :30 *31 * MIT License32 *33 * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others34 *35 * Permission is hereby granted, free of charge, to any person obtaining a copy36 * of this software and associated documentation files (the "Software"), to deal37 * in the Software without restriction, including without limitation the rights38 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell39 * copies of the Software, and to permit persons to whom the Software is40 * furnished to do so, subject to the following conditions:41 *42 * The above copyright notice and this permission notice shall be included in43 * all copies or substantial portions of the Software.44 *45 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR46 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,47 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE48 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER49 * 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 IN51 * THE SOFTWARE.52 */53 54 /**55 * @author Arman Afzal <rman.afzal@gmail.com>56 * @package WP_Divan_Control_Panel57 19 */ 58 20 -
code-injection/trunk/wp-code-injection.php
r2054055 r2066487 4 4 * Apache License, Version 2.0 5 5 * 6 * Copyright (C) 2018 Arman Afzal < rman.afzal@gmail.com>6 * Copyright (C) 2018 Arman Afzal <arman.afzal@gmail.com> 7 7 * 8 8 * Licensed under the Apache License, Version 2.0 (the "License"); … … 17 17 * See the License for the specific language governing permissions and 18 18 * limitations under the License. 19 *20 *21 * Third Party Licenses :22 *23 * tagEditor :24 *25 * MIT License26 *27 *28 *29 * CodeMirror :30 *31 * MIT License32 *33 * Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others34 *35 * Permission is hereby granted, free of charge, to any person obtaining a copy36 * of this software and associated documentation files (the "Software"), to deal37 * in the Software without restriction, including without limitation the rights38 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell39 * copies of the Software, and to permit persons to whom the Software is40 * furnished to do so, subject to the following conditions:41 *42 * The above copyright notice and this permission notice shall be included in43 * all copies or substantial portions of the Software.44 *45 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR46 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,47 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE48 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER49 * 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 IN51 * THE SOFTWARE.52 19 */ 53 20 … … 56 23 Plugin URI: https://wordpress.org/plugins/code-injection 57 24 Description: Allows You to inject code snippets into the pages by just using the Wordpress shortcode 58 Version: 2. 3.025 Version: 2.4.0 59 26 Author: Arman Afzal 60 27 Author URI: https://github.com/Rmanaf 61 28 License: Apache License, Version 2.0 62 29 Text Domain: code-injection 63 */64 65 /**66 * @author Arman Afzal <rman.afzal@gmail.com>67 * @package WP_Divan_Control_Panel68 30 */ 69 31 … … 92 54 93 55 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'; 97 58 98 59 … … 104 65 * @since 2.2.8 105 66 */ 106 $this->custom_post_type = new WP_CI_Code_Type( );67 $this->custom_post_type = new WP_CI_Code_Type(__FILE__); 107 68 108 69 … … 203 164 eval("?" . ">" . $html); 204 165 205 try{ 166 try 167 { 206 168 207 169 $html = ob_get_contents(); … … 681 643 foreach($plugins as $p) 682 644 { 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 683 652 eval("?" . ">" . $p->post_content ); 653 654 $code_options['code_enabled'] = true; 655 656 update_post_meta( $p->ID, "code_options", $code_options); 657 684 658 } 685 659
Note: See TracChangeset
for help on using the changeset viewer.