Example #1
0
 /**
  * Deletes all the files in the temp directory under 
  * wp-content/uploads/magic-action-box/
  */
 public static function clearCacheDir($ext = '*')
 {
     mab_make_stylesheet_path_writable();
     $dir = mab_get_stylesheet_location('path');
     foreach (glob($dir . "*.{$ext}") as $file) {
         unlink($file);
     }
 }
Example #2
0
/**
 * Try and make stylesheet directory writable. May not work if safe-mode or
 * other server configurations are enabled.
 *
 * @author Gary Jones
 * @since 1.0
 */
function mab_make_stylesheet_path_writable()
{
    if (!is_dir(mab_get_stylesheet_location('path'))) {
        mkdir(mab_get_stylesheet_location('path'));
    }
    if (!is_writable(mab_get_stylesheet_location('path'))) {
        @chmod(mab_get_stylesheet_location('path'), 0775);
    }
    if (is_writable(mab_get_stylesheet_location('path'))) {
        return true;
    }
    return false;
}
Example #3
0
    ?>
					<tr>
						<th><strong><?php 
    _e('CSS directory', 'mab');
    ?>
</strong></th>
						<td>
							<pre><?php 
    print_r($css_dir);
    ?>
</pre>
							<?php 
    if (!mab_make_stylesheet_path_writable()) {
        if (!is_dir($css_dir)) {
            $dir_text = '<p class="error-text">' . __('CSS directory does not exist. ', 'mab') . '</p>';
        } elseif (!is_writable(mab_get_stylesheet_location('path'))) {
            $dir_text = '<p class="error-text">' . __('Directory exists but is not writable.', 'mab') . '</p>';
        }
    } else {
        $dir_text = '<p class="success-text">' . __('Directory exists.', 'mab') . '</p>';
    }
    ?>
							<?php 
    echo $dir_text;
    ?>
						</td>
					</tr>

					<?php 
    if (is_dir($css_dir)) {
        ?>