Changeset 2028234
- Timestamp:
- 02/10/2019 10:54:47 PM (7 years ago)
- Location:
- aph-prism-highlighter/trunk
- Files:
-
- 8 edited
-
includes/aphph-admin-editor.php (modified) (3 diffs)
-
includes/aphph-admin.php (modified) (10 diffs)
-
includes/aphph-admin_plugin.php (modified) (2 diffs)
-
includes/aphph-build.php (modified) (1 diff)
-
includes/aphph-build_plugin.php (modified) (1 diff)
-
includes/aphph-config.php (modified) (1 diff)
-
js/aphph-tinymce.js (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
aph-prism-highlighter/trunk/includes/aphph-admin-editor.php
r2017203 r2028234 1 1 <?php 2 /* 3 * TnyMCE Editor 4 */ 2 5 class Aphph_Admin_Editor 3 6 { … … 63 66 continue; 64 67 65 $lang_name = $this->options_phdata['lang-list'][$lang]; 66 $selected = $lang == $this->options['default-lang'] ? ' selected="selected"' : ''; 67 $lang_options .= '<option value="' . $lang . '"' . $selected . '>' . $lang_name . '</option>'; 68 $item = $this->options_phdata['lang-list'][$lang]; 69 if ($item) { 70 $title = $item; 71 if (is_array($item)) { 72 $title = $item['title']; 73 if (key_exists('aliasTitles', $item)) { 74 $title .= ' / ' . join($item['aliasTitles'], ' / '); 75 } 76 } 77 $selected = $lang == $this->options['default-lang'] ? ' selected="selected"' : ''; 78 $lang_options .= '<option value="' . $lang . '"' . $selected . '>' . $title . '</option>'; 79 } 68 80 } 69 81 … … 77 89 <div class="aphph-editor-body" id="aphph-editor-body"> 78 90 <div class="aphph-inline-options aphph-clearfix"> 79 < span>Language</span>80 <select name="aphph-language" id="aphph-language" >'.91 <div><span>Language</span> 92 <select name="aphph-language" id="aphph-language" style="float:none">'. 81 93 $lang_options . ' 82 94 </select> 95 </div> 96 <div> 83 97 <span class="aphph-te-section">Highlight Line</span> 84 98 <input type="text" class="aphph-small-text" name="aphph_highlight_lines" id="aphph-highlight-lines"/><span class="description">e.q: 1,2,3-6</span> 99 </div> 85 100 86 101 </div> -
aph-prism-highlighter/trunk/includes/aphph-admin.php
r2028055 r2028234 110 110 public function ajax_no_priv() 111 111 { 112 // echo 'xxx'; die;113 112 114 113 } … … 148 147 update_option(APHPH_OPTION_PHDATA, $this->components_list); 149 148 add_action('wp_head', array($this, 'build_files')); 150 } 149 } 150 151 update_option(APHPH_OPTION_PHDATA, $this->components_list); 151 152 } 152 153 … … 158 159 update_option(APHPH_OPTION_VERSION, APHPH_PLUGIN_VERSION); 159 160 update_option(APHPH_OPTION_PHDATA, $this->components_list); 160 if (!$plugin_option_version || $plugin_option_version < 1.2)161 if (!$plugin_option_version || $plugin_option_version < '1.3.1') 161 162 { 162 $msg = 'APH PRISM HIGHLIGHTER v' . APHPH_PLUGIN_VERSION . ' Language added: Dark Plain and Light Plain';163 $msg = 'APH PRISM HIGHLIGHTER v' . APHPH_PLUGIN_VERSION . ' Update the prism core, update compatibilities to WordPress 5, and several bug fixes'; 163 164 $this->admin_notices->add_notice($msg, 'success', false, true); 164 165 } … … 185 186 'nonce' => wp_create_nonce('aphph-admin-all'), 186 187 'ajaxurl' => admin_url('admin-ajax.php') 187 188 188 ) 189 189 ); … … 346 346 public function option_language_list() { 347 347 348 $lang_used = $this-> data_options['lang-used'];348 $lang_used = $this->options['lang-used']; 349 349 echo '<div class="aphph-langused-container aphph-clearfix" id="aphph-langused-container">'; 350 350 … … 354 354 foreach ($lang_used as $lang) 355 355 { 356 // Fallback to old plugin version 357 if (strtolower($lang) == 'core') 358 continue; 356 359 357 360 $lang_item = $lang_list[$lang]; … … 411 414 412 415 // CREATE LIST OF ALL AVAILABLE LANGUAGES - Built in languages 413 //414 416 echo '<div class="aphph-langlist-container" id="aphph-langlist-container">'; 415 417 … … 421 423 422 424 // Languages 423 // echo '<pre>'; print_r($lang_list);424 425 foreach ($lang_list as $lang_key => $item) 425 426 { 426 427 $msg = ''; 427 // Built in language428 428 if (substr($lang_key, 0, 3) != 'add') 429 429 { 430 431 430 $file_name = 'prism-'.$lang_key.'.min.js'; 432 431 … … 455 454 456 455 public function option_default_language() { 457 458 456 $lang_used = $this->options['lang-used']; 459 460 457 echo '<select name="' . APHPH_OPTION . '[default-lang]" id="opt-aphph-default-lang">'; 461 458 foreach($lang_used as $lang) … … 465 462 466 463 $selected = $this->options['default-lang'] == $lang ? ' selected="selected"' : ''; 467 echo '<option value="'.$lang.'"' . $selected . '>' . $this->options_phdata['lang-list'][$lang] . '</option>'; 464 $item = $this->components_list['lang-list'][$lang]; 465 466 $title = $item; 467 if (is_array($item)) { 468 469 $title = $item['title']; 470 if (key_exists('aliasTitles', $item)) { 471 $title .= ' / ' . join($item['aliasTitles'], ' / '); 472 } 473 } 474 echo '<option value="'.$lang.'"' . $selected . '>' . $title . '</option>'; 475 // echo '<option value="'.$lang.'"' . $selected . '>' . $this->options_phdata['lang-list'][$lang] . '</option>'; 468 476 } 469 477 echo '</select> -
aph-prism-highlighter/trunk/includes/aphph-admin_plugin.php
r2028055 r2028234 346 346 public function option_language_list() { 347 347 348 $lang_used = $this-> data_options['lang-used'];348 $lang_used = $this->options['lang-used']; 349 349 echo '<div class="aphph-langused-container aphph-clearfix" id="aphph-langused-container">'; 350 350 … … 354 354 foreach ($lang_used as $lang) 355 355 { 356 // AFallback to old plugin version 357 if (strtolower($lang) == 'core') 358 continue; 356 359 357 360 $lang_item = $lang_list[$lang]; -
aph-prism-highlighter/trunk/includes/aphph-build.php
r2028055 r2028234 112 112 113 113 // Get theme css 114 if (strtolower($options['theme']) == 'default') 115 $options['theme'] = 'prism'; 114 116 $prism_css = file_get_contents($path . 'themes' . APHPH_DS . $options['theme']. '.css'); 115 117 -
aph-prism-highlighter/trunk/includes/aphph-build_plugin.php
r2028055 r2028234 88 88 89 89 // Get theme css 90 $theme_name = $options['theme'] == 'default' ? '' : '-'.$options['theme']; 91 $prism_css = file_get_contents($path . 'themes' . APHPH_DS . 'prism' . $theme_name. '.css'); 90 if (strtolower($options['theme']) == 'default') 91 $options['theme'] = 'prism'; 92 $prism_css = file_get_contents($path . 'themes' . APHPH_DS . $options['theme']. '.css'); 92 93 93 94 // Get plugins css -
aph-prism-highlighter/trunk/includes/aphph-config.php
r2028055 r2028234 1 1 <?php 2 2 // Config for backend and frontend 3 define ('APHPH_PLUGIN_VERSION', '1. 2');3 define ('APHPH_PLUGIN_VERSION', '1.3.1'); 4 4 5 5 define ('APHPH_OPTION', 'aphph_options'); -
aph-prism-highlighter/trunk/js/aphph-tinymce.js
r2017203 r2028234 7 7 $aphph_btn = '', 8 8 default_lang = 'php'; 9 $cursor_node = ''; 9 10 new_lang = default_lang, 10 11 … … 17 18 init : function(ed, url) 18 19 { 19 ed.onKeyUp.add(function( ){20 ed.onKeyUp.add(function(e, elm){ 20 21 checkCursor(); 21 22 }); … … 200 201 return; 201 202 } 202 ed.insertContent('<pre class="' + class_name + '">' + encoded_html + '</pre><br/>'); 203 204 $pre = $('<pre class="' + class_name + '">' + encoded_html + '</pre>'); 205 // $cursor_node.append($pre); 206 $(ed.targetElm).find($cursor_node).append($pre.removeClass('aphph-pretag-focused')); 207 208 // $prev = $cursor_node.find($pre).prev(); 209 $prev = $(ed.targetElm).find($pre).prev(); 210 211 if ($prev.length > 0) { 212 if ($prev.prop("tagName").toLowerCase() == 'br') { 213 $prev.remove(); 214 } 215 } 203 216 // node_pre_onclick = $(ed.editorContainer).find('iframe').contents().find('pre[class*="aphph-pretag-focused"]'); 204 217 } … … 213 226 function setAphshBtn() { 214 227 if (!$aphph_btn) { 215 $aphph_btn = $(ed.editorContainer).find("div[class*='aphph-btn']"); 228 // $aphph_btn = $(ed.editorContainer).find("div[class*='aphph-btn']"); 229 $aphph_btn = $(ed.targetElm).prev().find("div[class*='aphph-btn']"); 230 216 231 } 217 232 } … … 242 257 243 258 if (!$iframe_body) { 244 $iframe_body = $(ed.editorContainer).find('iframe').contents().find('body'); 245 } 259 $iframe_body = $(ed.targetElm); 260 } 261 246 262 $iframe_body.find('pre').removeClass('aphph-pretag-focused'); 247 263 pre_tag_highlighted = 0; … … 255 271 { 256 272 var classes = $cursor_node.attr('class'); 257 if (classes.match(/lang\s*:/)) 258 { 259 removeHighlightPre(); 260 highlightAphshBtn(); 261 $cursor_node.addClass('aphph-pretag-focused'); 262 } else { 263 removeHighlightPre(); 264 removeHighlightAphshBtn(); 273 if (classes) { 274 if (classes.match(/lang\s*:/)) 275 { 276 removeHighlightPre(); 277 highlightAphshBtn(); 278 $cursor_node.addClass('aphph-pretag-focused'); 279 } else { 280 removeHighlightPre(); 281 removeHighlightAphshBtn(); 282 } 265 283 } 266 284 } else { -
aph-prism-highlighter/trunk/readme.txt
r2028055 r2028234 4 4 Requires at least: 3.5 5 5 Tested up to: 5.0.3 6 Stable tag: 1.3 .16 Stable tag: 1.3 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 56 56 == Changelog == 57 57 58 = 1.3.1 February 10, 2019) =59 * Bug fixed due to the dependency changes on the newest prismjs core60 61 58 = 1.3 January 20, 2019) = 62 59 * Add support to classic editor on Guttenberg
Note: See TracChangeset
for help on using the changeset viewer.