Plugin Directory

Changeset 535156


Ignore:
Timestamp:
04/23/2012 05:48:42 PM (14 years ago)
Author:
Astrodan
Message:
 
Location:
wpmathpublisher/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wpmathpublisher/trunk/readme.txt

    r221131 r535156  
    33Tags: math, post, equation, formula
    44Requires at least: 2.5
    5 Tested up to: 2.8.6
    6 Stable tag: 0.6.3.1
     5Tested up to: 3.3.1
     6Stable tag: 0.6.4
    77
    88Plugin that allows formulars to be included in blog texts (as graphics)
     
    4545*   German (translated by me)
    4646*   Belorussian (by [Marcis G](http://pc.de/ "Marcis G."))
     47*   Romanian (by [Web Hosting Geeks](http://webhostinggeeks.com/ "Web Geek Sciense")
    4748
    4849== Changelog ==
    49 
     50= v 0.6.4 [2012-04-19]
     51* fixed activation problem
     52* fixed tinyMCE integration (language issue)
     53* added romanian translation (since this update not complete) by Alexander Ovsov [ http://webhostinggeeks.com/ ]
    5054= v 0.6.3.1 [2010-03-23] =
    5155* fixed things this f*cking svn gui messed with
     
    1001041. Upload the extracted folder, including all subfolders (no matter if empty or not) to the plugin directory of your wordpress installation (/wp-content/plugins/)
    1011051. Activate the plugin in your wordpress administration center
    102 1. If necessary (script will tell you) , create the folder "img" as subdirectory of the wpmathpublisher directory and set it to chmod 777
     1061. If necessary (script will tell you), create the folder "img" as subdirectory of the wpmathpublisher directory and set it to chmod 777
    1031071. Done. Go for it!
    104108
  • wpmathpublisher/trunk/wpmathpublisher.php

    r221131 r535156  
    22/*
    33Plugin Name: WpMathPublisher
    4 Plugin URI: http://blog.kraeuterbruederchen.de
    5 Description: Allows to include formulas written for <a href="http://www.xm1math.net/phpmathpublisher/" title="PhpMathPublisher">PhpMathPublisher</a>. Formulas have to be put into [m][/m] - tags. For formula information visit: <a href="http://www.xm1math.net/phpmathpublisher/doc/help.html" title="PhpMathPublisher - Help">PhpMathPublisher-Page</a>
     4Plugin URI: http://devblog.kraeuterbruederchen.de/2012/04/wpmathpublisher-2/
     5Description: Allows to include formulas written for <a href="http://www.xm1math.net/phpmathpublisher/" title="PhpMathPublisher">PhpMathPublisher</a>. Formulas have to be put into [math][/math] - tags. For formula information visit: <a href="http://www.xm1math.net/phpmathpublisher/doc/help.html" title="PhpMathPublisher - Help">PhpMathPublisher-Page</a>
    66Author: Timm Severin
    77Author URI: http://kraeuterbruederchen.de
     
    5656        ! fixed things this f*cking svn gui messed with
    5757        ! woring up to Wordpress 2.8.6
     58    v 0.6.4 [2012-04-23]
     59        ! fixed activation problem
     60        ! fixed tinyMCE integration (language issue)
     61        + added romanian translation (since this update not complete) by Alexander Ovsov [ http://webhostinggeeks.com/ ]
     62        ! updated german translations
    5863       
    5964Roadmap:
     
    7782define('WPMP_BASEURL', WP_PLUGIN_URL.'/'.WPMP_FOLDER);
    7883
     84# Admin-Interface output function
     85function trigger_message($message, $errno) {
     86    if(isset($_GET['action']) && $_GET['action'] == 'error_scrape') {
     87        echo '<div style="font-size: 8pt; font-family: Tahoma;">' . $message . '</div>';
     88        exit;
     89    } else {
     90        trigger_error($message, $errno);
     91    }
     92}
     93
    7994## get other constants
    8095include_once('constants.php');
     
    97112    // constructor for later php versions
    98113    function __construct() {
    99         // get path for saving images - create if necessary    
     114        // get path for saving images   
    100115        $imgDir = WPMP_BASEDIR.'/img/';
    101         if(!is_dir($imgDir) && !mkdir($imgDir))
     116        if(!is_dir($imgDir))
    102117            $this->ready = false;
    103118        if(!is_writeable($imgDir))
    104119            $this->ready = false;
    105            
    106        
     120               
    107121        $this->imgPath = WPMP_BASEURL.'/img/';
    108122
     
    149163    ## activation / deactivation
    150164    function activate() {
     165        $message = ''; $failed = false;
    151166        if(!is_dir(WPMP_BASEDIR.'/img/')) {
    152             if(!mkdir(WPMP_BASEDIR.'/img/', 0777)) {
    153                 deactivate_plugins(basename(__FILE__)); // Deactivate itself
     167            $message .= 'Image directory does not exist. Trying to create it...';
     168            if((substr(sprintf('%o', fileperms(WPMP_BASEDIR)), -4) != "0777") or (!@mkdir(WPMP_BASEDIR.'/img/', 0777))){
     169                $message .= 'creating failed, permission denied. Please do the following steps manually:';
     170                $message .= '
     171                    <ol>
     172                        <li>Use a FTP-Client to access your wordpress installation and go to the WpMathPublisher-Plugin directory ('.WPMP_BASEDIR.')</li>
     173                        <li>Create a subdirectory "img"</li>
     174                        <li>Grant full write access to the image directory (<i>chmod 777</i>)</li>
     175                    </ol>
     176                ';
     177                // seems not to be necessary
     178                #deactivate_plugins(basename(__FILE__)); // Deactivate itself
     179               
     180                $failed = true;
     181            } else {
     182                $message .= 'succesfull';
    154183            }
    155         } elseif(!chmod(WPMP_BASEDIR.'/img/')) {
    156             deactivate_plugins(basename(__FILE__)); // Deactivate itself
    157         }
    158        
    159         $font = get_option('wpmathpublisher_font');
    160         $back = get_option('wpmathpublisher_back');
    161         if(isset($font['red'])) {
    162             ## convert old values
     184        } elseif(substr(sprintf('%o', fileperms(WPMP_BASEDIR.'/img/')), -4) != "0777") {
     185            $message .= 'Permission to write to image directory has been denied. Trying to set permissions...';
     186            if((substr(sprintf('%o', fileperms(WPMP_BASEDIR)), -4) != "0777") or (!@chmod(WPMP_BASEDIR.'/img/', 0777))){
     187                $message .= 'failed to set permissions. Please do the following steps manually:';
     188                $message .= '
     189                    <ol>
     190                        <li>Use a FTP-Client to access your wordpress installation and go to the WpMathPublisher-Plugin directory ('.WPMP_BASEDIR.')</li>
     191                        <li>Grant full write access to the image directory (<i>chmod 777</i>)</li>
     192                    </ol>
     193                ';
     194                // seems not to be necessary
     195                #deactivate_plugins(basename(__FILE__)); // Deactivate itself
     196                $failed = true;
     197            } else {
     198                $message .= 'successfull';
     199            }
     200        }
     201        if(!empty($message)) { trigger_message($message, E_USER_ERROR); }
     202        if($failed) { exit; }
     203               
     204        ## Check if update or newly installed
     205        if(get_option('wpmathpublisher_font') === false) {
     206            ## new installation, setup default values
     207            add_option('wpmathpublisher_font', array('color' => '000000', 'alpha' => 0));
     208            add_option('wpmathpublisher_back', array('color' => 'ffffff', 'alpha' => 0));
     209            add_option('wpmathpublisher_size', 12);
     210        } elseif(isset($font['red'])) {
     211            ## UPDATE, convert old values (earlier versions)
    163212            $fontColor = $this->convertRgbToHex($font);
    164213            update_option('wpmathpublisher_font', array('color' => $fontColor, 'alpha' => $font['alpha']));
    165214            $backColor = $this->convertRgbToHex($back);
    166215            update_option('wpmathpublisher_back', array('color' => $backColor, 'alpha' => $back['alpha']));
    167            
    168             $this->clearCache();
    169             $this->readOptions();
    170         }
    171            
    172         add_option('wpmathpublisher_font', $this->font);
    173         add_option('wpmathpublisher_back', $this->back);
    174         add_option('wpmathpublisher_size', $this->size);
     216        } else {
     217            ## no changes necessary
     218        }
    175219    }
    176220   
    177221    function deactivate() {
     222        # clear database
    178223        delete_option('wpmathpublisher_font');
    179224        delete_option('wpmathpublisher_back');
    180225        delete_option('wpmathpublisher_size');
    181226       
    182         $this->clearCache();
     227        # clean filesystem
     228        self::clearCache();
     229       
     230        ## delete image-directory if possible // not executed, why?
     231        #if(substr(sprintf('%o', fileperms(WPMP_BASEDIR)), -4) == "0777")
     232        #   rmdir(WPMP_BASEDIR.'/img');
    183233    }
    184234   
     
    265315   
    266316    ## function to delete all images in cache
    267     function clearCache() {
     317    static function clearCache() {
    268318        $basePath = WPMP_BASEDIR.'/img';
    269319   
     
    299349$myWpMathPublisher =& new WpMathPublisher;
    300350
    301 // Create  data/clean up
    302 register_activation_hook(__FILE__, array($myWpMathPublisher, 'activate'));
    303 //register_deactivation_hook(__FILE__, array($myWpMathPublisher, 'deactivate'));
     351// Create data/clean up
     352register_activation_hook(__FILE__, array('WpMathPublisher', 'activate'));
     353register_deactivation_hook(__FILE__, array('WpMathPublisher', 'deactivate'));
    304354
    305355add_action('init', array($myWpMathPublisher, 'init'));
Note: See TracChangeset for help on using the changeset viewer.