@@ -21,7 +21,7 @@ |
||
| 21 | 21 | { |
| 22 | 22 | /** |
| 23 | 23 | * @var \SplFileInfo $this |
| 24 | - */ |
|
| 24 | + */ |
|
| 25 | 25 | $ext = Registry::get('Phile_Settings')['content_ext']; |
| 26 | 26 | return (preg_match('/^[^\.]{1}.*' . $ext . '/', $this->getFilename()) > 0); |
| 27 | 27 | } |
@@ -23,6 +23,6 @@ |
||
| 23 | 23 | * @var \SplFileInfo $this |
| 24 | 24 | */ |
| 25 | 25 | $ext = Registry::get('Phile_Settings')['content_ext']; |
| 26 | - return (preg_match('/^[^\.]{1}.*' . $ext . '/', $this->getFilename()) > 0); |
|
| 26 | + return (preg_match('/^[^\.]{1}.*'.$ext.'/', $this->getFilename()) > 0); |
|
| 27 | 27 | } |
| 28 | 28 | } |
@@ -84,12 +84,12 @@ discard block |
||
| 84 | 84 | defined('PHILE_VERSION') || define('PHILE_VERSION', '1.8.0'); |
| 85 | 85 | defined('PHILE_CLI_MODE') || define('PHILE_CLI_MODE', (php_sapi_name() === 'cli')); |
| 86 | 86 | defined('DS') || define('DS', DIRECTORY_SEPARATOR); |
| 87 | - defined('ROOT_DIR') || define('ROOT_DIR', realpath(__DIR__ . DS . '..' . DS . '..' . DS) . DS); |
|
| 88 | - defined('LIB_DIR') || define('LIB_DIR', ROOT_DIR . 'lib' . DS); |
|
| 89 | - defined('PLUGINS_DIR') || define('PLUGINS_DIR', ROOT_DIR . 'plugins' . DS); |
|
| 90 | - defined('THEMES_DIR') || define('THEMES_DIR', ROOT_DIR . 'themes' . DS); |
|
| 91 | - defined('CACHE_DIR') || define('CACHE_DIR', LIB_DIR . 'cache' . DS); |
|
| 92 | - defined('STORAGE_DIR') || define('STORAGE_DIR', LIB_DIR . 'datastorage' . DS); |
|
| 87 | + defined('ROOT_DIR') || define('ROOT_DIR', realpath(__DIR__.DS.'..'.DS.'..'.DS).DS); |
|
| 88 | + defined('LIB_DIR') || define('LIB_DIR', ROOT_DIR.'lib'.DS); |
|
| 89 | + defined('PLUGINS_DIR') || define('PLUGINS_DIR', ROOT_DIR.'plugins'.DS); |
|
| 90 | + defined('THEMES_DIR') || define('THEMES_DIR', ROOT_DIR.'themes'.DS); |
|
| 91 | + defined('CACHE_DIR') || define('CACHE_DIR', LIB_DIR.'cache'.DS); |
|
| 92 | + defined('STORAGE_DIR') || define('STORAGE_DIR', LIB_DIR.'datastorage'.DS); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | spl_autoload_extensions(".php"); |
| 101 | 101 | // load phile core |
| 102 | 102 | spl_autoload_register( |
| 103 | - function ($className) { |
|
| 104 | - $fileName = LIB_DIR . str_replace("\\", DS, $className) . '.php'; |
|
| 103 | + function($className) { |
|
| 104 | + $fileName = LIB_DIR.str_replace("\\", DS, $className).'.php'; |
|
| 105 | 105 | if (file_exists($fileName)) { |
| 106 | 106 | include_once $fileName; |
| 107 | 107 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | // load phile plugins |
| 111 | 111 | spl_autoload_register('\Phile\Plugin\PluginRepository::autoload'); |
| 112 | 112 | |
| 113 | - include LIB_DIR . 'vendor' . DS . 'autoload.php'; |
|
| 113 | + include LIB_DIR.'vendor'.DS.'autoload.php'; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | protected function initializeConfiguration() |
| 120 | 120 | { |
| 121 | - $defaults = Utility::load(ROOT_DIR . 'default_config.php'); |
|
| 122 | - $localSettings = Utility::load(ROOT_DIR . 'config.php'); |
|
| 121 | + $defaults = Utility::load(ROOT_DIR.'default_config.php'); |
|
| 122 | + $localSettings = Utility::load(ROOT_DIR.'config.php'); |
|
| 123 | 123 | if (is_array($localSettings)) { |
| 124 | 124 | $this->settings = array_replace_recursive($defaults, $localSettings); |
| 125 | 125 | } else { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $pageId .= 'index'; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $file = $folder . $pageId . $this->settings['content_ext']; |
|
| 68 | + $file = $folder.$pageId.$this->settings['content_ext']; |
|
| 69 | 69 | if (!file_exists($file)) { |
| 70 | 70 | if (substr($pageId, -6) === '/index') { |
| 71 | 71 | // try to resolve sub-directory 'sub/' to page 'sub' |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | // try to resolve page 'sub' to sub-directory 'sub/' |
| 75 | 75 | $pageId .= '/index'; |
| 76 | 76 | } |
| 77 | - $file = $folder . $pageId . $this->settings['content_ext']; |
|
| 77 | + $file = $folder.$pageId.$this->settings['content_ext']; |
|
| 78 | 78 | } |
| 79 | 79 | if (!file_exists($file)) { |
| 80 | 80 | return null; |
@@ -94,13 +94,13 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | $folder = $folder ?: $this->settings['content_dir']; |
| 96 | 96 | return new PageCollection( |
| 97 | - function () use ($options, $folder) { |
|
| 97 | + function() use ($options, $folder) { |
|
| 98 | 98 | $options += $this->settings; |
| 99 | 99 | // ignore files with a leading '.' in its filename |
| 100 | 100 | $files = Utility::getFiles($folder, '\Phile\FilterIterator\ContentFileFilterIterator'); |
| 101 | 101 | $pages = array(); |
| 102 | 102 | foreach ($files as $file) { |
| 103 | - if (str_replace($folder, '', $file) == '404' . $this->settings['content_ext']) { |
|
| 103 | + if (str_replace($folder, '', $file) == '404'.$this->settings['content_ext']) { |
|
| 104 | 104 | // jump to next page if file is the 404 page |
| 105 | 105 | continue; |
| 106 | 106 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | $meta = $page->getMeta(); |
| 139 | 139 | if ($sort['type'] === 'page') { |
| 140 | - $method = 'get' . ucfirst($key); |
|
| 140 | + $method = 'get'.ucfirst($key); |
|
| 141 | 141 | $value = $page->$method(); |
| 142 | 142 | } elseif ($sort['type'] === 'meta') { |
| 143 | 143 | $value = $meta->get($key); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $column[] = $value; |
| 152 | 152 | } |
| 153 | 153 | $sortHelper[] = $column; |
| 154 | - $sortHelper[] = constant('SORT_' . strtoupper($sort['order'])); |
|
| 154 | + $sortHelper[] = constant('SORT_'.strtoupper($sort['order'])); |
|
| 155 | 155 | } |
| 156 | 156 | $sortHelper[] = &$pages; |
| 157 | 157 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | protected function getPage($filePath, $folder = null) |
| 195 | 195 | { |
| 196 | 196 | $folder = $folder ?: $this->settings['content_dir']; |
| 197 | - $key = 'Phile_Model_Page_' . md5($filePath); |
|
| 197 | + $key = 'Phile_Model_Page_'.md5($filePath); |
|
| 198 | 198 | if (isset($this->storage[$key])) { |
| 199 | 199 | return $this->storage[$key]; |
| 200 | 200 | } |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | /** |
| 69 | 69 | * content directory |
| 70 | 70 | */ |
| 71 | -$config['content_dir'] = ROOT_DIR . 'content' . DS; |
|
| 71 | +$config['content_dir'] = ROOT_DIR.'content'.DS; |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * extension of content files |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $template = 'index'; |
| 124 | 124 | } |
| 125 | 125 | if (!empty($this->config['template-extension'])) { |
| 126 | - $template .= '.' . $this->config['template-extension']; |
|
| 126 | + $template .= '.'.$this->config['template-extension']; |
|
| 127 | 127 | } |
| 128 | 128 | $templatePath = $this->getTemplatePath($template); |
| 129 | 129 | if (!file_exists($templatePath)) { |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | protected function getTemplatePath($sub = '') |
| 145 | 145 | { |
| 146 | - $themePath = THEMES_DIR . $this->settings['theme']; |
|
| 146 | + $themePath = THEMES_DIR.$this->settings['theme']; |
|
| 147 | 147 | if (!empty($sub)) { |
| 148 | - $themePath .= '/' . ltrim($sub, DIRECTORY_SEPARATOR); |
|
| 148 | + $themePath .= '/'.ltrim($sub, DIRECTORY_SEPARATOR); |
|
| 149 | 149 | } |
| 150 | 150 | return $themePath; |
| 151 | 151 | } |
@@ -167,11 +167,11 @@ discard block |
||
| 167 | 167 | 'base_url' => $this->settings['base_url'], |
| 168 | 168 | 'config' => $this->settings, |
| 169 | 169 | 'content_dir' => $this->settings['content_dir'], |
| 170 | - 'content_url' => $this->settings['base_url'] . '/' . basename($this->settings['content_dir']), |
|
| 170 | + 'content_url' => $this->settings['base_url'].'/'.basename($this->settings['content_dir']), |
|
| 171 | 171 | 'pages' => $repository->findAll(), |
| 172 | 172 | 'site_title' => $this->settings['site_title'], |
| 173 | - 'theme_dir' => THEMES_DIR . $this->settings['theme'], |
|
| 174 | - 'theme_url' => $this->settings['base_url'] . '/' . basename(THEMES_DIR) . '/' . $this->settings['theme'], |
|
| 173 | + 'theme_dir' => THEMES_DIR.$this->settings['theme'], |
|
| 174 | + 'theme_url' => $this->settings['base_url'].'/'.basename(THEMES_DIR).'/'.$this->settings['theme'], |
|
| 175 | 175 | ]; |
| 176 | 176 | |
| 177 | 177 | /** |