Changeset 161694
- Timestamp:
- 10/08/2009 10:18:47 PM (16 years ago)
- Location:
- wpmathpublisher
- Files:
-
- 32 added
- 4 deleted
- 3 edited
-
tags/0.4.3.1/screenshot-1.jpg (deleted)
-
tags/0.4.3.1/screenshot-2.png (deleted)
-
tags/0.4.3/screenshot-1.jpg (deleted)
-
tags/0.4.3/screenshot-2.png (deleted)
-
tags/0.5 (added)
-
tags/0.5/example.png (added)
-
tags/0.5/fonts (added)
-
tags/0.5/fonts/COPYING (added)
-
tags/0.5/fonts/FreeSerif.ttf (added)
-
tags/0.5/fonts/cmex10.ttf (added)
-
tags/0.5/fonts/cmmi10.ttf (added)
-
tags/0.5/fonts/cmr10.ttf (added)
-
tags/0.5/fonts/index.php (added)
-
tags/0.5/fonts/msam10.ttf (added)
-
tags/0.5/img (added)
-
tags/0.5/inc (added)
-
tags/0.5/inc/admin_themePage.php (added)
-
tags/0.5/license.txt (added)
-
tags/0.5/locale (added)
-
tags/0.5/locale/wpmathpublisher-de_DE-formal.mo (added)
-
tags/0.5/locale/wpmathpublisher-de_DE-formal.po (added)
-
tags/0.5/locale/wpmathpublisher-de_DE.mo (added)
-
tags/0.5/locale/wpmathpublisher-de_DE.po (added)
-
tags/0.5/mathpublisher.php (added)
-
tags/0.5/readme.txt (added)
-
tags/0.5/screenshot-1.jpg (added)
-
tags/0.5/screenshot-2.png (added)
-
tags/0.5/style.css (added)
-
tags/0.5/wpmathpublisher.php (added)
-
trunk/img (added)
-
trunk/locale (added)
-
trunk/locale/wpmathpublisher-de_DE-formal.mo (added)
-
trunk/locale/wpmathpublisher-de_DE-formal.po (added)
-
trunk/locale/wpmathpublisher-de_DE.mo (added)
-
trunk/locale/wpmathpublisher-de_DE.po (added)
-
trunk/mathpublisher.php (modified) (1 diff)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/style.css (added)
-
trunk/wpmathpublisher.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpmathpublisher/trunk/mathpublisher.php
r100541 r161694 1710 1710 1711 1711 } 1712 $valign=$v-1000 ;1712 $valign=$v-1000-4; 1713 1713 return '<img src="'.$pathtoimg."math_".$v."_".$nameimg.'" style="vertical-align:'.$valign.'px;'.' display: inline-block;" alt="'.$text.'" title="'.$text.'"/>'; 1714 1714 } -
wpmathpublisher/trunk/readme.txt
r100688 r161694 3 3 Tags: math, post, equation, formula 4 4 Requires at least: 2.5 5 Tested up to: 2. 76 Stable tag: 0. 4.3.15 Tested up to: 2.8.4 6 Stable tag: 0.5 7 7 8 8 Plugin that allows formulars to be included in blog texts (as graphics) … … 21 21 * Basic function: Convert equations into graphics 22 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 s to 12px, but can be choosen individually for each image23 * Font size default value can be set, but also changed for every single image if necessary 24 24 * If you just want to output a formula there is a "noparse" attribute that will output the pure text nicely formatted 25 25 * Saves the images on the webspace, which saves processor time … … 28 28 **Configuration**: 29 29 30 To configure the plugin there is an easy to use admin panel page (since v0.3.1). Here you can choose the RGB-components of the font and background color. In addition to that you can choose an alpha-transparency. To have a look at the result there is a small and (I'm afraid) quite bad preview. 31 If you want to change the size of the font used in the image output, use the "size" attribute in yout posts: [math size="16"]x^2[/math] 30 To configure the plugin there is an easy to use admin panel page (since v0.3.1). 31 Here you can choose the RGB-components of the font and background color. In addition to that you can choose an alpha-transparency. 32 Furthermore you can choose a default font-size used for the images 32 33 33 34 **Commands**: … … 37 38 **Translation**: 38 39 39 So far there is no translation to this plugin, though it supports this. As a feature to be added in future i plan to translate it into german. Other languages would be welcome, so contact me if you need the po-file. 40 A german description and some installetion notes can be found on the [plugins homepage](http://blog.kraeuterbruederchen.de/wordpress/wpmathpublisher/ "Plugins Homepage") 40 The plugin ist currently available in 41 * English (default) 42 * German (Translated by me) 41 43 42 44 == Installation == … … 47 49 1. Extract the package using any programm you want (i.e.: [7zip](http://7zip.org/ "7zip archiving tool")) 48 50 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/) 49 1. Make sure the the script can write in the folder /wp-content/plugins/wpmathpubisher/img (chmod 777). This is necessary, because this is where the script saves the images50 51 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 777 51 53 1. Done. Go for it! 52 53 == Frequently Asked Questions ==54 55 = How can i change the default font size? =56 57 Currently there is no comfortable way to do this. But if you are confident of doing some easy editing the code, do the folling changes:58 * Choose "edit Plugin" on your Wordpress-Plugin-Page59 * Scroll down. There will be a line "var $size = 12;" - change the "12" to your desired font size60 * Scroll down further. There is a line "update_option('wpmathpublisher_size', 12);" - again, change the *"12"*61 54 62 55 == Screenshots == -
wpmathpublisher/trunk/wpmathpublisher.php
r100688 r161694 6 6 Author: Timm Severin 7 7 Author URI: http://kraeuterbruederchen.de 8 Version: 0.4.3.1 8 Text Domain: wpmathpublisher 9 Version: 0.5 9 10 10 11 Copyright: … … 29 30 v 0.4.3.1 [2009-03-08] 30 31 ! fixed a problem with the svn, reupload for complete installation 32 v 0.4.4 [2009-09-*] (never uploaded) 33 ! fixed height of text in graphics as suggested by a productive user ;) 34 v 0.5 35 - removed reading options written by older versions of this plugin 36 + added german translation ("Sie" und "Du") 37 + will create image folder if possible 38 + if image folder is not writeable or could not be created, plugin will output a message in admin center 39 + added option to change default fontsize 40 ! exported display settings of admin page to css-file 31 41 32 42 Roadmap: 33 - translate into german34 43 - add option to change default fontset 35 - add attribute noparse 44 - display maximum font size / minimum font size 45 - nicer font-chooser 36 46 */ 37 47 … … 46 56 define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); 47 57 58 define('WPMP_TEXTDOMAIN', 'wpmathpublisher'); 59 define ('WPMP_FOLDER', basename(dirname(__FILE__))); 60 define('WPMP_BASEDIR', WP_PLUGIN_DIR.'/'.WPMP_FOLDER); 61 define('WPMP_BASEURL', WP_PLUGIN_URL.'/'.WPMP_FOLDER); 62 63 define('WPMP_FONT_MAX', 24); 64 define('WPMP_FONT_MIN', 10); 65 48 66 // Include PhpMathPublisher 49 67 include_once('mathpublisher.php'); … … 54 72 var $size = 12; 55 73 var $imgPath = ''; 74 var $ready = true; 56 75 57 76 // constructor 58 77 function WpMathPublisher() { 59 // get path for saving images - create if necessary 60 $this->imgPath = WP_PLUGIN_URL.'/wpmathpublisher/img/'; 78 $this->__construct(); 79 } 80 81 // constructor for later php versions 82 function __construct() { 83 // get path for saving images - create if necessary 84 $imgDir = WPMP_BASEDIR.'/img/'; 85 if(!is_dir($imgDir) && !mkdir($imgDir)) 86 $this->ready = false; 87 if(!is_writeable($imgDir)) 88 $this->ready = false; 89 90 91 $this->imgPath = WPMP_BASEURL.'/img/'; 61 92 62 93 $this->readOptions(); 63 94 } 64 95 65 //add theme page96 ## add theme page 66 97 function admin_menu() { 67 add_theme_page(__('WpMathPublisher'), __('WpMathPublisher'), 5, WP_PLUGIN_DIR.'/wpmathpublisher/inc/admin_themePage.php'); // original function, can still be found somewhere down there, but has been replaced by external file. May not be up to date! 98 wp_enqueue_style('wpmathpublisher', WPMP_BASEURL.'/style.css'); 99 add_theme_page(__('WpMathPublisher', WPMP_TEXTDOMAIN), __('WpMathPublisher', WPMP_TEXTDOMAIN), 5, WPMP_BASEDIR.'/inc/admin_themePage.php'); 100 } 101 102 ## initialization function 103 function init() { 104 load_plugin_textdomain(WPMP_TEXTDOMAIN, WPMP_BASEDIR.'/locale', WPMP_FOLDER.'/locale'); 105 106 if(!$this->ready) { 107 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 } 68 109 } 69 110 70 111 ## activation / deactivation 71 112 function activate() { 72 if(!is_dir(WP _PLUGIN_DIR.'/wpmathpublisher/img/')) {73 if(!mkdir(WP _PLUGIN_DIR.'/wpmathpublisher/img/', 0777)) {113 if(!is_dir(WPMP_BASEDIR.'/img/')) { 114 if(!mkdir(WPMP_BASEDIR.'/img/', 0777)) { 74 115 deactivate_plugins(basename(__FILE__)); // Deactivate itself 75 116 } 76 } elseif(!chmod(WP _PLUGIN_DIR.'/wpmathpublisher/img/')) {117 } elseif(!chmod(WPMP_BASEDIR.'/img/')) { 77 118 deactivate_plugins(basename(__FILE__)); // Deactivate itself 78 119 } 79 80 $this->readOldValues(); 81 120 82 121 add_option('wpmathpublisher_font', $this->font); 83 122 add_option('wpmathpublisher_back', $this->back); … … 93 132 } 94 133 134 ## resets the plugins options to default values 95 135 function toDefaults() { 96 136 update_option('wpmathpublisher_font', array('red' => 0, 'green' => 0, 'blue' => 0, 'alpha' => 0)); … … 101 141 102 142 return true; 103 }104 105 function readOldValues() {106 if($value = get_option('wpmathpublisher_fontRed'))107 $this->font['red'] = $value;108 if($value = get_option('wpmathpublisher_fontGreen'))109 $this->font['green'] = $value;110 if($value = get_option('wpmathpublisher_fontBlue'))111 $this->font['blue'] = $value;112 if($value = get_option('wpmathpublisher_fontAlpha'))113 $this->font['alpha'] = $value;114 if($value = get_option('wpmathpublisher_backRed'))115 $this->back['red'] = $value;116 if($value = get_option('wpmathpublisher_backGreen'))117 $this->back['green'] = $value;118 if($value = get_option('wpmathpublisher_backBlue'))119 $this->back['blue'] = $value;120 if($value = get_option('wpmathpublisher_backAlpha'))121 $this->back['alpha'] = $value;122 123 delete_option('wpmathpublisher_fontRed');124 delete_option('wpmathpublisher_fontGreen');125 delete_option('wpmathpublisher_fontBlue');126 delete_option('wpmathpublisher_fontAlpha');127 delete_option('wpmathpublisher_fontValue');128 delete_option('wpmathpublisher_backRed');129 delete_option('wpmathpublisher_backGreen');130 delete_option('wpmathpublisher_backBlue');131 delete_option('wpmathpublisher_backAlpha');132 delete_option('wpmathpublisher_backValue');133 143 } 134 144 … … 143 153 } 144 154 145 // function that checks whteregiven rgb values are valid155 ## function that checks whether given rgb values are valid 146 156 function checkRGB($_red, $_green, $_blue, $_alpha=0) { 147 157 $message = ''; 148 158 if(!is_numeric($_red) || $_red < 0 || $_red > 255) 149 $message .= '< br />'. __('» value of red component is invalid');159 $message .= '<li>'. __('value of red component is invalid', WPMP_TEXTDOMAIN).'</li>'; 150 160 if(!is_numeric($_green) || $_green < 0 || $_green > 255) 151 $message .= '< br />'. __('» value of green component is invalid');161 $message .= '<li>'. __('value of green component is invalid', WPMP_TEXTDOMAIN).'</li>'; 152 162 if(!is_numeric($_blue) || $_blue < 0 || $_blue > 255) 153 $message .= '< br />'. __('» value of blue component is invalid');163 $message .= '<li>'. __('value of blue component is invalid', WPMP_TEXTDOMAIN).'</li>'; 154 164 if(!is_numeric($_alpha) || $_alpha < 0 || $_alpha > 127) 155 $message .= '< br />'. __('» transparency value is invalid');165 $message .= '<li>'. __('transparency value is invalid', WPMP_TEXTDOMAIN).'</li>'; 156 166 157 167 return $message; 158 168 } 159 169 160 //parses shortcode170 ## parses shortcode 161 171 function parseMath($attributes, $content) { 162 if(isset($attributes['noparse']) && $attributes['noparse'] == 'true') { 172 $attrString = ''; 173 174 if(!$this->ready) { 175 foreach($attributes as $key => $value) 176 $attrString .= ' '.$key.'='.$value; 177 178 $output = '[math'.$attrString.']'.$content.'[/math]'; 179 180 return $output; 181 } elseif(isset($attributes['noparse']) && $attributes['noparse'] == 'true') { 163 182 unset($attributes['noparse']); 164 $attrString = '';165 183 foreach($attributes as $key => $value) 166 184 $attrString .= ' '.$key.'='.$value; … … 176 194 // function to delete all images in cache 177 195 function clearCache() { 178 $basePath = WP _PLUGIN_DIR.'/wpmathpublisher/img';196 $basePath = WPMP_BASEDIR.'/img'; 179 197 180 198 $dir = dir($basePath); … … 211 229 //register_deactivation_hook(__FILE__, array($myWpMathPublisher, 'deactivate')); 212 230 213 //add_filter('the_content', array($myWpMathPublisher, 'mathpublish'), 1);231 add_action('init', array($myWpMathPublisher, 'init')); 214 232 add_action('admin_menu', array($myWpMathPublisher, 'admin_menu')); 215 233 add_shortcode('math', array($myWpMathPublisher, 'parseMath'));
Note: See TracChangeset
for help on using the changeset viewer.