@@ -1,9 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace samsoncms\cms; |
| 3 | 3 | |
| 4 | -use samson\activerecord\dbQuery; |
|
| 5 | 4 | use samson\core\CompressableExternalModule; |
| 6 | -use samson\pager\Pager; |
|
| 7 | 5 | use samsonphp\event\Event; |
| 8 | 6 | |
| 9 | 7 | /** |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | protected $isCMS = false; |
| 18 | 18 | |
| 19 | - public function init( array $params = array() ) { |
|
| 19 | + public function init(array $params = array()) { |
|
| 20 | 20 | Event::subscribe('core.security', array($this, 'updateTemplate')); |
| 21 | 21 | // Old applications main page rendering |
| 22 | 22 | Event::subscribe('template.main.rendered', array($this, 'oldMainRenderer')); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | Event::subscribe('samson.url.build', array($this, 'buildUrl')); |
| 27 | 27 | // Call parent initialization |
| 28 | - return parent::init( $params ); |
|
| 28 | + return parent::init($params); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function buildUrl(& $urlObj, & $httpHost, & $urlParams) |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | if (isset($urlParams[$index]) && (\samson\core\SamsonLocale::current() == $urlParams[$index])) { |
| 35 | 35 | $index = 1; |
| 36 | 36 | } |
| 37 | - if ( isset( $urlParams[$index] ) && ( strpos($urlParams[$index], 'cms-') === 0 ) ) { |
|
| 37 | + if (isset($urlParams[$index]) && (strpos($urlParams[$index], 'cms-') === 0)) { |
|
| 38 | 38 | $urlParams[$index] = str_replace('cms-', '', $urlParams[$index]); |
| 39 | 39 | array_unshift($urlParams, 'cms'); |
| 40 | 40 | } |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function initUrl( & $urlObj, & $urlArgs ) { |
|
| 50 | - if($urlArgs[0] == 'cms') { |
|
| 49 | + public function initUrl(& $urlObj, & $urlArgs) { |
|
| 50 | + if ($urlArgs[0] == 'cms') { |
|
| 51 | 51 | $this->isCMS = true; |
| 52 | 52 | if (isset($urlArgs[1])) { |
| 53 | - if (strpos($urlArgs[1], 'samsoncms_') !== 0){ |
|
| 53 | + if (strpos($urlArgs[1], 'samsoncms_') !== 0) { |
|
| 54 | 54 | $urlArgs[1] = 'cms-'.$urlArgs[1]; |
| 55 | 55 | } |
| 56 | 56 | unset($urlArgs[0]); |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | if ($moduleId == 'core') return true; |
| 65 | 65 | if ($this->isCMS) { |
| 66 | 66 | $approve = false; |
| 67 | - if (isset(m($moduleId)->composerParameters['composerName'])&& |
|
| 68 | - isset(m('cms')->composerParameters['required'])&& |
|
| 69 | - in_array(m($moduleId)->composerParameters['composerName'], m('cms')->composerParameters['required'])){ |
|
| 67 | + if (isset(m($moduleId)->composerParameters['composerName']) && |
|
| 68 | + isset(m('cms')->composerParameters['required']) && |
|
| 69 | + in_array(m($moduleId)->composerParameters['composerName'], m('cms')->composerParameters['required'])) { |
|
| 70 | 70 | $approve = true; |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -125,7 +125,6 @@ discard block |
||
| 125 | 125 | { |
| 126 | 126 | $local = m('local'); |
| 127 | 127 | $current = m(); |
| 128 | - return isset($current['title']) ? $current['title'] : |
|
| 129 | - (isset($local['title']) ? $local['title'] : ''); |
|
| 128 | + return isset($current['title']) ? $current['title'] : (isset($local['title']) ? $local['title'] : ''); |
|
| 130 | 129 | } |
| 131 | 130 | } |
| 132 | 131 | \ No newline at end of file |
@@ -61,7 +61,9 @@ |
||
| 61 | 61 | |
| 62 | 62 | public function initResources(& $resourceRouter, $moduleId, & $approve) |
| 63 | 63 | { |
| 64 | - if ($moduleId == 'core') return true; |
|
| 64 | + if ($moduleId == 'core') { |
|
| 65 | + return true; |
|
| 66 | + } |
|
| 65 | 67 | if ($this->isCMS) { |
| 66 | 68 | $approve = false; |
| 67 | 69 | if (isset(m($moduleId)->composerParameters['composerName'])&& |