Skip to content

Commit

Permalink
Finishing refactor on View task to use _methodsToBake
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 28, 2009
1 parent 9d0d314 commit 80f9e6f
Showing 1 changed file with 3 additions and 24 deletions.
27 changes: 3 additions & 24 deletions cake/console/libs/tasks/view.php
Expand Up @@ -135,30 +135,9 @@ function execute() {
} else {
$vars = $this->__loadController();
$methods = $this->_methodsToBake();
$methods = array_diff(
array_map('strtolower', get_class_methods($this->controllerName . 'Controller')),
array_map('strtolower', get_class_methods('appcontroller'))
);
if (empty($methods)) {
$methods = $this->scaffoldActions;
}
$adminRoute = Configure::read('Routing.admin');
if ($adminRoute && isset($this->params['admin'])) {
foreach ($methods as $i => $method) {
if (strpos($method, $adminRoute . '_') === false) {
unset($methods[$i]);
}
}
}
$adminDelete = null;
if (!empty($adminRoute)) {
$adminDelete = $adminRoute . '_delete';
}
foreach ($methods as $method) {
if ($method{0} != '_' && !in_array($method, array('delete', $adminDelete))) {
$content = $this->getContent($method, $vars);
$this->bake($method, $content);
}
$content = $this->getContent($method, $vars);
$this->bake($method, $content);
}
}
}
Expand All @@ -179,7 +158,7 @@ function _methodsToBake() {
}
$adminRoute = Configure::read('Routing.admin');
foreach ($methods as $i => $method) {
if ($method == 'delete' || $method = $adminRoute . '_delete' || $method{0} == '_') {
if ($method == 'delete' || $method == $adminRoute . '_delete' || $method{0} == '_') {
unset($methods[$i]);
}
if ($adminRoute && isset($this->params['admin']) && strpos($method, $adminRoute . '_') === false) {
Expand Down

0 comments on commit 80f9e6f

Please sign in to comment.