示例#1
0
 public static function start()
 {
     global $argv, $theme_name;
     parent::initialize();
     require_once Wordless::join_paths(self::$plugin_dir, "wordless", "theme_builder.php");
     $theme_name = $argv[1] ? $argv[1] : 'wordless';
     $permissions = substr(sprintf('%o', fileperms(self::$plugin_dir)), -4);
     $builder = new WordlessThemeBuilder($theme_name, $theme_name, intval($permissions, 8));
     $builder->build();
 }
示例#2
0
 public static function page_content()
 {
     $theme_options = array("theme_name" => array("label" => __("Theme Name", "wl"), "description" => __("This will be the name displayed inside WordPress.", "wl"), "default_value" => "Wordless"), "theme_path" => array("label" => __("Theme Directory", "wl"), "description" => __("Specify the <code>wp-content/themes</code> subdirectory name for this theme.", "wl"), "default_value" => "wordless"), "chmod_set" => array("label" => __("Permissions", "wl"), "description" => __("Specify three octal number components specifying access restrictions", "wl"), "default_value" => "0664"));
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         // Form validation
         $valid = true;
         foreach ($theme_options as $name => $properties) {
             $value = $_POST[$name];
             if (empty($value)) {
                 $theme_options[$name]['error'] = __("This field is required!", "wl");
                 $valid = false;
             }
         }
         if ($valid) {
             $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';
             die;
         }
     }
     // Just render the page
     require 'admin/admin_form.php';
 }