Plugin Directory

Changeset 1983432


Ignore:
Timestamp:
11/30/2018 07:12:52 PM (7 years ago)
Author:
johnalarcon
Message:

Add logic to check for platform and display appropriate title.

Location:
site-info/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • site-info/trunk/alar-site-info.php

    r1929772 r1983432  
    44 * Plugin Name: Site Info
    55 * Description: Discover your current versions for WordPress, PHP, plugins, themes, and various other server information.
    6  * Version: 1.1.0
     6 * Version: 1.2.0
    77 * Author: John Alarcon
    88 * Author URI: https://twitter.com/realJohnAlarcon
     
    4949 */
    5050class SiteInfo {
    51    
     51
    5252    /**
    5353     * Minimum PHP version required.
     
    6565
    6666    /**
     67     * Default platform.
     68     *
     69     * @var string
     70     */
     71    public $platform = 'WordPress';
     72
     73    /**
    6774     * The constructor provides a PHP gate to ensure that installation cannot be
    6875     * completed on an incompatible PHP version.
     
    7178     */
    7279    public function __construct() {
    73        
     80
    7481        // This plugin requires at least PHP 5.3. Abort if less than that.
    7582        if(version_compare('5.3', $this->min_php, '<')) {
     
    7784            return;
    7885        }
    79        
     86
    8087        // Ensure minimum PHP is met or abort installation.
    8188        if(version_compare(PHP_VERSION, $this->min_php, '<')) {
     
    8390            return;
    8491        }
    85        
     92
     93        if (function_exists('classicpress_version')) {
     94            $this->platform = 'ClassicPress';
     95        }
     96
    8697        // If here, PHP version is acceptable – load the plugin.
    8798        $this->init();
     
    94105     */
    95106    private function init() {
    96        
     107
    97108        // Load constants used within the plugin; do this first.
    98109        require_once plugin_dir_path(__FILE__).'includes/constants.php';
    99        
     110
    100111        // Register hooks for plugin activation and deactivation; use $this.
    101112        register_activation_hook(__FILE__,   [$this, 'activate_plugin']);
    102113        register_deactivation_hook(__FILE__, [$this, 'deactivate_plugin']);
    103        
     114
    104115        // Register hook for plugin deletion; use __CLASS__.
    105116        register_uninstall_hook(__FILE__, [__CLASS__, 'uninstall_plugin']);
    106        
     117
    107118        // Register admin menu and notices.
    108119        add_action('admin_menu', [$this, 'register_admin_menu']);
    109        
     120
    110121        // Register scripts and styles.
    111122        add_action('admin_enqueue_scripts', [$this, 'register_backend_scripts'], 10);
     
    141152        }
    142153    }
    143    
     154
    144155    /**
    145156     * Register backend styles
     
    166177        return $item;
    167178    }
    168    
     179
    169180    /**
    170181     * Render the information page.
     
    173184     */
    174185    public function render_site_info() {
    175        
     186
    176187        // Globalize the database object.
    177188        global $wpdb;
    178        
     189
    179190        // Include core version.php file.
    180191        include(PATH_HOME.'/wp-includes/version.php');
    181        
     192
    182193        // Include core file.php file.
    183194        if(!function_exists('get_home_path')) {
     
    192203        // Open container and add plugin title.
    193204        echo '<div class="wrap">'."\n";
    194         echo '<h1 class="wp-heading">'.__('Site Info', 'alar-site-info').'</h1>'."\n";
    195        
    196         // --------------------------------------------------
    197         // Heading for WordPress Info section
    198         // --------------------------------------------------
    199         echo '<h1 class="alar-site-info-heading">'.__('WordPress Information', 'alar-site-info').'</h1>';
    200        
     205        echo '<h1 class="wp-heading">'.$this->platform.' '.__('Information', 'alar-site-info').'</h1>'."\n";
     206
    201207        // WP VERSION
    202208        echo '<h2 class="alar-site-info-subheading">'.__('Installed Version', 'alar-site-info').'</h2>';
     
    204210        if (!isset($wp_version)) {
    205211            $dashicon = 'warning';
    206             $tooltip = __('WordPress version not detected.', 'alar-site-info');
     212            $tooltip = __('Platform version not detected.', 'alar-site-info');
    207213            $message = $tooltip;
    208214            echo $this->get_list_item($dashicon, $tooltip, $message);
     
    217223            } else {
    218224                $dashicon = 'warning';
    219                 $tooltip = __('For maximum security and stability, please update your WordPress to the latest version.', 'alar-site-info');
     225                $tooltip = __('For maximum security and stability, please update your site to the latest version.', 'alar-site-info');
    220226                $message = $wp_version.' [<a href="'.admin_url().'update-core.php">'.__('Update Recommended', 'alar-site-info').'</a>]';
    221227            }
     
    223229        }
    224230        echo '</ul>';
    225        
     231
    226232        // DATABASE
    227233        echo '<h2 class="alar-site-info-subheading">'.__('Database', 'alar-site-info').'</h2>';
     
    237243        }
    238244        echo '</ul>';
    239        
     245
    240246        // THEMES
    241247        $all_themes = wp_get_themes();
     
    256262        }
    257263        echo '</ul>';
    258        
     264
    259265        // PLUGINS
    260266        $all_plugins = get_plugins();
     
    276282        }
    277283        echo '</ul>';
    278        
     284
    279285        // URIs
    280286        $uploads = wp_upload_dir();
     
    290296        echo $this->get_list_item('yes', '', '<strong>'.__('Uploads', 'alar-site-info').'</strong>: '.$uploads['baseurl']);
    291297        echo '</ul>';
    292        
    293        
     298
     299
    294300        // --------------------------------------------------
    295301        // HEADING: Server information
    296302        // --------------------------------------------------
    297303        echo '<h1 class="alar-site-info-heading">'.__('Server Information', 'alar-site-info').'</h1>';
    298        
     304
    299305        // SERVER OPERATING SYSTEM
    300306        echo '<h2 class="alar-site-info-subheading">'.__('Operating System', 'alar-site-info').'</h2>';
     
    302308        echo $this->get_list_item('yes', '', php_uname());
    303309        echo '</ul>';
    304        
     310
    305311        // SERVER SOFTWARE
    306312        if (isset($_SERVER['SERVER_SOFTWARE']) && !empty($_SERVER['SERVER_SOFTWARE'])) {
     
    322328        echo $this->get_list_item($dashicon, $tooltip, $message);
    323329        echo '</ul>';
    324        
     330
    325331        // SERVER PROTOCOL
    326332        if (isset($_SERVER['SERVER_PROTOCOL']) && !empty($_SERVER['SERVER_PROTOCOL'])) {
     
    336342        echo $this->get_list_item($dashicon, $tooltip, $message);
    337343        echo '</ul>';
    338        
     344
    339345        // SERVER PORT
    340346        if (isset($_SERVER['SERVER_PORT']) && !empty($_SERVER['SERVER_PORT'])) {
     
    350356        echo $this->get_list_item($dashicon, $tooltip, $message);
    351357        echo '</ul>';
    352        
     358
    353359        // SSL
    354360        echo '<h2 class="alar-site-info-subheading">'.__('SSL', 'alar-site-info').'</h2>';
     
    405411        echo $this->get_list_item($dashicon, $tooltip, $message);
    406412        echo '</ul>';
    407        
    408        
     413
     414
    409415        // cURL
    410416        echo '<h2 class="alar-site-info-subheading">'.__('cURL', 'alar-site-info').'</h2>';
     
    421427        }
    422428        echo '</ul>';
    423        
     429
    424430        // TRANSPORTS
    425431        echo '<h2 class="alar-site-info-subheading">'.__('Supported Transports', 'alar-site-info').'</h2>';
     
    430436        }
    431437        echo '</ul>';
    432        
     438
    433439        // ------------------------------
    434440        // PHP version & extensions
     
    463469        }
    464470        echo '</ul>';
    465        
     471
    466472        // FULL PHP INFO
    467473        echo '<ul class="alar-site-info-indent-two alar-site-info-full-php-info">';
     
    477483        echo '</li>';
    478484        echo '</ul>';
    479        
     485
    480486        // OUTER CONTAINER
    481487        echo '</div><!-- .wrap -->';
    482488    }
    483    
     489
    484490    /**
    485491     * Prevent installation
     
    506512        echo $markup;
    507513    }
    508        
     514
    509515    /**
    510516     * Plugin activation
     
    519525        }
    520526    }
    521    
     527
    522528    /**
    523529     * Plugin deactivation
     
    532538        }
    533539    }
    534    
     540
    535541    /**
    536542     * Plugin deletion
  • site-info/trunk/readme.txt

    r1982722 r1983432  
    99License URI: http://www.gnu.org/licenses/gpl-2.0.txt
    1010
    11 Quickly see your site's version numbers, database info, installed plugins and themes, paths and URLs, ports, protocols, and other info. Built as a POC for a local Meetup. Works with WordPress and ClassicPress.
     11Quickly see your site's version numbers, database info, installed plugins and themes, paths and URLs, ports, protocols, and other info. Built as a POC for a local Meetup.
    1212
    1313== Description ==
     
    3636
    3737== Frequently Asked Questions ==
     38**Does it work with Gutenberg?**
     39Yes. Because the plugin does not have any editor functionality, it is unaffected by Gutenberg.
     40
     41**Does it work with ClassicPress?**
     42Yes.
     43
    3844**Where is my site info displayed?**
    3945In your WordPress dashboard, hover the **Tools** menu and you will find a new item named **Site Info**.
     
    5258
    5359== Changelog ==
     60**1.2.0**
     61Add conditional to check whether installed on WordPress or ClassicPress; update onscreen titles accordingly.
     62
    5463**1.1.0**
    5564Fix Server Error 406 that occurred on some hosts due to including a local file via HTTP URL instead of relative path.
Note: See TracChangeset for help on using the changeset viewer.