@@ -68,8 +68,8 @@ |
||
| 68 | 68 | $this->addMeta("description", "Advanced use cases and examples"); |
| 69 | 69 | |
| 70 | 70 | // Add additional js and css files |
| 71 | - $this->addCss('my-css','/css/my-css-file.css'); |
|
| 72 | - $this->addJs('my-js','/js/my-js-file.js'); |
|
| 71 | + $this->addCss('my-css', '/css/my-css-file.css'); |
|
| 72 | + $this->addJs('my-js', '/js/my-js-file.js'); |
|
| 73 | 73 | |
| 74 | 74 | // Add additional fields to the theme |
| 75 | 75 | $this->getResponse()->getTheme()->custom_var = "Booyah"; |
@@ -17,34 +17,34 @@ |
||
| 17 | 17 | class AjaxExample extends \erdiko\core\AjaxController |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 20 | + /** |
|
| 21 | 21 | * Get |
| 22 | 22 | */ |
| 23 | - public function get($var = null) |
|
| 24 | - { |
|
| 25 | - if($var != null) |
|
| 26 | - { |
|
| 27 | - // load action |
|
| 28 | - return $this->_autoaction($var); |
|
| 29 | - } |
|
| 23 | + public function get($var = null) |
|
| 24 | + { |
|
| 25 | + if($var != null) |
|
| 26 | + { |
|
| 27 | + // load action |
|
| 28 | + return $this->_autoaction($var); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - $data = array("hello", "world"); |
|
| 32 | - $view = new \erdiko\core\View('examples/helloworld', $data); |
|
| 31 | + $data = array("hello", "world"); |
|
| 32 | + $view = new \erdiko\core\View('examples/helloworld', $data); |
|
| 33 | 33 | |
| 34 | - $this->setContent($view); |
|
| 35 | - } |
|
| 34 | + $this->setContent($view); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Get Example |
|
| 39 | - */ |
|
| 40 | - public function getExample() |
|
| 41 | - { |
|
| 42 | - $content = array( |
|
| 43 | - 'hello' => 'world', |
|
| 44 | - 'ajax' => 'rocks' |
|
| 45 | - ); |
|
| 37 | + /** |
|
| 38 | + * Get Example |
|
| 39 | + */ |
|
| 40 | + public function getExample() |
|
| 41 | + { |
|
| 42 | + $content = array( |
|
| 43 | + 'hello' => 'world', |
|
| 44 | + 'ajax' => 'rocks' |
|
| 45 | + ); |
|
| 46 | 46 | |
| 47 | - $this->setContent($content); |
|
| 48 | - } |
|
| 47 | + $this->setContent($content); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function get($var = null) |
| 24 | 24 | { |
| 25 | - if($var != null) |
|
| 25 | + if ($var != null) |
|
| 26 | 26 | { |
| 27 | 27 | // load action |
| 28 | 28 | return $this->_autoaction($var); |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | // You can add other views (containers) or text |
| 84 | 84 | $columns = array( |
| 85 | 85 | 'one' => new \erdiko\core\View('examples/one'), |
| 86 | - 'two' => $this->getView('examples/two') . $this->getView('examples/three') |
|
| 86 | + 'two' => $this->getView('examples/two').$this->getView('examples/three') |
|
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | 89 | $this->setContent($this->getLayout('mustache/2column-mustache', $columns)); |
@@ -24,65 +24,65 @@ |
||
| 24 | 24 | * Hooks |
| 25 | 25 | */ |
| 26 | 26 | \erdiko\core\ToroHook::add("404", function ($vars = array()) { |
| 27 | - // Toro::serve Legacy |
|
| 28 | - $vars['debug'] = \erdiko\core\ErrorHandler::isDebug(); |
|
| 29 | - if (empty($vars['message'])) { |
|
| 30 | - $vars['message'] = "Sorry, we cannot find that page."; |
|
| 31 | - } |
|
| 32 | - if (empty($vars['error'])) { |
|
| 33 | - $vars['error'] = $vars['message']; |
|
| 34 | - } |
|
| 35 | - if (!isset($vars['path_info'])) { |
|
| 36 | - $vars['path_info'] = ""; |
|
| 37 | - } |
|
| 27 | + // Toro::serve Legacy |
|
| 28 | + $vars['debug'] = \erdiko\core\ErrorHandler::isDebug(); |
|
| 29 | + if (empty($vars['message'])) { |
|
| 30 | + $vars['message'] = "Sorry, we cannot find that page."; |
|
| 31 | + } |
|
| 32 | + if (empty($vars['error'])) { |
|
| 33 | + $vars['error'] = $vars['message']; |
|
| 34 | + } |
|
| 35 | + if (!isset($vars['path_info'])) { |
|
| 36 | + $vars['path_info'] = ""; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - Erdiko::log(\Psr\Log\LogLevel::ERROR, "404 {$vars['path_info']} {$vars['error']}"); |
|
| 40 | - $vars['code'] = 404; |
|
| 39 | + Erdiko::log(\Psr\Log\LogLevel::ERROR, "404 {$vars['path_info']} {$vars['error']}"); |
|
| 40 | + $vars['code'] = 404; |
|
| 41 | 41 | |
| 42 | - $theme = new \erdiko\core\Theme( 'bootstrap' ); |
|
| 43 | - $theme->addCss( 'font-awesome', |
|
| 44 | - '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' ); |
|
| 45 | - $theme->addCss( 'font-awesome-animation', |
|
| 46 | - '/themes/bootstrap/css/font-awesome-animation.css' ); |
|
| 42 | + $theme = new \erdiko\core\Theme( 'bootstrap' ); |
|
| 43 | + $theme->addCss( 'font-awesome', |
|
| 44 | + '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' ); |
|
| 45 | + $theme->addCss( 'font-awesome-animation', |
|
| 46 | + '/themes/bootstrap/css/font-awesome-animation.css' ); |
|
| 47 | 47 | |
| 48 | - $response = new \erdiko\core\Response( $theme ); |
|
| 49 | - $response->setContent( \Erdiko::getView('error', $vars) ); |
|
| 50 | - $response->send(); |
|
| 48 | + $response = new \erdiko\core\Response( $theme ); |
|
| 49 | + $response->setContent( \Erdiko::getView('error', $vars) ); |
|
| 50 | + $response->send(); |
|
| 51 | 51 | }); |
| 52 | 52 | |
| 53 | 53 | \erdiko\core\ToroHook::add("500", function ($vars = array()) { |
| 54 | - // Toro::serve Legacy |
|
| 55 | - $vars['debug'] = \erdiko\core\ErrorHandler::isDebug(); |
|
| 56 | - $vars['code'] = 500; |
|
| 57 | - $vars['message'] = "Sorry, something went wrong."; |
|
| 58 | - Erdiko::log(\Psr\Log\LogLevel::ERROR, "{$vars['code']}: {$vars['path_info']} {$vars['error']}"); |
|
| 54 | + // Toro::serve Legacy |
|
| 55 | + $vars['debug'] = \erdiko\core\ErrorHandler::isDebug(); |
|
| 56 | + $vars['code'] = 500; |
|
| 57 | + $vars['message'] = "Sorry, something went wrong."; |
|
| 58 | + Erdiko::log(\Psr\Log\LogLevel::ERROR, "{$vars['code']}: {$vars['path_info']} {$vars['error']}"); |
|
| 59 | 59 | |
| 60 | - $theme = new \erdiko\core\Theme( 'bootstrap' ); |
|
| 61 | - $theme->addCss( 'font-awesome', |
|
| 62 | - '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' ); |
|
| 63 | - $theme->addCss( 'font-awesome-animation', |
|
| 64 | - '/themes/bootstrap/css/font-awesome-animation.css' ); |
|
| 60 | + $theme = new \erdiko\core\Theme( 'bootstrap' ); |
|
| 61 | + $theme->addCss( 'font-awesome', |
|
| 62 | + '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' ); |
|
| 63 | + $theme->addCss( 'font-awesome-animation', |
|
| 64 | + '/themes/bootstrap/css/font-awesome-animation.css' ); |
|
| 65 | 65 | |
| 66 | - $response = new \erdiko\core\Response( $theme ); |
|
| 67 | - $response->setContent( \Erdiko::getView('error', $vars) ); |
|
| 68 | - $response->send(); |
|
| 66 | + $response = new \erdiko\core\Response( $theme ); |
|
| 67 | + $response->setContent( \Erdiko::getView('error', $vars) ); |
|
| 68 | + $response->send(); |
|
| 69 | 69 | }); |
| 70 | 70 | |
| 71 | 71 | // Error management & beautify output. |
| 72 | 72 | \erdiko\core\ToroHook::add("general_error", function ($vars = array()) { |
| 73 | - $vars['debug'] = \erdiko\core\ErrorHandler::isDebug(); |
|
| 74 | - if(!isset($vars['path_info'])){ |
|
| 75 | - $vars['path_info'] = $_SERVER['REQUEST_URI']; |
|
| 76 | - } |
|
| 77 | - Erdiko::log(\Psr\Log\LogLevel::ERROR, "{$vars['code']}: {$vars['path_info']} {$vars['error']}"); |
|
| 73 | + $vars['debug'] = \erdiko\core\ErrorHandler::isDebug(); |
|
| 74 | + if(!isset($vars['path_info'])){ |
|
| 75 | + $vars['path_info'] = $_SERVER['REQUEST_URI']; |
|
| 76 | + } |
|
| 77 | + Erdiko::log(\Psr\Log\LogLevel::ERROR, "{$vars['code']}: {$vars['path_info']} {$vars['error']}"); |
|
| 78 | 78 | |
| 79 | - $theme = new \erdiko\core\Theme('bootstrap'); |
|
| 80 | - $theme->addCss('font-awesome', |
|
| 81 | - '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css'); |
|
| 82 | - $theme->addCss('font-awesome-animation', |
|
| 83 | - '/themes/bootstrap/css/font-awesome-animation.css'); |
|
| 79 | + $theme = new \erdiko\core\Theme('bootstrap'); |
|
| 80 | + $theme->addCss('font-awesome', |
|
| 81 | + '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css'); |
|
| 82 | + $theme->addCss('font-awesome-animation', |
|
| 83 | + '/themes/bootstrap/css/font-awesome-animation.css'); |
|
| 84 | 84 | |
| 85 | - $response = new \erdiko\core\Response($theme); |
|
| 86 | - $response->setContent(\Erdiko::getView('error', $vars)); |
|
| 87 | - $response->send(); |
|
| 85 | + $response = new \erdiko\core\Response($theme); |
|
| 86 | + $response->setContent(\Erdiko::getView('error', $vars)); |
|
| 87 | + $response->send(); |
|
| 88 | 88 | }); |
| 89 | 89 | \ No newline at end of file |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * Hooks |
| 25 | 25 | */ |
| 26 | -\erdiko\core\ToroHook::add("404", function ($vars = array()) { |
|
| 26 | +\erdiko\core\ToroHook::add("404", function($vars = array()) { |
|
| 27 | 27 | // Toro::serve Legacy |
| 28 | 28 | $vars['debug'] = \erdiko\core\ErrorHandler::isDebug(); |
| 29 | 29 | if (empty($vars['message'])) { |
@@ -39,39 +39,39 @@ discard block |
||
| 39 | 39 | Erdiko::log(\Psr\Log\LogLevel::ERROR, "404 {$vars['path_info']} {$vars['error']}"); |
| 40 | 40 | $vars['code'] = 404; |
| 41 | 41 | |
| 42 | - $theme = new \erdiko\core\Theme( 'bootstrap' ); |
|
| 43 | - $theme->addCss( 'font-awesome', |
|
| 44 | - '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' ); |
|
| 45 | - $theme->addCss( 'font-awesome-animation', |
|
| 46 | - '/themes/bootstrap/css/font-awesome-animation.css' ); |
|
| 42 | + $theme = new \erdiko\core\Theme('bootstrap'); |
|
| 43 | + $theme->addCss('font-awesome', |
|
| 44 | + '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css'); |
|
| 45 | + $theme->addCss('font-awesome-animation', |
|
| 46 | + '/themes/bootstrap/css/font-awesome-animation.css'); |
|
| 47 | 47 | |
| 48 | - $response = new \erdiko\core\Response( $theme ); |
|
| 49 | - $response->setContent( \Erdiko::getView('error', $vars) ); |
|
| 48 | + $response = new \erdiko\core\Response($theme); |
|
| 49 | + $response->setContent(\Erdiko::getView('error', $vars)); |
|
| 50 | 50 | $response->send(); |
| 51 | 51 | }); |
| 52 | 52 | |
| 53 | -\erdiko\core\ToroHook::add("500", function ($vars = array()) { |
|
| 53 | +\erdiko\core\ToroHook::add("500", function($vars = array()) { |
|
| 54 | 54 | // Toro::serve Legacy |
| 55 | 55 | $vars['debug'] = \erdiko\core\ErrorHandler::isDebug(); |
| 56 | 56 | $vars['code'] = 500; |
| 57 | 57 | $vars['message'] = "Sorry, something went wrong."; |
| 58 | 58 | Erdiko::log(\Psr\Log\LogLevel::ERROR, "{$vars['code']}: {$vars['path_info']} {$vars['error']}"); |
| 59 | 59 | |
| 60 | - $theme = new \erdiko\core\Theme( 'bootstrap' ); |
|
| 61 | - $theme->addCss( 'font-awesome', |
|
| 62 | - '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' ); |
|
| 63 | - $theme->addCss( 'font-awesome-animation', |
|
| 64 | - '/themes/bootstrap/css/font-awesome-animation.css' ); |
|
| 60 | + $theme = new \erdiko\core\Theme('bootstrap'); |
|
| 61 | + $theme->addCss('font-awesome', |
|
| 62 | + '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css'); |
|
| 63 | + $theme->addCss('font-awesome-animation', |
|
| 64 | + '/themes/bootstrap/css/font-awesome-animation.css'); |
|
| 65 | 65 | |
| 66 | - $response = new \erdiko\core\Response( $theme ); |
|
| 67 | - $response->setContent( \Erdiko::getView('error', $vars) ); |
|
| 66 | + $response = new \erdiko\core\Response($theme); |
|
| 67 | + $response->setContent(\Erdiko::getView('error', $vars)); |
|
| 68 | 68 | $response->send(); |
| 69 | 69 | }); |
| 70 | 70 | |
| 71 | 71 | // Error management & beautify output. |
| 72 | -\erdiko\core\ToroHook::add("general_error", function ($vars = array()) { |
|
| 72 | +\erdiko\core\ToroHook::add("general_error", function($vars = array()) { |
|
| 73 | 73 | $vars['debug'] = \erdiko\core\ErrorHandler::isDebug(); |
| 74 | - if(!isset($vars['path_info'])){ |
|
| 74 | + if (!isset($vars['path_info'])) { |
|
| 75 | 75 | $vars['path_info'] = $_SERVER['REQUEST_URI']; |
| 76 | 76 | } |
| 77 | 77 | Erdiko::log(\Psr\Log\LogLevel::ERROR, "{$vars['code']}: {$vars['path_info']} {$vars['error']}"); |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <div class="container"> |
| 2 | - <?php if(!empty( $this->getTitle() )):?> |
|
| 2 | + <?php if (!empty($this->getTitle())):?> |
|
| 3 | 3 | <div class="row"> |
| 4 | 4 | <div class="col-12"> |
| 5 | 5 | <h1><?php echo $this->getTitle() ?></h1> |
@@ -7,9 +7,10 @@ |
||
| 7 | 7 | |
| 8 | 8 | <?php |
| 9 | 9 | /** Spit out meta tags **/ |
| 10 | - foreach ($this->getMeta() as $name => $content) |
|
| 11 | - echo "<meta name=\"{$name}\" content=\"{$content}\">\n"; |
|
| 12 | -?> |
|
| 10 | + foreach ($this->getMeta() as $name => $content) { |
|
| 11 | + echo "<meta name=\"{$name}\" content=\"{$content}\">\n"; |
|
| 12 | + } |
|
| 13 | + ?> |
|
| 13 | 14 | |
| 14 | 15 | <title><?php echo $this->getPageTitle() ?></title> |
| 15 | 16 | |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | <title><?php echo $this->getPageTitle(); ?></title> |
| 13 | 13 | |
| 14 | 14 | <?php |
| 15 | - // Spit out CSS |
|
| 15 | + // Spit out CSS |
|
| 16 | 16 | foreach ($this->getCss() as $css) { |
| 17 | 17 | if ($css['active']) { |
| 18 | 18 | echo "<link rel='stylesheet' href='".$css['file']."' type='text/css' />\n"; |
@@ -5,9 +5,10 @@ |
||
| 5 | 5 | |
| 6 | 6 | <?php |
| 7 | 7 | /** Spit out meta tags **/ |
| 8 | - foreach ($this->getMeta() as $name => $content) |
|
| 9 | - echo "<meta name=\"{$name}\" content=\"{$content}\">\n"; |
|
| 10 | -?> |
|
| 8 | + foreach ($this->getMeta() as $name => $content) { |
|
| 9 | + echo "<meta name=\"{$name}\" content=\"{$content}\">\n"; |
|
| 10 | + } |
|
| 11 | + ?> |
|
| 11 | 12 | |
| 12 | 13 | <title><?php echo $this->getPageTitle(); ?></title> |
| 13 | 14 | |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], |
| 6 | 6 | j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= |
| 7 | 7 | 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); |
| 8 | - })(window,document,'script','dataLayer','<?php echo $tag['container_id'];?>'); |
|
| 8 | + })(window,document,'script','dataLayer','<?php echo $tag['container_id']; ?>'); |
|
| 9 | 9 | </script> |
| 10 | 10 | <?php endif; |
| 11 | 11 | endforeach; |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php $messages = \erdiko\core\helpers\FlashMessages::get() ?> |
| 2 | -<?php if(!empty($messages)): ?> |
|
| 2 | +<?php if (!empty($messages)): ?> |
|
| 3 | 3 | <div class="container"> |
| 4 | 4 | <div class="msgs-header"> |
| 5 | 5 | <div class="row"> |
| 6 | 6 | <div class="col-lg-12 col-md-12"> |
| 7 | 7 | |
| 8 | - <?php foreach($messages as $message): ?> |
|
| 8 | + <?php foreach ($messages as $message): ?> |
|
| 9 | 9 | <div class="alert alert-<?php echo $message['type'] ?> alert-dismissible" role="alert"> |
| 10 | 10 | <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> |
| 11 | 11 | <?php echo $message['text'] ?> |