Changeset 161987
- Timestamp:
- 10/09/2009 08:58:36 PM (16 years ago)
- Location:
- wpmathpublisher
- Files:
-
- 62 added
- 3 edited
-
tags/0.6 (added)
-
tags/0.6/constants.php (added)
-
tags/0.6/example.png (added)
-
tags/0.6/fonts (added)
-
tags/0.6/fonts/COPYING (added)
-
tags/0.6/fonts/FreeSerif.ttf (added)
-
tags/0.6/fonts/cmex10.ttf (added)
-
tags/0.6/fonts/cmmi10.ttf (added)
-
tags/0.6/fonts/cmr10.ttf (added)
-
tags/0.6/fonts/index.php (added)
-
tags/0.6/fonts/msam10.ttf (added)
-
tags/0.6/img (added)
-
tags/0.6/img/math_987.5_2c20bfc1841e42ec3948dc2a97793610.png (added)
-
tags/0.6/img/math_988.5_4cef2feb078cc040ae234cc852c32959.png (added)
-
tags/0.6/img/math_993.5_1f7a1b40efb812992da42b328034d176.png (added)
-
tags/0.6/img/math_995.5_e9b8bf31f3890cf1512ae6570a98ac75.png (added)
-
tags/0.6/img/math_995_a182927f5c6471dcda14959a470c2f30.png (added)
-
tags/0.6/inc (added)
-
tags/0.6/inc/admin_themePage.php (added)
-
tags/0.6/inc/jscolor (added)
-
tags/0.6/inc/jscolor/arrow.gif (added)
-
tags/0.6/inc/jscolor/cross.gif (added)
-
tags/0.6/inc/jscolor/hs.png (added)
-
tags/0.6/inc/jscolor/hv.png (added)
-
tags/0.6/inc/jscolor/jscolor.js (added)
-
tags/0.6/license.txt (added)
-
tags/0.6/locale (added)
-
tags/0.6/locale/wpmathpublisher-de_DE-formal.mo (added)
-
tags/0.6/locale/wpmathpublisher-de_DE-formal.po (added)
-
tags/0.6/locale/wpmathpublisher-de_DE.mo (added)
-
tags/0.6/locale/wpmathpublisher-de_DE.po (added)
-
tags/0.6/mathpublisher.php (added)
-
tags/0.6/readme.txt (added)
-
tags/0.6/screenshot-1.jpg (added)
-
tags/0.6/screenshot-2.png (added)
-
tags/0.6/style.css (added)
-
tags/0.6/tinymce (added)
-
tags/0.6/tinymce/dialog.php (added)
-
tags/0.6/tinymce/editor_plugin.js (added)
-
tags/0.6/tinymce/img (added)
-
tags/0.6/tinymce/img/wpmathpublisher.png (added)
-
tags/0.6/tinymce/js (added)
-
tags/0.6/tinymce/js/dialog.js (added)
-
tags/0.6/tinymce/langs (added)
-
tags/0.6/tinymce/langs/de.js (added)
-
tags/0.6/tinymce/langs/de_dlg.js (added)
-
tags/0.6/tinymce/langs/en.js (added)
-
tags/0.6/tinymce/langs/en_dlg.js (added)
-
tags/0.6/wpmathpublisher.php (added)
-
trunk/constants.php (added)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/style.css (modified) (1 diff)
-
trunk/tinymce (added)
-
trunk/tinymce/dialog.php (added)
-
trunk/tinymce/editor_plugin.js (added)
-
trunk/tinymce/img (added)
-
trunk/tinymce/img/wpmathpublisher.png (added)
-
trunk/tinymce/js (added)
-
trunk/tinymce/js/dialog.js (added)
-
trunk/tinymce/langs (added)
-
trunk/tinymce/langs/de.js (added)
-
trunk/tinymce/langs/de_dlg.js (added)
-
trunk/tinymce/langs/en.js (added)
-
trunk/tinymce/langs/en_dlg.js (added)
-
trunk/wpmathpublisher.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpmathpublisher/trunk/readme.txt
r161694 r161987 4 4 Requires at least: 2.5 5 5 Tested up to: 2.8.4 6 Stable tag: 0. 56 Stable tag: 0.6 7 7 8 8 Plugin that allows formulars to be included in blog texts (as graphics) … … 19 19 20 20 Currently it supports the following **features**: 21 * Basic function: Convert equations into graphics 22 * Font and background color can be chosen by you in the admin panel (alpha-transparency included, but if you are using Microsoft Internet Explorer you will need version 7 or greater to display the images correctly) 23 * Font size default value can be set, but also changed for every single image if necessary 24 * If you just want to output a formula there is a "noparse" attribute that will output the pure text nicely formatted 25 * Saves the images on the webspace, which saves processor time 26 * Clear image cache and let all images be regenerated by admin panel 21 22 * Basic function: Convert equations into graphics 23 * Font and background color can be chosen by you in the admin panel (alpha-transparency included, but if you are using Microsoft Internet Explorer you will need version 7 or greater to display the images correctly) 24 * Font size default value can be set, but also changed for every single image if necessary 25 * If you just want to output a formula there is a "noparse" attribute that will output the pure text nicely formatted 26 * Saves the images on the webspace, which saves processor time 27 * Clear image cache and let all images be regenerated by admin panel 28 * Integration in TinyMCE editor 27 29 28 30 **Configuration**: 29 31 30 32 To configure the plugin there is an easy to use admin panel page (since v0.3.1). 31 Here you can ch oose the RGB-components of the font and background color. In addition to that you can choose an alpha-transparency.33 Here you can change the the color by using a javascript color picker, and the transparency value for the graphic 32 34 Furthermore you can choose a default font-size used for the images 33 35 … … 39 41 40 42 The plugin ist currently available in 41 * English (default) 42 * German (Translated by me) 43 * English (default) 44 * German (translated by me) 45 46 == Changelog == 47 48 = 0.4 [2008-07-09] = 49 * Fixed keeping a variable for theme-page output that was meant to be only temporary 50 * added function to clear the image cache and let the images be regenerated 51 = 0.4.1 [2009-02-12] = 52 * Fixed error occuring while installation 53 = 0.4.2 [2009-03-08] = 54 * Cleaned up code 55 * removed making background transparent bye choosing so, use alpha = 127 instead 56 * offers change of size for each individual image 57 = v 0.4.3 [2009-03-08] = 58 * added noparse attribute 59 * added short user guide on plugins configuration page 60 * removed deactivation hook to preserve configuration if plugin is updated 61 = v 0.4.3.1 [2009-03-08] = 62 * fixed a problem with the svn, reupload for complete installation 63 = v 0.4.4 [2009-09-*] (never uploaded) = 64 * fixed height of text in graphics as suggested by a productive user ;) 65 = v 0.5 [2009-10-09] = 66 * removed reading options written by older versions of this plugin 67 * added german translation ("Sie" und "Du") 68 * will create image folder if possible 69 * if image folder is not writeable or could not be created, plugin will output a message in admin center 70 * added option to change default fontsize 71 * exported display settings of admin page to css-file 72 = v 0.6 [2009-10-09] = 73 * outputs allowed font size 74 * gone to be awesome ;) 75 * integration in tinymce 3.x 76 * added simple color-picker by integrating [jscolor](http://jscolor.com/ "JavaScript Color Picker") 77 * temporary added ability to import old database values - really got to get this saving stuff sorted out 78 * update of translation 43 79 44 80 == Installation == … … 50 86 1. Upload the extracted folder, including all subfolders (no matter if empty or not) to the plugin directory of your wordpress installation (/wp-content/plugins/) 51 87 1. Activate the plugin in your wordpress administration center 52 1. If necessary , create the folder "img" as subdirectory of the wpmathpublisher directory and set it to chmod 77788 1. If necessary (script will tell you) , create the folder "img" as subdirectory of the wpmathpublisher directory and set it to chmod 777 53 89 1. Done. Go for it! 54 90 -
wpmathpublisher/trunk/style.css
r161694 r161987 78 78 background-repeat: no-repeat; 79 79 } 80 81 .comment { 82 font-size: 70%; 83 font-style: italic; 84 } -
wpmathpublisher/trunk/wpmathpublisher.php
r161694 r161987 7 7 Author URI: http://kraeuterbruederchen.de 8 8 Text Domain: wpmathpublisher 9 Version: 0. 59 Version: 0.6 10 10 11 11 Copyright: … … 32 32 v 0.4.4 [2009-09-*] (never uploaded) 33 33 ! fixed height of text in graphics as suggested by a productive user ;) 34 v 0.5 34 v 0.5 [2009-10-09] 35 35 - removed reading options written by older versions of this plugin 36 36 + added german translation ("Sie" und "Du") … … 39 39 + added option to change default fontsize 40 40 ! exported display settings of admin page to css-file 41 v 0.6 [2009-10-09] 42 + integration in tinymce 3.x 43 + outputs allowed font size 44 + added simple color-picker by integrating jscolor 45 + temporary added ability to import old database values - really got to get this saving stuff sorted out 46 ! update of translation 41 47 42 48 Roadmap: 43 49 - add option to change default fontset 44 - display maximum font size / minimum font size 45 - nicer font-chooser 50 - add transparence slider 46 51 */ 47 52 … … 61 66 define('WPMP_BASEURL', WP_PLUGIN_URL.'/'.WPMP_FOLDER); 62 67 63 define('WPMP_FONT_MAX', 24); 64 define('WPMP_FONT_MIN', 10); 65 66 // Include PhpMathPublisher68 ## get other constants 69 include_once('constants.php'); 70 71 ## include PhpMathPublisher 67 72 include_once('mathpublisher.php'); 68 73 69 74 class WpMathPublisher { 70 var $font = array(' red' => 0, 'green' => 0, 'blue' => 0, 'alpha' => 0);71 var $back = array(' red' => 255, 'green' => 255, 'blue' => 255, 'alpha' => 0);75 var $font = array('color' => '000000', 'alpha' => 0); 76 var $back = array('color' => 'ffffff', 'alpha' => 0); 72 77 var $size = 12; 73 78 var $imgPath = ''; … … 97 102 function admin_menu() { 98 103 wp_enqueue_style('wpmathpublisher', WPMP_BASEURL.'/style.css'); 104 wp_enqueue_script('wpmathpublisher-jscolor', WPMP_BASEURL.'/inc/jscolor/jscolor.js'); 99 105 add_theme_page(__('WpMathPublisher', WPMP_TEXTDOMAIN), __('WpMathPublisher', WPMP_TEXTDOMAIN), 5, WPMP_BASEDIR.'/inc/admin_themePage.php'); 100 106 } … … 102 108 ## initialization function 103 109 function init() { 110 # get localization 104 111 load_plugin_textdomain(WPMP_TEXTDOMAIN, WPMP_BASEDIR.'/locale', WPMP_FOLDER.'/locale'); 105 112 106 if(!$this->ready) { 113 # output information if plugin is not ready 114 if(!$this->ready) 107 115 echo '<div id="wpmp-warning" class="updated fade"><p><strong>'.__('WpMathPublisher not yet ready: ').'</strong>'.sprintf(__('Couldn\'t access image directory [%s], create it and chmod it to 777.', WPMP_TEXTDOMAIN), WPMP_FOLDER.'/img').'</p></div>'; 108 } 116 117 # add tinymce buttons (only if necessary) 118 if(( current_user_can('edit_posts') || current_user_can('edit_pages') ) && get_user_option('rich_editing') ) { 119 add_filter("mce_external_plugins", array($this, 'addTinyMcePlugin')); 120 add_filter('mce_buttons', array($this, 'registerButton')); 121 } 122 123 } 124 125 ## function to add button to tinymce 126 function registerButton($_buttons) { 127 array_push($_buttons, 'wpmathpublisher', '|'); 128 return $_buttons; 129 } 130 131 ## function to add plugin 132 function addTinyMcePlugin($_pluginArray) { 133 $_pluginArray['wpmathpublisher'] = WPMP_BASEURL.'/tinymce/editor_plugin.js'; 134 return $_pluginArray; 109 135 } 110 136 … … 118 144 deactivate_plugins(basename(__FILE__)); // Deactivate itself 119 145 } 146 147 $font = get_option('wpmathpublisher_font'); 148 $back = get_option('wpmathpublisher_back'); 149 if(isset($font['red'])) { 150 ## convert old values 151 $fontColor = $this->convertRgbToHex($font); 152 update_option('wpmathpublisher_font', array('color' => $fontColor, 'alpha' => $font['alpha'])); 153 $backColor = $this->convertRgbToHex($back); 154 update_option('wpmathpublisher_back', array('color' => $backColor, 'alpha' => $back['alpha'])); 155 156 $this->clearCache(); 157 $this->readOptions(); 158 } 120 159 121 160 add_option('wpmathpublisher_font', $this->font); … … 134 173 ## resets the plugins options to default values 135 174 function toDefaults() { 136 update_option('wpmathpublisher_font', array(' red' => 0, 'green' => 0, 'blue' => 0, 'alpha' => 0));137 update_option('wpmathpublisher_back', array(' red' => 255, 'green' => 255, 'blue' => 255, 'alpha' => 0));175 update_option('wpmathpublisher_font', array('color' => '000000', 'alpha' => 0)); 176 update_option('wpmathpublisher_back', array('color' => 'ffffff', 'alpha' => 0)); 138 177 update_option('wpmathpublisher_size', 12); 139 178 … … 154 193 155 194 ## function that checks whether given rgb values are valid 156 function check RGB($_red, $_green, $_blue, $_alpha=0) {195 function checkColor($_color, $_alpha=0) { 157 196 $message = ''; 158 if(!is_numeric($_red) || $_red < 0 || $_red > 255) 159 $message .= '<li>'. __('value of red component is invalid', WPMP_TEXTDOMAIN).'</li>'; 160 if(!is_numeric($_green) || $_green < 0 || $_green > 255) 161 $message .= '<li>'. __('value of green component is invalid', WPMP_TEXTDOMAIN).'</li>'; 162 if(!is_numeric($_blue) || $_blue < 0 || $_blue > 255) 163 $message .= '<li>'. __('value of blue component is invalid', WPMP_TEXTDOMAIN).'</li>'; 197 if(!preg_match_all('~#?[0-9a-f]{6}~i', $_color, $colors) || empty($colors)) 198 $message .= '<li>'. __('invalid color value', WPMP_TEXTDOMAIN).'</li>'; 164 199 if(!is_numeric($_alpha) || $_alpha < 0 || $_alpha > 127) 165 200 $message .= '<li>'. __('transparency value is invalid', WPMP_TEXTDOMAIN).'</li>'; 166 201 167 202 return $message; 203 } 204 205 ## function to convert hex to rgb 206 function convertHexToRgb($_hex) { 207 $rgb = array( 208 'red' => hexdec(substr($_hex, 0, 2)), 209 'green' => hexdec(substr($_hex, 2, 2)), 210 'blue' => hexdec(substr($_hex, 4, 2)) 211 ); 212 213 return $rgb; 214 } 215 216 ## function to convert rgb to hex 217 function convertRgbToHex($_colors) { 218 return sprintf('#%02X%02X%02X', $_colors['red'], $_colors['green'], $_colors['blue']); 168 219 } 169 220 … … 192 243 } 193 244 194 //function to delete all images in cache245 ## function to delete all images in cache 195 246 function clearCache() { 196 247 $basePath = WPMP_BASEDIR.'/img'; … … 210 261 } 211 262 212 //function to set the background-color of the images263 ## function to set the background-color of the images 213 264 function getBackgroundColor($_im) { 214 $color = imagecolorallocatealpha($_im, $this->back['red'], $this->back['green'], $this->back['blue'], $this->back['alpha']); 265 $color = $this->convertHexToRgb($this->back['color']); 266 $color = imagecolorallocatealpha($_im, $color['red'], $color['green'], $color['blue'], $this->back['alpha']); 215 267 return $color; 216 268 } 217 269 218 //function to get the font color270 ## function to get the font color 219 271 function getFontColor($_im) { 220 $color = imagecolorallocatealpha($_im, $this->font['red'], $this->font['green'], $this->font['blue'], $this->font['alpha']); 272 $color = $this->convertHexToRgb($this->font['color']); 273 $color = imagecolorallocatealpha($_im, $color['red'], $color['green'], $color['blue'], $this->font['alpha']); 221 274 return $color; 222 275 }
Note: See TracChangeset
for help on using the changeset viewer.