| @@ -1,9 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | -defined('ABSPATH') || exit; | |
| 3 | 2 | |
| 4 | 3 | use const WPIDE\Constants\CONTENT_DIR; |
| 5 | 4 | |
| 5 | +defined('ABSPATH') || exit; | |
| 6 | + | |
| 6 | 7 | return apply_filters('wpide_config', [ |
| 7 | 8 | 'general' => [ |
| 8 | 9 | 'dark_mode' => [ |
| 9 | 10 | 'type' => 'bool', |
| @@ -21,15 +22,22 @@ | ||
| 21 | 22 | 'purple' => 'Purple', |
| 22 | 23 | 'red' => 'Red' |
| 23 | 24 | ], |
| 24 | 25 | 'default' => 'default' |
| 25 | - ] | |
| 26 | + ], | |
| 26 | 27 | ], |
| 27 | 28 | 'file' => [ |
| 29 | + 'advanced_mode' => [ | |
| 30 | + 'type' => 'bool', | |
| 31 | + 'label' => __('Advanced Mode', 'wpide'), | |
| 32 | + 'desc_long' => sprintf(__('When enabled, all files and folders will be available for editing including core wordpress files and the wp-config.php unless they are filtered out manually within the settings. %1$sEnable Advanced Mode at your own risk!%2$s Please note that the %1$sFile Recovery Wizard might not work properly%2$s if you ever save core PHP file that contains errors and break the site. However, backups will still be available, so you can recover corrupted files manually via FTP.', 'wpide'), '<strong class="text-danger">', '</strong>'), | |
| 33 | + 'default' => false, | |
| 34 | + 'premium' => true | |
| 35 | + ], | |
| 28 | 36 | 'root' => [ |
| 29 | 37 | 'type' => 'folders', |
| 30 | 38 | 'label' => __('Root Path', 'wpide'), |
| 31 | - 'default' => '/' | |
| 39 | + 'default' => '/'.basename(CONTENT_DIR) | |
| 32 | 40 | ], |
| 33 | 41 | 'overwrite_on_upload' => [ |
| 34 | 42 | 'type' => 'bool', |
| 35 | 43 | 'label' => __('Override on upload', 'wpide'), |
| @@ -71,31 +79,8 @@ | ||
| 71 | 79 | 'type' => 'text', |
| 72 | 80 | 'label' => __('Default archive name', 'wpide'), |
| 73 | 81 | 'default' => 'archive.zip', |
| 74 | 82 | ], |
| 75 | - 'editable' => [ | |
| 76 | - | |
| 77 | - 'type' => 'select', | |
| 78 | - 'multiple' => true, | |
| 79 | - 'label' => __('Editable files', 'wpide'), | |
| 80 | - 'options' => [ | |
| 81 | - '.' => 'File without extension', | |
| 82 | - 'txt' => '.txt', | |
| 83 | - 'css' => '.css', | |
| 84 | - 'scss' => '.scss', | |
| 85 | - 'less' => '.less', | |
| 86 | - 'js' => '.js', | |
| 87 | - 'html' => '.html', | |
| 88 | - 'php' => '.php', | |
| 89 | - 'json' => '.json', | |
| 90 | - 'xml' => '.xml', | |
| 91 | - 'yml' => '.yml', | |
| 92 | - 'md' => '.md', | |
| 93 | - 'log' => '.log', | |
| 94 | - 'htaccess' => '.htaccess' | |
| 95 | - ], | |
| 96 | - 'default' => ['.', 'txt', 'css', 'scss', 'less', 'js', 'html', 'php', 'json', 'yml', 'xml', 'md', 'log', 'htaccess'] | |
| 97 | - ], | |
| 98 | 83 | 'autoplay_media' => [ |
| 99 | 84 | 'type' => 'bool', |
| 100 | 85 | 'label' => __('Auto play media files, when possible.', 'wpide'), |
| 101 | 86 | 'desc' => __('Chromium browsers do not allow autoplay, unless user interaction is detected on the page.', 'wpide'), |
| @@ -124,8 +109,121 @@ | ||
| 124 | 109 | 'node_modules/' |
| 125 | 110 | ] |
| 126 | 111 | ] |
| 127 | 112 | ], |
| 113 | + 'editor' => [ | |
| 114 | + 'autosave' => [ | |
| 115 | + 'type' => 'bool', | |
| 116 | + 'label' => __('Auto save draft', 'wpide'), | |
| 117 | + 'desc_long' => sprintf(__('While editing, files will automatically be saved every X seconds to a temporary draft file. Original files are not affected. If you ever close or refresh the page by mistake without manually saving a file, the next time you open it, a %1$sFile Recovery%2$s modal will display allowing you to restore from the auto saved file. You can also view and compare both files differences using the %1$sQuick Diff Viewer%2$s.', 'wpide'), '<span class="text-primary">', '</span>'), | |
| 118 | + 'default' => false, | |
| 119 | + 'premium' => true | |
| 120 | + ], | |
| 121 | + 'autosave_interval' => [ | |
| 122 | + 'type' => 'range', | |
| 123 | + 'label' => __('Auto save interval (sec)', 'wpide'), | |
| 124 | + 'attr' => [ | |
| 125 | + 'min' => 5, | |
| 126 | + 'max' => 120, | |
| 127 | + 'step' => 5 | |
| 128 | + ], | |
| 129 | + 'default' => 10, | |
| 130 | + 'conditions'=> [ | |
| 131 | + [ | |
| 132 | + 'id'=> 'editor.autosave', | |
| 133 | + 'value'=> true | |
| 134 | + ] | |
| 135 | + ], | |
| 136 | + 'premium' => true | |
| 137 | + ], | |
| 138 | + 'code_completion' => [ | |
| 139 | + 'type' => 'bool', | |
| 140 | + 'label' => __('Enable Autocompletion', 'wpide'), | |
| 141 | + 'desc' => __('When enabled, the editor will suggest functions while typing.', 'wpide'), | |
| 142 | + 'default' => true | |
| 143 | + ], | |
| 144 | + 'code_info_bar' => [ | |
| 145 | + 'type' => 'bool', | |
| 146 | + 'label' => __('Enable Info Bar', 'wpide'), | |
| 147 | + 'desc' => __('When enabled, the editor will show the function reference sidebar for the selected autocomplete suggestion.', 'wpide'), | |
| 148 | + 'conditions'=> [ | |
| 149 | + [ | |
| 150 | + 'id'=> 'editor.code_completion', | |
| 151 | + 'value'=> true | |
| 152 | + ] | |
| 153 | + ], | |
| 154 | + 'default' => true | |
| 155 | + ], | |
| 156 | + 'editable' => [ | |
| 157 | + 'type' => 'select', | |
| 158 | + 'multiple' => true, | |
| 159 | + 'label' => __('Editable files', 'wpide'), | |
| 160 | + 'desc' => __('Select one of multiple extensions by pressing the shift button.', 'wpide'), | |
| 161 | + 'options' => apply_filters('wpide_editable_ext_options', [ | |
| 162 | + '.' => 'File without extension', | |
| 163 | + 'txt' => '.txt', | |
| 164 | + 'css' => '.css', | |
| 165 | + 'scss' => '.scss', | |
| 166 | + 'less' => '.less', | |
| 167 | + 'js' => '.js', | |
| 168 | + 'html' => '.html', | |
| 169 | + 'php' => '.php', | |
| 170 | + 'json' => '.json', | |
| 171 | + 'yml' => '.yml', | |
| 172 | + 'yaml' => '.yaml', | |
| 173 | + 'xml' => '.xml', | |
| 174 | + 'svg' => '.svg', | |
| 175 | + 'md' => '.md', | |
| 176 | + 'log' => '.log', | |
| 177 | + 'htaccess' => '.htaccess' | |
| 178 | + ]), | |
| 179 | + 'default' => ['.', 'txt', 'css', 'scss', 'less', 'js', 'html', 'php', 'json', 'yml', 'yaml', 'xml', 'svg', 'md', 'log', 'htaccess'] | |
| 180 | + ], | |
| 181 | + 'font_size' => [ | |
| 182 | + 'type' => 'range', | |
| 183 | + 'label' => __('Font Size (px)', 'wpide'), | |
| 184 | + 'attr' => [ | |
| 185 | + 'min' => 10, | |
| 186 | + 'max' => 20 | |
| 187 | + ], | |
| 188 | + 'default' => 12, | |
| 189 | + ], | |
| 190 | + 'scroll_speed' => [ | |
| 191 | + 'type' => 'range', | |
| 192 | + 'label' => __('Scroll Speed', 'wpide'), | |
| 193 | + 'attr' => [ | |
| 194 | + 'min' => 1, | |
| 195 | + 'max' => 20 | |
| 196 | + ], | |
| 197 | + 'default' => 3, | |
| 198 | + ], | |
| 199 | + 'hightlight_active_line' => [ | |
| 200 | + 'type' => 'bool', | |
| 201 | + 'label' => __('Highlight Active Line', 'wpide'), | |
| 202 | + 'default' => false | |
| 203 | + ], | |
| 204 | + 'behaviours_enabled' => [ | |
| 205 | + 'type' => 'bool', | |
| 206 | + 'label' => __('Enable Behaviours', 'wpide'), | |
| 207 | + 'desc' => __('When enabled, the editor will auto close tags and brackets', 'wpide'), | |
| 208 | + 'default' => true | |
| 209 | + ], | |
| 210 | + 'use_soft_tabs' => [ | |
| 211 | + 'type' => 'bool', | |
| 212 | + 'label' => __('Use Soft Tabs', 'wpide'), | |
| 213 | + 'desc' => __('When enabled, a tab key press will insert spaces instead of the tab character', 'wpide'), | |
| 214 | + 'default' => false | |
| 215 | + ], | |
| 216 | + 'tab_size' => [ | |
| 217 | + 'type' => 'range', | |
| 218 | + 'label' => __('Tab Size', 'wpide'), | |
| 219 | + 'attr' => [ | |
| 220 | + 'min' => 1, | |
| 221 | + 'max' => 8 | |
| 222 | + ], | |
| 223 | + 'default' => 4 | |
| 224 | + ], | |
| 225 | + ], | |
| 128 | 226 | 'db' => [ |
| 129 | 227 | 'per_page' => [ |
| 130 | 228 | 'type' => 'select', |
| 131 | 229 | 'label' => __('Items per page default', 'wpide'), |
| @@ -135,7 +233,7 @@ | ||
| 135 | 233 | '500' => '500', |
| 136 | 234 | '1000' => '1000' |
| 137 | 235 | ], |
| 138 | 236 | 'default' => '50', |
| 139 | - ], | |
| 237 | + ] | |
| 140 | 238 | ] |
| 141 | 239 | ]); |