Changeset 38174
- Timestamp:
- 04/04/08 01:16:22 (3 months ago)
- Files:
-
- answerlinks/trunk/answerlink.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
answerlinks/trunk/answerlink.php
r22302 r38174 34 34 Plugin Name: AnswerLinks 35 35 Description: Link to definitions and more on Answers.com from your posts. 36 Version: 1. 0a36 Version: 1.1 37 37 Author: Answers.com and Crowd Favorite 38 38 Author URI: http://crowdfavorite.com 39 39 */ 40 41 global $wp_version; 42 if (isset($wp_version) && version_compare($wp_version, '2.5', '>=')) { 43 define('AKV_25', true); 44 define('AKV_25s', 'true'); 45 } 46 else { 47 define('AKV_25', false); 48 define('AKV_25s', 'false'); 49 } 40 50 41 51 if (!function_exists('is_admin_page')) { … … 82 92 <script type="text/javascript"> 83 93 var jQuery = jQuery.noConflict(); 94 95 var akv_25 = '.AKV_25s.'; 84 96 85 97 function al_show() { … … 149 161 150 162 if (typeof tinyMCE != "undefined") { 151 var inst = tinyMCE.getInstanceById("content"); 152 if (inst) { 153 inst.triggerSave(false, false); 163 if (akv_25) { 164 tinyMCE.triggerSave(false, false); 165 } 166 else { 167 var inst = tinyMCE.getInstanceById("content"); 168 if (inst) { 169 inst.triggerSave(false, false); 170 } 154 171 } 155 172 } … … 161 178 162 179 function addAnswerLinkTMCEButton() { 163 if ( document.getElementById("mce_editor_0_wp_help")) {180 if (!akv_25 && document.getElementById("mce_editor_0_wp_help")) { 164 181 jQuery("#mce_editor_0_wp_help").after("<img src=\"'.get_bloginfo('wpurl').'/wp-includes/js/tinymce/themes/advanced/images/separator.gif\" class=\"mceSeparatorLine\" height=\"20\" width=\"2\" title=\"Get Suggested links from Answers.com\"><a id=\"mce_editor_0_answerlink\" href=\"'.get_bloginfo('wpurl').'/index.php\"class=\"mceButtonNormal thickbox\" target=\"_self\"><img src=\"'.get_bloginfo('wpurl').'/wp-content/plugins/answerlinks/images/mce_button.gif\" title=\"AnswerLinks\"></a>"); 182 jQuery("#mce_editor_0_answerlink").bind("click", requestAnswerLinkWindow); 183 } 184 else if (akv_25 && jQuery("#content_wp_adv").size()) { 185 jQuery("#content_wp_adv").parent().before("<td><a title=\"AnswerLinks\" onclick=\"return false;\" onmousedown=\"return false;\" class=\"mceButton mceButtonEnabled\" href=\"javascript:;\" id=\"mce_editor_0_answerlink\"><img src=\"'.get_bloginfo('wpurl').'/wp-content/plugins/answerlinks/images/mce_button.gif\" class=\"mceIcon\"/></a></td>"); 165 186 jQuery("#mce_editor_0_answerlink").bind("click", requestAnswerLinkWindow); 166 187 } … … 438 459 var answerlink = { 439 460 links : new Array() 461 , gte25 : '.AKV_25s.' 440 462 } 441 463 … … 484 506 parent.jQuery("#content").val(content); 485 507 if (typeof parent.tinyMCE != "undefined") { 486 var inst = parent.tinyMCE.getInstanceById("content"); 487 if (inst) { 488 parent.tinyMCE.setContent(content); 489 inst.repaint(); 508 if (answerlink.gte25) { 509 parent.tinyMCE.activeEditor.setContent(content); 510 } 511 else { 512 var inst = parent.tinyMCE.getInstanceById("content"); 513 if (inst) { 514 parent.tinyMCE.setContent(content); 515 inst.repaint(); 516 } 490 517 } 491 518 } … … 698 725 var $tagStack; 699 726 700 function XMLParser($path )727 function XMLParser($path = '') 701 728 { 702 729 $this->parser = xml_parser_create(); … … 713 740 xml_set_element_handler($this->parser, 'startHandler', 'endHandler'); 714 741 715 if(!xml_parse($this->parser, $data, feof($fp)))742 if(!xml_parse($this->parser, $data, true)) 716 743 { 717 744 cf_answerlink_head_html(); … … 776 803 } 777 804 778 779 /* proper TinyMCE plugin code780 781 // PHP Code782 783 function cf_answerlink_addMCE_plugin($plugins) {784 $plugins[] = 'answerlink';785 return $plugins;786 }787 add_filter('mce_plugins', 'cf_answerlink_addMCE_plugin');788 789 // JS Code790 791 answerlink_mce_plugin = {792 getInfo: function() {793 return {794 longname : "AnswerLink TinyMCE Plugin",795 author : "Crowd Favorite",796 authorurl : "http://crowdfavorite.com",797 infourl : "",798 version : "1.0"799 };800 }801 };802 if (typeof(tinyMCE) !== "undefined") {803 tinyMCE.addPlugin("answerlink", answerlink_mce_plugin);804 }805 */806 807 808 805 ?>
