当前位置: 首页>>代码示例>>PHP>>正文


PHP Folder::messages方法代码示例

本文整理汇总了PHP中Folder::messages方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::messages方法的具体用法?PHP Folder::messages怎么用?PHP Folder::messages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Folder的用法示例。


在下文中一共展示了Folder::messages方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initialAppPath

 /**
  * Make sure if the $appPath exists and copy the skel to there
  * @param string $appPath
  */
 public function initialAppPath($appPath)
 {
     App::uses('Folder', 'Utility');
     $fh = new Folder();
     if (file_exists($appPath)) {
         if (false === $fh->delete($appPath)) {
             $this->errorMessage = __('Target path exists. But the program could not delete the folder automatically');
             return false;
         } else {
             $this->tasks[] = array('title' => __('Target path exists. Delete the old folders.'), 'operactions' => $fh->messages());
         }
     }
     /*
      * Copy the skelecton of the application
      */
     $fh->copy(array('to' => $appPath, 'from' => VENDORS . 'olc_baker' . DS . 'skels' . DS . 'default', 'mode' => 0777));
     $errors1 = $fh->errors();
     $fh->copy(array('to' => $appPath . DS . 'cake2' . DS . 'lib', 'from' => CAKE_CORE_INCLUDE_PATH, 'mode' => 0777));
     $errors2 = $fh->errors();
     if (!empty($errors1) || !empty($errors2)) {
         $this->errorMessage = __('The program could not copy files to the folder automatically');
         return false;
     } else {
         $this->tasks[] = array('title' => __('Copy the skelecton of application to the target path'), 'operactions' => $fh->messages());
     }
     return true;
 }
开发者ID:kiang,项目名称:olc_baker,代码行数:31,代码来源:Project.php

示例2: bake

 /**
  * Looks for a skeleton template of a Cake application,
  * and if not found asks the user for a path. When there is a path
  * this method will make a deep copy of the skeleton to the project directory.
  *
  * @param string $path Project path
  * @param string $skel Path to copy from
  * @param string $skip array of directories to skip when copying
  * @return mixed
  */
 public function bake($path, $skel = null, $skip = array('empty'))
 {
     if (!$skel && !empty($this->params['skel'])) {
         $skel = $this->params['skel'];
     }
     while (!$skel) {
         $skel = $this->in(__d('cake_console', "What is the path to the directory layout you wish to copy?"), null, CAKE . 'Console' . DS . 'Templates' . DS . 'skel');
         if (!$skel) {
             $this->err(__d('cake_console', 'The directory path you supplied was empty. Please try again.'));
         } else {
             while (is_dir($skel) === false) {
                 $skel = $this->in(__d('cake_console', 'Directory path does not exist please choose another:'), null, CAKE . 'Console' . DS . 'Templates' . DS . 'skel');
             }
         }
     }
     $app = basename($path);
     $this->out(__d('cake_console', '<info>Skel Directory</info>: ') . $skel);
     $this->out(__d('cake_console', '<info>Will be copied to</info>: ') . $path);
     $this->hr();
     $looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y', 'n', 'q'), 'y');
     switch (strtolower($looksGood)) {
         case 'y':
             $Folder = new Folder($skel);
             if (!empty($this->params['empty'])) {
                 $skip = array();
             }
             if ($Folder->copy(array('to' => $path, 'skip' => $skip))) {
                 $this->hr();
                 $this->out(__d('cake_console', '<success>Created:</success> %s in %s', $app, $path));
                 $this->hr();
             } else {
                 $this->err(__d('cake_console', "<error>Could not create</error> '%s' properly.", $app));
                 return false;
             }
             foreach ($Folder->messages() as $message) {
                 $this->out(String::wrap(' * ' . $message), 1, Shell::VERBOSE);
             }
             return true;
         case 'n':
             unset($this->args[0]);
             $this->execute();
             return false;
         case 'q':
             $this->out(__d('cake_console', '<error>Bake Aborted.</error>'));
             return false;
     }
 }
开发者ID:Vighnesh123,项目名称:book-a-bus,代码行数:57,代码来源:ProjectTask.php

示例3: bake

 /**
  * Bake the plugin, create directories and files
  *
  * @params $plugin name of the plugin in CamelCased format
  * @access public
  * @return bool
  */
 function bake($plugin)
 {
     $pluginPath = Inflector::underscore($plugin);
     $this->hr();
     $this->out("Plugin Name: {$plugin}");
     $this->out("Plugin Directory: {$this->path}{$pluginPath}");
     $this->hr();
     $looksGood = $this->in('Look okay?', array('y', 'n', 'q'), 'y');
     if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
         $verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n');
         $Folder = new Folder($this->path . $pluginPath);
         $directories = array('models' . DS . 'behaviors', 'controllers' . DS . 'components', 'views' . DS . 'helpers');
         foreach ($directories as $directory) {
             $Folder->create($this->path . $pluginPath . DS . $directory);
         }
         if (low($verbose) == 'y' || low($verbose) == 'yes') {
             foreach ($Folder->messages() as $message) {
                 $this->out($message);
             }
         }
         $errors = $Folder->errors();
         if (!empty($errors)) {
             return false;
         }
         $controllerFileName = $pluginPath . '_app_controller.php';
         $out = "<?php\n\n";
         $out .= "class {$plugin}AppController extends AppController {\n\n";
         $out .= "}\n\n";
         $out .= "?>";
         $this->createFile($this->path . $pluginPath . DS . $controllerFileName, $out);
         $modelFileName = $pluginPath . '_app_model.php';
         $out = "<?php\n\n";
         $out .= "class {$plugin}AppModel extends AppModel {\n\n";
         $out .= "}\n\n";
         $out .= "?>";
         $this->createFile($this->path . $pluginPath . DS . $modelFileName, $out);
         $this->hr();
         $this->out(sprintf(__("Created: %s in %s", true), $plugin, $this->path . $pluginPath));
         $this->hr();
     }
     return true;
 }
开发者ID:BGCX067,项目名称:fake-as3-svn-to-git,代码行数:49,代码来源:plugin.php

示例4: bake

 /**
  * Bake the plugin, create directories and files
  *
  * @param string $plugin Name of the plugin in CamelCased format
  * @return bool
  */
 public function bake($plugin)
 {
     $pathOptions = App::path('plugins');
     if (count($pathOptions) > 1) {
         $this->findPath($pathOptions);
     }
     $this->hr();
     $this->out(__d('cake_console', "<info>Plugin Name:</info> %s", $plugin));
     $this->out(__d('cake_console', "<info>Plugin Directory:</info> %s", $this->path . $plugin));
     $this->hr();
     $looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y', 'n', 'q'), 'y');
     if (strtolower($looksGood) === 'y') {
         $Folder = new Folder($this->path . $plugin);
         $directories = array('Config' . DS . 'Schema', 'Model' . DS . 'Behavior', 'Model' . DS . 'Datasource', 'Console' . DS . 'Command' . DS . 'Task', 'Controller' . DS . 'Component', 'Lib', 'View' . DS . 'Helper', 'Test' . DS . 'Case' . DS . 'Controller' . DS . 'Component', 'Test' . DS . 'Case' . DS . 'View' . DS . 'Helper', 'Test' . DS . 'Case' . DS . 'Model' . DS . 'Behavior', 'Test' . DS . 'Fixture', 'Vendor', 'webroot');
         foreach ($directories as $directory) {
             $dirPath = $this->path . $plugin . DS . $directory;
             $Folder->create($dirPath);
             new File($dirPath . DS . 'empty', true);
         }
         foreach ($Folder->messages() as $message) {
             $this->out($message, 1, Shell::VERBOSE);
         }
         $errors = $Folder->errors();
         if (!empty($errors)) {
             foreach ($errors as $message) {
                 $this->error($message);
             }
             return false;
         }
         $controllerFileName = $plugin . 'AppController.php';
         $out = "<?php\n\n";
         $out .= "App::uses('AppController', 'Controller');\n\n";
         $out .= "class {$plugin}AppController extends AppController {\n\n";
         $out .= "}\n";
         $this->createFile($this->path . $plugin . DS . 'Controller' . DS . $controllerFileName, $out);
         $modelFileName = $plugin . 'AppModel.php';
         $out = "<?php\n\n";
         $out .= "App::uses('AppModel', 'Model');\n\n";
         $out .= "class {$plugin}AppModel extends AppModel {\n\n";
         $out .= "}\n";
         $this->createFile($this->path . $plugin . DS . 'Model' . DS . $modelFileName, $out);
         $this->_modifyBootstrap($plugin);
         $this->hr();
         $this->out(__d('cake_console', '<success>Created:</success> %s in %s', $plugin, $this->path . $plugin), 2);
     }
     return true;
 }
开发者ID:lakshmanpalitha,项目名称:cakeproject,代码行数:53,代码来源:PluginTask.php

示例5: testDelete

 /**
  * testDelete method
  *
  * @return void
  */
 public function testDelete()
 {
     $path = TMP . 'folder_delete_test';
     mkdir($path);
     touch($path . DS . 'file_1');
     mkdir($path . DS . 'level_1_1');
     touch($path . DS . 'level_1_1' . DS . 'file_1_1');
     mkdir($path . DS . 'level_1_1' . DS . 'level_2_1');
     touch($path . DS . 'level_1_1' . DS . 'level_2_1' . DS . 'file_2_1');
     touch($path . DS . 'level_1_1' . DS . 'level_2_1' . DS . 'file_2_2');
     mkdir($path . DS . 'level_1_1' . DS . 'level_2_2');
     $Folder = new Folder($path, true);
     $return = $Folder->delete();
     $this->assertTrue($return);
     $messages = $Folder->messages();
     $errors = $Folder->errors();
     $this->assertEquals(array(), $errors);
     $expected = array($path . DS . 'file_1 removed', $path . DS . 'level_1_1' . DS . 'file_1_1 removed', $path . DS . 'level_1_1' . DS . 'level_2_1' . DS . 'file_2_1 removed', $path . DS . 'level_1_1' . DS . 'level_2_1' . DS . 'file_2_2 removed', $path . DS . 'level_1_1' . DS . 'level_2_1 removed', $path . DS . 'level_1_1' . DS . 'level_2_2 removed', $path . DS . 'level_1_1 removed', $path . ' removed');
     sort($expected);
     sort($messages);
     $this->assertEquals($expected, $messages);
 }
开发者ID:yuuicchan0912,项目名称:sample2,代码行数:27,代码来源:FolderTest.php

示例6: bake

 /**
  * Looks for a skeleton template of a Cake application,
  * and if not found asks the user for a path. When there is a path
  * this method will make a deep copy of the skeleton to the project directory.
  * A default home page will be added, and the tmp file storage will be chmod'ed to 0777.
  *
  * @param string $path Project path
  * @param string $skel Path to copy from
  * @param string $skip array of directories to skip when copying
  * @access private
  */
 function bake($path, $skel = null, $skip = array('empty'))
 {
     if (!$skel) {
         $skel = $this->params['skel'];
     }
     while (!$skel) {
         $skel = $this->in(sprintf(__("What is the path to the directory layout you wish to copy?\nExample: %s"), APP, null, ROOT . DS . 'myapp' . DS));
         if ($skel == '') {
             $this->out(__('The directory path you supplied was empty. Please try again.', true));
         } else {
             while (is_dir($skel) === false) {
                 $skel = $this->in(__('Directory path does not exist please choose another:', true));
             }
         }
     }
     $app = basename($path);
     $this->out(__('Bake Project', true));
     $this->out(__("Skel Directory: ", true) . $skel);
     $this->out(__("Will be copied to: ", true) . $path);
     $this->hr();
     $looksGood = $this->in(__('Look okay?', true), array('y', 'n', 'q'), 'y');
     if (strtolower($looksGood) == 'y') {
         $verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n');
         $Folder = new Folder($skel);
         if (!empty($this->params['empty'])) {
             $skip = array();
         }
         if ($Folder->copy(array('to' => $path, 'skip' => $skip))) {
             $this->hr();
             $this->out(sprintf(__("Created: %s in %s", true), $app, $path));
             $this->hr();
         } else {
             $this->err(sprintf(__(" '%s' could not be created properly", true), $app));
             return false;
         }
         if (strtolower($verbose) == 'y') {
             foreach ($Folder->messages() as $message) {
                 $this->out($message);
             }
         }
         return true;
     } elseif (strtolower($looksGood) == 'q') {
         $this->out(__('Bake Aborted.', true));
     } else {
         $this->execute(false);
         return false;
     }
 }
开发者ID:evrard,项目名称:cakephp2x,代码行数:59,代码来源:project.php

示例7: testDelete

 /**
  * testDelete method
  *
  * @return void
  */
 public function testDelete()
 {
     $path = TMP . 'folder_delete_test';
     $Folder = new Folder($path, true);
     touch(TMP . 'folder_delete_test' . DS . 'file1');
     touch(TMP . 'folder_delete_test' . DS . 'file2');
     $return = $Folder->delete();
     $this->assertTrue($return);
     $messages = $Folder->messages();
     $errors = $Folder->errors();
     $this->assertEquals($errors, array());
     $expected = array($path . ' created', $path . DS . 'file1 removed', $path . DS . 'file2 removed', $path . ' removed');
     $this->assertEquals($expected, $messages);
 }
开发者ID:ronaldsalazar23,项目名称:ComercialChiriguano,代码行数:19,代码来源:FolderTest.php

示例8: _bake

 /**
  * Looks for a skeleton template of a Cake application,
  * and if not found asks the user for a path. When there is a path
  * this method will make a deep copy of the skeleton to the project directory.
  *
  * @param string $path Project path
  * @param string $skel Path to copy from
  * @param string $skip array of directories to skip when copying
  * @return boolean
  */
 protected function _bake($path, $skel, $skip = array())
 {
     $Folder = new Folder($skel);
     $app = basename($path);
     if (!$Folder->copy(array('to' => $path, 'skip' => $skip))) {
         $this->err(__d('cake_console', "<error>Could not create</error> '%s' properly.", $app));
         return false;
     }
     foreach ($Folder->messages() as $message) {
         $this->out(String::wrap(' * ' . $message), 1, Shell::VERBOSE);
     }
     return true;
 }
开发者ID:rikkeisoft,项目名称:cakephp2,代码行数:23,代码来源:ProjectShell.php

示例9: bake

 /**
  * Looks for a skeleton template of a Cake application,
  * and if not found asks the user for a path. When there is a path
  * this method will make a deep copy of the skeleton to the project directory.
  * A default home page will be added, and the tmp file storage will be chmod'ed to 0777.
  *
  * @param string $path Project path
  * @param string $skel Path to copy from
  * @param string $skip array of directories to skip when copying
  * @access private
  */
 function bake($path, $skel = null, $skip = array('empty'))
 {
     if (!$skel) {
         $skel = $this->params['skel'];
     }
     while (!$skel) {
         $skel = $this->in(__("What is the path to the directory layout you wish to copy?\nExample: %s", APP, null, ROOT . DS . 'myapp' . DS));
         if ($skel == '') {
             $this->err(__('The directory path you supplied was empty. Please try again.'));
         } else {
             while (is_dir($skel) === false) {
                 $skel = $this->in(__('Directory path does not exist please choose another:'));
             }
         }
     }
     $app = basename($path);
     $this->out(__('<info>Skel Directory</info>: ') . $skel);
     $this->out(__('<info>Will be copied to</info>: ') . $path);
     $this->hr();
     $looksGood = $this->in(__('Look okay?'), array('y', 'n', 'q'), 'y');
     if (strtolower($looksGood) == 'y') {
         $Folder = new Folder($skel);
         if (!empty($this->params['empty'])) {
             $skip = array();
         }
         if ($Folder->copy(array('to' => $path, 'skip' => $skip))) {
             $this->hr();
             $this->out(__('<success>Created:</success> %s in %s', $app, $path));
             $this->hr();
         } else {
             $this->err(__("<error>Could not create</error> '%s' properly.", $app));
             return false;
         }
         foreach ($Folder->messages() as $message) {
             $this->out(String::wrap(' * ' . $message), 1, Shell::VERBOSE);
         }
         return true;
     } elseif (strtolower($looksGood) == 'q') {
         $this->out(__('Bake Aborted.'));
     } else {
         $this->execute(false);
         return false;
     }
 }
开发者ID:no2key,项目名称:Web-Framework-Benchmark,代码行数:55,代码来源:project.php

示例10: while

 /**
  * Looks for a skeleton template of a Cake application,
  * and if not found asks the user for a path. When there is a path
  * this method will make a deep copy of the skeleton to the project directory.
  * A default home page will be added, and the tmp file storage will be chmod'ed to 0777.
  *
  * @param string $path Project path
  * @access private
  */
 function __buildDirLayout($path)
 {
     $skel = $this->params['skel'];
     while ($skel == '') {
         $skel = $this->in("What is the path to the app directory you wish to copy?\nExample: " . APP, null, ROOT . DS . 'myapp' . DS);
         if ($skel == '') {
             $this->out('The directory path you supplied was empty. Please try again.');
         } else {
             while (is_dir($skel) === false) {
                 $skel = $this->in('Directory path does not exist please choose another:');
             }
         }
     }
     $app = basename($path);
     $this->out('Bake Project');
     $this->out("Skel Directory: {$skel}");
     $this->out("Will be copied to: {$path}");
     $this->hr();
     $looksGood = $this->in('Look okay?', array('y', 'n', 'q'), 'y');
     if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
         $verboseOuptut = $this->in('Do you want verbose output?', array('y', 'n'), 'n');
         $verbose = false;
         if (low($verboseOuptut) == 'y' || low($verboseOuptut) == 'yes') {
             $verbose = true;
         }
         $Folder = new Folder($skel);
         if ($Folder->copy($path)) {
             $path = $Folder->slashTerm($path);
             $this->hr();
             $this->out(sprintf(__("Created: %s in %s", true), $app, $path));
             $this->hr();
             if ($this->createHome($path)) {
                 $this->out('Welcome page created');
             } else {
                 $this->out('The Welcome page was NOT created');
             }
             if ($this->securitySalt($path) === true) {
                 $this->out('Random hash key created for \'Security.salt\'');
             } else {
                 $this->err('Unable to generate random hash for \'Security.salt\', please change this yourself in ' . CONFIGS . 'core.php');
             }
             $corePath = $this->corePath($path);
             if ($corePath === true) {
                 $this->out('CAKE_CORE_INCLUDE_PATH set to ' . CAKE_CORE_INCLUDE_PATH);
             } elseif ($corePath === false) {
                 $this->err('Unable to to set CAKE_CORE_INCLUDE_PATH, please change this yourself in ' . $path . 'webroot' . DS . 'index.php');
             }
             if (!$Folder->chmod($path . 'tmp', 0777)) {
                 $this->err('Could not set permissions on ' . $path . DS . 'tmp');
                 $this->out('You must manually check that these directories can be wrote to by the server');
             }
         } else {
             $this->err(" '" . $app . "' could not be created properly");
         }
         if ($verbose) {
             foreach ($Folder->messages() as $message) {
                 $this->out($message);
             }
         }
         return;
     } elseif (low($looksGood) == 'q' || low($looksGood) == 'quit') {
         $this->out('Bake Aborted.');
     } else {
         $this->params['working'] = null;
         $this->params['app'] = null;
         $this->execute(false);
     }
 }
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:77,代码来源:project.php

示例11: remove

 /**
  * remove method
  *
  * @param mixed $id null
  * @param array $params array()
  * @return void
  * @access public
  */
 public function remove($id = null, $params = array())
 {
     if (!$id) {
         return false;
     }
     if (is_array($id)) {
         $details = $id;
         $id = $id['Package'];
     } else {
         $details = MiInstall::details($id);
     }
     if (!$details) {
         return false;
     }
     $method = Inflector::pluralize($details['Type']);
     $all = array_flip(MiInstall::$method());
     if (!isset($all[$id])) {
         return false;
     }
     $Folder = new Folder($all[$id]);
     $Folder->delete();
     return $Folder->messages();
 }
开发者ID:hiromi2424,项目名称:mi,代码行数:31,代码来源:mi_install.php

示例12: index

 /**
  * Bake the plugin, create directories and files
  *
  * @params $plugin name of the plugin in CamelCased format
  * @access public
  * @return bool
  */
 function bake($plugin)
 {
     $pluginPath = $plugin;
     if (substr($pluginPath, 0, 2) !== 'Cc') {
         $this->err('Plugin name must start with "Cc"');
         return;
     }
     $this->hr();
     $this->out("Plugin Name: {$plugin}");
     $this->out("Plugin Directory: {$this->path}{$pluginPath}");
     $this->hr();
     $looksGood = $this->in('Look okay?', array('y', 'n', 'q'), 'y');
     if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes') {
         $verbose = $this->in(__('Do you want verbose output?'), array('y', 'n'), 'n');
         App::uses('Folder', 'Utility');
         $Folder = new Folder($this->path . $pluginPath);
         $directories = array('Model' . DS . 'Behavior', 'Controller' . DS . 'Component', 'View' . DS . 'Helper');
         foreach ($directories as $directory) {
             $Folder->create($this->path . $pluginPath . DS . $directory);
         }
         if (strtolower($verbose) == 'y' || strtolower($verbose) == 'yes') {
             foreach ($Folder->messages() as $message) {
                 $this->out($message);
             }
         }
         $errors = $Folder->errors();
         if (!empty($errors)) {
             return false;
         }
         $controllerFileName = $pluginPath . 'AppController.php';
         $out = "<?php\n\n";
         $out .= "class {$plugin}AppController extends AppController {\n\n";
         $out .= "}\n\n";
         $out .= "?>";
         $this->createFile($this->path . $pluginPath . DS . 'Controller' . DS . $controllerFileName, $out);
         $modelFileName = $pluginPath . 'AppModel.php';
         $out = "<?php\n\n";
         $out .= "class {$plugin}AppModel extends AppModel {\n\n";
         $out .= "}\n\n";
         $out .= "?>";
         $this->createFile($this->path . $pluginPath . DS . 'Model' . DS . $modelFileName, $out);
         $out = "<?php\n";
         $out .= "\$pluginContainer = ClassRegistry::getObject('PluginContainer');\n";
         $plugin_id = Inflector::underscore($pluginPath);
         $out .= "\$pluginContainer->installed('{$plugin_id}','0.1');\n";
         $out .= "\n\n";
         $this->createFile($this->path . $pluginPath . DS . 'init.php', $out);
         $out = "<?php\n";
         $out .= "\tclass HomeController extends {$plugin}AppController {\n";
         $out .= "\tpublic \$uses = array('Issue');\n";
         $out .= "\tpublic function index() {\n";
         $out .= "\t\t\$this->set('count',\$this->Issue->find('count'));\n";
         $out .= "\t}\n";
         $out .= "}\n";
         $out .= "\n";
         $this->createFile($this->path . $pluginPath . DS . 'Controller/HomeController.php', $out);
         $out = "";
         $out .= "Hello CandyCane {$plugin} Plugin.<br/>";
         $out .= "You have <?php echo \$count ?> of issues.";
         $out .= "\n\n";
         $this->createFile($this->path . $pluginPath . DS . 'View' . DS . 'Home' . DS . 'index.ctp', $out);
         $this->hr();
         $this->out(sprintf(__("Created: %s in %s"), $plugin, $this->path . $pluginPath));
         $this->hr();
     }
     return true;
 }
开发者ID:gildonei,项目名称:candycane,代码行数:74,代码来源:CcPluginShell.php

示例13: bake

 /**
  * Bake the plugin, create directories and files
  *
  * @params $plugin name of the plugin in CamelCased format
  * @access public
  * @return bool
  */
 public function bake($plugin)
 {
     $pluginPath = Inflector::underscore($plugin);
     $pathOptions = App::path('plugins');
     if (count($pathOptions) > 1) {
         $this->findPath($pathOptions);
     }
     $this->hr();
     $this->out(__("<info>Plugin Name:</info> %s", $plugin));
     $this->out(__("<info>Plugin Directory:</info> %s", $this->path . $pluginPath));
     $this->hr();
     $looksGood = $this->in(__('Look okay?'), array('y', 'n', 'q'), 'y');
     if (strtolower($looksGood) == 'y') {
         $Folder = new Folder($this->path . $pluginPath);
         $directories = array('config' . DS . 'schema', 'models' . DS . 'behaviors', 'models' . DS . 'datasources', 'console' . DS . 'shells' . DS . 'tasks', 'controllers' . DS . 'components', 'libs', 'views' . DS . 'helpers', 'tests' . DS . 'cases' . DS . 'components', 'tests' . DS . 'cases' . DS . 'helpers', 'tests' . DS . 'cases' . DS . 'behaviors', 'tests' . DS . 'cases' . DS . 'controllers', 'tests' . DS . 'cases' . DS . 'models', 'tests' . DS . 'groups', 'tests' . DS . 'fixtures', 'vendors', 'webroot');
         foreach ($directories as $directory) {
             $dirPath = $this->path . $pluginPath . DS . $directory;
             $Folder->create($dirPath);
             $File = new File($dirPath . DS . 'empty', true);
         }
         foreach ($Folder->messages() as $message) {
             $this->out($message, 1, Shell::VERBOSE);
         }
         $errors = $Folder->errors();
         if (!empty($errors)) {
             return false;
         }
         $controllerFileName = $pluginPath . '_app_controller.php';
         $out = "<?php\n\n";
         $out .= "class {$plugin}AppController extends AppController {\n\n";
         $out .= "}\n\n";
         $out .= "?>";
         $this->createFile($this->path . $pluginPath . DS . $controllerFileName, $out);
         $modelFileName = $pluginPath . '_app_model.php';
         $out = "<?php\n\n";
         $out .= "class {$plugin}AppModel extends AppModel {\n\n";
         $out .= "}\n\n";
         $out .= "?>";
         $this->createFile($this->path . $pluginPath . DS . $modelFileName, $out);
         $this->hr();
         $this->out(__('<success>Created:</success> %s in %s', $plugin, $this->path . $pluginPath), 2);
     }
     return true;
 }
开发者ID:robotarmy,项目名称:Phog,代码行数:51,代码来源:plugin.php


注:本文中的Folder::messages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。