@@ -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 | } |
@@ -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 | /** |
@@ -14,23 +14,23 @@ |
||
| 14 | 14 | defined('PHILE_VERSION') || define('PHILE_VERSION', '1.8.0'); |
| 15 | 15 | defined('PHILE_CLI_MODE') || define('PHILE_CLI_MODE', (php_sapi_name() === 'cli')); |
| 16 | 16 | defined('DS') || define('DS', DIRECTORY_SEPARATOR); |
| 17 | -defined('ROOT_DIR') || define('ROOT_DIR', realpath(__DIR__ . DS . '..' . DS . '..' . DS) . DS); |
|
| 18 | -defined('LIB_DIR') || define('LIB_DIR', ROOT_DIR . 'lib' . DS); |
|
| 19 | -defined('PLUGINS_DIR') || define('PLUGINS_DIR', ROOT_DIR . 'plugins' . DS); |
|
| 20 | -defined('THEMES_DIR') || define('THEMES_DIR', ROOT_DIR . 'themes' . DS); |
|
| 21 | -defined('CACHE_DIR') || define('CACHE_DIR', LIB_DIR . 'cache' . DS); |
|
| 22 | -defined('STORAGE_DIR') || define('STORAGE_DIR', LIB_DIR . 'datastorage' . DS); |
|
| 17 | +defined('ROOT_DIR') || define('ROOT_DIR', realpath(__DIR__.DS.'..'.DS.'..'.DS).DS); |
|
| 18 | +defined('LIB_DIR') || define('LIB_DIR', ROOT_DIR.'lib'.DS); |
|
| 19 | +defined('PLUGINS_DIR') || define('PLUGINS_DIR', ROOT_DIR.'plugins'.DS); |
|
| 20 | +defined('THEMES_DIR') || define('THEMES_DIR', ROOT_DIR.'themes'.DS); |
|
| 21 | +defined('CACHE_DIR') || define('CACHE_DIR', LIB_DIR.'cache'.DS); |
|
| 22 | +defined('STORAGE_DIR') || define('STORAGE_DIR', LIB_DIR.'datastorage'.DS); |
|
| 23 | 23 | // phpcs:enable |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * initialize the autoloader |
| 27 | 27 | */ |
| 28 | 28 | // load from phile core |
| 29 | -spl_autoload_register(function ($className) { |
|
| 30 | - $fileName = LIB_DIR . str_replace("\\", DS, $className) . '.php'; |
|
| 29 | +spl_autoload_register(function($className) { |
|
| 30 | + $fileName = LIB_DIR.str_replace("\\", DS, $className).'.php'; |
|
| 31 | 31 | if (file_exists($fileName)) { |
| 32 | 32 | require_once $fileName; |
| 33 | 33 | } |
| 34 | 34 | }); |
| 35 | 35 | // load from composer |
| 36 | -require(LIB_DIR . 'vendor' . DS . 'autoload.php'); |
|
| 36 | +require(LIB_DIR.'vendor'.DS.'autoload.php'); |
|
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | list($vendor, $pluginName) = explode('\\', $pluginKey); |
| 90 | 90 | // uppercase first letter convention |
| 91 | - $pluginClassName = '\\Phile\\Plugin\\' . ucfirst($vendor) . '\\' . ucfirst($pluginName) . '\\Plugin'; |
|
| 91 | + $pluginClassName = '\\Phile\\Plugin\\'.ucfirst($vendor).'\\'.ucfirst($pluginName).'\\Plugin'; |
|
| 92 | 92 | |
| 93 | 93 | if (!class_exists($pluginClassName)) { |
| 94 | 94 | throw new PluginException( |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $classNameParts |
| 142 | 142 | ); |
| 143 | 143 | |
| 144 | - $fileName = $this->directory . implode(DS, $classPath) . '.php'; |
|
| 144 | + $fileName = $this->directory.implode(DS, $classPath).'.php'; |
|
| 145 | 145 | if (file_exists($fileName)) { |
| 146 | 146 | include_once $fileName; |
| 147 | 147 | } |
@@ -75,8 +75,8 @@ |
||
| 75 | 75 | { |
| 76 | 76 | $this->config = []; |
| 77 | 77 | $files = [ |
| 78 | - 'default' => ROOT_DIR . 'default_config.php', |
|
| 79 | - 'local' => ROOT_DIR . 'config.php' |
|
| 78 | + 'default' => ROOT_DIR.'default_config.php', |
|
| 79 | + 'local' => ROOT_DIR.'config.php' |
|
| 80 | 80 | ]; |
| 81 | 81 | foreach ($files as $file) { |
| 82 | 82 | $cfg = include $file; |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | * @package Phile |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -require_once __DIR__ . '/lib/Phile/bootstrap.php'; |
|
| 9 | +require_once __DIR__.'/lib/Phile/bootstrap.php'; |
|
| 10 | 10 | |
| 11 | 11 | ob_start(); |
| 12 | 12 | |