Skip to content

Commit

Permalink
Merge pull request #4241 from antograssiot/3.0_missing_template
Browse files Browse the repository at this point in the history
3.0 template correction
  • Loading branch information
markstory committed Aug 13, 2014
2 parents 69266d4 + 7e3ff13 commit 55a9bbc
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 8 deletions.
19 changes: 18 additions & 1 deletion src/Template/Error/missing_behavior.ctp
Expand Up @@ -13,17 +13,34 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Core\Plugin;
use Cake\Core\Configure;

$pluginPath = Configure::read('App.paths.plugins.0');

$pluginDot = empty($plugin) ? null : $plugin . '.';
if (empty($plugin)) {
$filePath = APP_DIR . DS;
}
if (!empty($plugin) && Plugin::loaded($plugin)) {
$filePath = Plugin::classPath($plugin);
}
if (!empty($plugin) && !Plugin::loaded($plugin)) {
$filePath = $pluginPath . h($plugin) . DS . 'src' . DS;
}
?>
<h2>Missing Behavior</h2>
<p class="error">
<strong>Error: </strong>
<?= sprintf('<em>%s</em> could not be found.', h($pluginDot . $class)); ?>
<?php
if (!empty($plugin) && !Plugin::loaded($plugin)):
echo sprintf('Make sure your plugin <em>%s</em> is in the %s directory and was loaded.', h($plugin), $pluginPath);
endif;
?>
</p>
<p class="error">
<strong>Error: </strong>
<?= sprintf('Create the class <em>%s</em> below in file: %s', h($class), (empty($plugin) ? APP_DIR . DS : Plugin::classPath($plugin)) . 'Model' . DS . 'Behavior' . DS . h($class) . '.php'); ?>
<?= sprintf('Create the class <em>%s</em> below in file: %s', h($class), $filePath . 'Model' . DS . 'Behavior' . DS . h($class) . '.php'); ?>
</p>
<pre>
&lt;?php
Expand Down
19 changes: 18 additions & 1 deletion src/Template/Error/missing_component.ctp
Expand Up @@ -13,17 +13,34 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Core\Plugin;
use Cake\Core\Configure;

$pluginPath = Configure::read('App.paths.plugins.0');

$pluginDot = empty($plugin) ? null : $plugin . '.';
if (empty($plugin)) {
$filePath = APP_DIR . DS;
}
if (!empty($plugin) && Plugin::loaded($plugin)) {
$filePath = Plugin::classPath($plugin);
}
if (!empty($plugin) && !Plugin::loaded($plugin)) {
$filePath = $pluginPath . h($plugin) . DS . 'src' . DS;
}
?>
<h2>Missing Component</h2>
<p class="error">
<strong>Error: </strong>
<?= sprintf('<em>%s</em> could not be found.', h($pluginDot . $class)); ?>
<?php
if (!empty($plugin) && !Plugin::loaded($plugin)):
echo sprintf('Make sure your plugin <em>%s</em> is in the %s directory and was loaded.', h($plugin), $pluginPath);
endif;
?>
</p>
<p class="error">
<strong>Error: </strong>
<?= sprintf('Create the class <em>%s</em> below in file: %s', h($class), (empty($plugin) ? APP_DIR : Plugin::classPath($plugin)) . DS . 'Controller' . DS . 'Component' . DS . h($class) . '.php'); ?>
<?= sprintf('Create the class <em>%s</em> below in file: %s', h($class), $filePath . 'Controller' . DS . 'Component' . DS . h($class) . '.php'); ?>
</p>
<pre>
&lt;?php
Expand Down
2 changes: 1 addition & 1 deletion src/Template/Error/missing_datasource_config.ctp
Expand Up @@ -17,7 +17,7 @@
<h2>Missing Datasource Configuration</h2>
<p class="error">
<strong>Error: </strong>
<?= sprintf('The datasource configuration <em>%s</em> was not found in datasources.php.', h($config)); ?>
<?= sprintf('The datasource configuration <em>%s</em> was not found in %s.', h($name), 'config' . DS . 'app.php'); ?>
</p>
<p class="notice">
<strong>Notice: </strong>
Expand Down
7 changes: 5 additions & 2 deletions src/Template/Error/missing_helper.ctp
Expand Up @@ -13,6 +13,9 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Core\Plugin;
use Cake\Core\Configure;

$pluginPath = Configure::read('App.paths.plugins.0');

$pluginDot = empty($plugin) ? null : $plugin . '.';
if (empty($plugin)) {
Expand All @@ -22,7 +25,7 @@ if (!empty($plugin) && Plugin::loaded($plugin)) {
$filePath = Plugin::classPath($plugin);
}
if (!empty($plugin) && !Plugin::loaded($plugin)) {
$filePath = APP_DIR . DS . 'Plugin' . DS . h($plugin) . DS;
$filePath = $pluginPath . h($plugin) . DS . 'src' . DS;
}
?>
<h2>Missing Helper</h2>
Expand All @@ -31,7 +34,7 @@ if (!empty($plugin) && !Plugin::loaded($plugin)) {
<?= sprintf('<em>%s</em> could not be found.', h($pluginDot . $class)); ?>
<?php
if (!empty($plugin) && !Plugin::loaded($plugin)):
echo sprintf('Make sure your plugin %s is in the %s directory and was loaded.', h($plugin), APP_DIR . DS . 'Plugin');
echo sprintf('Make sure your plugin <em>%s</em> is in the %s directory and was loaded.', h($plugin), $pluginPath);
endif;
?>
</p>
Expand Down
7 changes: 5 additions & 2 deletions src/Template/Error/missing_plugin.ctp
Expand Up @@ -13,6 +13,9 @@
* @since 2.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Core\Configure;

$pluginPath = Configure::read('App.paths.plugins.0');
?>
<h2>Missing Plugin</h2>
<p class="error">
Expand All @@ -21,7 +24,7 @@
</p>
<p class="error">
<strong>Error: </strong>
<?= sprintf('Make sure your plugin %s is in the %s directory and was loaded', APP_DIR . DS . 'Plugin', h($plugin)); ?>
<?= sprintf('Make sure your plugin <em>%s</em> is in the %s directory and was loaded', h($plugin), $pluginPath) ?>
</p>
<pre>
&lt;?php
Expand All @@ -30,7 +33,7 @@ Plugin::load('<?= h($plugin)?>');
</pre>
<p class="notice">
<strong>Loading all plugins: </strong>
<?= sprintf('If you wish to load all plugins at once, use the following line in your %s file', APP_DIR . DS . 'Config' . DS . 'bootstrap.php'); ?>
<?= sprintf('If you wish to load all plugins at once, use the following line in your %s file', 'config' . DS . 'bootstrap.php'); ?>
</p>
<pre>
Plugin::loadAll();
Expand Down
2 changes: 1 addition & 1 deletion src/Template/Error/missing_route.ctp
Expand Up @@ -24,7 +24,7 @@ use Cake\Utility\Debugger;
</p>

<p class="notice">None of the currently connected routes match the given URL or parameters.
Add a matching route to <?= APP_DIR . DS . 'Config' . DS . 'routes.php' ?></p>
Add a matching route to <?= 'config' . DS . 'routes.php' ?></p>

<h3>Connected Routes</h3>
<table cellspacing="0" cellpadding="0">
Expand Down

0 comments on commit 55a9bbc

Please sign in to comment.