Plugin Directory

Changeset 815932


Ignore:
Timestamp:
12/06/2013 01:20:46 PM (12 years ago)
Author:
netandreus
Message:

Add pre-install php version checks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • symfopress-lite/trunk/symfopress-lite.php

    r815404 r815932  
    5757        }
    5858
     59        public function install()
     60        {
     61            if ( ! current_user_can( 'activate_plugins' ) )
     62                return;
     63
     64            // Is PHP supports namespaces?
     65            if(!version_compare(phpversion(), '5.3.3', '>=')) {
     66            //if(true) {
     67                echo '<div class="error">'
     68                    . '<h3>' . __( 'Error activating the plugin', WPLANG ). '</h3>'
     69                    . '<p>' . __( 'You need PHP >= 5.3.3 to activate this plugin.', WPLANG ).'&nbsp;'
     70                    . __( 'Your version', WPLANG ).' is <b>'.phpversion().'</b></p>'
     71                    .'</div>'
     72                ;
     73                deactivate_plugins(__FILE__); // deactivate plugin
     74                unset($_GET['activate']);     // disble activation message
     75            }
     76        }
     77
    5978        /**
    6079         * Returns a string to add to the WordPress Footer
     
    6382        public function init_action() {
    6483            // For debug
     84            /*
    6585            error_reporting(E_ALL);
    6686            ini_set('display_errors', true);
    6787            date_default_timezone_set('Europe/Moscow');
    68 
     88            */
     89           
    6990            // If Plugin is not properly install just return to WordPress dispatching
    7091            if(!array_key_exists('dispatching', $this->_Options) OR $this->_Options['dispatching'] == false)
     
    207228    add_action('plugins_loaded', array(&$NetandreusSymfopressLitePlugin, 'init_action'), 100);
    208229    add_action('admin_menu',  array (&$NetandreusSymfopressLitePlugin, 'admin') );
     230    add_action('admin_head',  array (&$NetandreusSymfopressLitePlugin, 'install') );
    209231}
    210232?>
Note: See TracChangeset for help on using the changeset viewer.