Plugin Directory

Changeset 1577624


Ignore:
Timestamp:
01/18/2017 11:26:48 PM (9 years ago)
Author:
hopstudios
Message:

add better errors messages when testing theme folder/file access; bump to v1.2.1

Location:
mountee/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • mountee/trunk/mountee.php

    r1565150 r1577624  
    55Plugin URI: https://hellomountee.com/
    66Description: Mount your template files as a virtual drive in OS X
    7 Version: 1.2
     7Version: 1.2.1
    88Author: Hop Studios
    99Author URI: http://www.hopstudios.com
     
    1919
    2020if (!defined('MOUNTEE_3_VERSION')) {
    21     define('MOUNTEE_3_VERSION', '1.2');
     21    define('MOUNTEE_3_VERSION', '1.2.1');
    2222}
    2323
  • mountee/trunk/mountee_3.controller.php

    r1565148 r1577624  
    3131    {
    3232        $status = 'ok';
    33         if (!$this->theme_helper->test_theme_files_for_operations())
     33
     34        if (!$this->theme_helper->test_theme_folder_read())
    3435        {
    3536            $status = 'disabled';
    36             $message = 'Something went wrong when checking for theme folders and files access.';
     37            $message = 'Your theme folder '.$this->theme_helper->theme_folder_name.' is not readable.';
     38        }
     39        else if (!$this->theme_helper->test_theme_folder_write())
     40        {
     41            $status = 'disabled';
     42            $message = 'Your theme folder '.$this->theme_helper->theme_folder_name.' is not writable.';
     43        }
     44        else if (!$this->theme_helper->test_theme_inner_files_read())
     45        {
     46            $status = 'disabled';
     47            $message = 'One or several of your theme files in '.$this->theme_helper->theme_folder_name.' are not readable.';
     48        }
     49        else if (!$this->theme_helper->test_theme_inner_files_write())
     50        {
     51            $status = 'disabled';
     52            $message = 'One or several of your theme files in '.$this->theme_helper->theme_folder_name.' are not writable.';
    3753        }
    3854
  • mountee/trunk/mountee_3.theme_helper.php

    r1534560 r1577624  
    5454
    5555    /**
     56     * Test if the theme folder is readable
     57     */
     58    public function test_theme_folder_read()
     59    {
     60        return is_readable($this->theme_absolute_path);
     61    }
     62
     63    /**
     64     * Test if the theme folder is writable
     65     */
     66    public function test_theme_folder_write()
     67    {
     68        return is_writable($this->theme_absolute_path);
     69    }
     70
     71    /**
     72     * Test files in the theme folder for readability (only in theme folder, not subfolders)
     73     */
     74    public function test_theme_inner_files_read()
     75    {
     76        $folders_files = scandir($this->theme_absolute_path);
     77        foreach ($folders_files as $folder_file)
     78        {
     79            $folder_file_abs_path = $this->theme_absolute_path.DIRECTORY_SEPARATOR.$folder_file;
     80            if ($folder_file != '.'
     81                && $folder_file != '..'
     82                && is_file($folder_file_abs_path)
     83            )
     84            {
     85                if (!is_readable($folder_file_abs_path))
     86                {
     87                    return FALSE;
     88                }
     89            }
     90        }
     91
     92        return TRUE;
     93    }
     94
     95    /**
     96     * Test files in the theme folder for writability (only in theme folder, not subfolders)
     97     */
     98    public function test_theme_inner_files_write()
     99    {
     100        $folders_files = scandir($this->theme_absolute_path);
     101        foreach ($folders_files as $folder_file)
     102        {
     103            $folder_file_abs_path = $this->theme_absolute_path.DIRECTORY_SEPARATOR.$folder_file;
     104            if ($folder_file != '.'
     105                && $folder_file != '..'
     106                && is_file($folder_file_abs_path)
     107            )
     108            {
     109                if (!is_writable($folder_file_abs_path))
     110                {
     111                    return FALSE;
     112                }
     113            }
     114        }
     115
     116        return TRUE;
     117    }
     118
     119    /**
    56120     * Test if a folder with that name exists
    57121    */
  • mountee/trunk/readme.txt

    r1565148 r1577624  
    55Requires at least: 4.4
    66Tested up to: 4.7
    7 Stable tag: 1.2
     7Stable tag: 1.2.1
    88License: GPLv2 or later
    99License URI: https://hellomountee.com/docs/legal/#license_agreement
Note: See TracChangeset for help on using the changeset viewer.