Permalink
Browse files

Fix permissions on linux and fix empty helpers folder

  • Loading branch information...
1 parent 80bff54 commit e33a03e39ace6377ac707e029f9a430e49d5a409 @namuit namuit committed Dec 1, 2011
View
@@ -21,11 +21,13 @@ class Wordless {
private static $preferences = array();
public static function initialize() {
- self::load_i18n();
- self::require_helpers();
- self::require_theme_initializers();
- self::register_preprocessors("SprocketsPreprocessor", "CompassPreprocessor");
- self::register_preprocessor_actions();
+ if (Wordless::theme_is_wordless_compatible()){
+ self::load_i18n();
+ self::require_helpers();
+ self::require_theme_initializers();
+ self::register_preprocessors("SprocketsPreprocessor", "CompassPreprocessor");
+ self::register_preprocessor_actions();
+ }
self::load_admin_page();
}
@@ -140,6 +142,7 @@ public static function theme_is_wordless_compatible() {
);
foreach ($required_directories as $dir) {
if (!file_exists($dir) || !is_dir($dir)) {
+ echo $dir;
return false;
}
}
View
@@ -56,6 +56,11 @@ public static function page_content() {
"theme_path" => array(
"label" => "Theme Directory",
"description" => "Specify the <code>wp-content/themes</code> subdirectory name for this theme."
+ ),
+ "chmod_set" => array(
+ "label" => "Permissions",
+ "description" => "Specify three octal number components specifying access restrictions",
+ "default_value" => "0774"
)
);
if ($_SERVER['REQUEST_METHOD'] == "POST") {
@@ -70,7 +75,7 @@ public static function page_content() {
}
if ($valid) {
- $builder = new WordlessThemeBuilder($_POST["theme_name"], $_POST["theme_path"]);
+ $builder = new WordlessThemeBuilder($_POST["theme_name"], $_POST["theme_path"], intval($_POST["chmod_set"], 8));
$builder->build();
$builder->set_as_current_theme();
require 'admin/admin_success.php';
@@ -7,15 +7,15 @@
<?php foreach ($theme_options as $name => $properties): ?>
<tr valign="top">
<th scope="row">
- <label for="<?= $name ?>"><?= $properties['label'] ?></label>
+ <label for="<?php echo $name ?>"><?php echo $properties['label'] ?></label>
</th>
<td>
- <input name="<?= $name ?>" type="text" id="<?= $name ?>" value="<?= $_POST[$name] ?>" class="regular-text">
+ <input name="<?php echo $name ?>" type="text" id="<?php echo $name ?>" value="<?php echo (!isset($_POST[$name])) ? $properties['default_value'] : $_POST[$name] ?>" class="regular-text">
<br/>
- <span class="description"><?= $properties['description'] ?></span>
+ <span class="description"><?php echo $properties['description'] ?></span>
<?php if (isset($properties['error'])): ?>
<br/>
- <span class="error" style="color:red"><?= $properties['error'] ?></span>
+ <span class="error" style="color:red"><?php echo $properties['error'] ?></span>
<?php endif; ?>
</td>
</tr>
@@ -5,9 +5,10 @@
**/
class WordlessThemeBuilder {
- function __construct($theme_name, $theme_dir) {
+ function __construct($theme_name, $theme_dir, $chmod_set) {
$this->theme_dir = Wordless::join_paths(dirname(get_template_directory()), $theme_dir);
$this->theme_name = $theme_name;
+ $this->chmod_set = $chmod_set;
}
public function build() {
@@ -32,6 +33,7 @@ private function copy($src, $dst) {
$source_content = file_get_contents($src . '/' . $file);
$source_content = str_replace("%THEME_NAME%", $this->theme_name, $source_content);
file_put_contents($dst . '/' . $file, $source_content);
+ chmod($dst . '/' . $file, $this->chmod_set);
}
}
}
@@ -40,7 +42,8 @@ private function copy($src, $dst) {
private function make_directory($path) {
if (!file_exists($path)) {
- mkdir($path, 0774);
+ mkdir($path, $this->chmod_set);
+ chmod($path, $this->chmod_set);
}
}
@@ -0,0 +1 @@
+Helpers are basically small functions that can be called in your views to help keep your code stay DRY. Create as many helper files and functions as you want and put them in this directory, they will all be required within your views, together with the default Wordless helpers.

0 comments on commit e33a03e

Please sign in to comment.