@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - $output->writeln('Done! ' . $this->getRunStats()); |
|
| 141 | + $output->writeln('Done! '.$this->getRunStats()); |
|
| 142 | 142 | |
| 143 | 143 | return 0; |
| 144 | 144 | } |
@@ -175,26 +175,26 @@ discard block |
||
| 175 | 175 | $question = new Question('Database Prefix [modx_]: ', 'modx_'); |
| 176 | 176 | $dbPrefix = $helper->ask($this->input, $this->output, $question); |
| 177 | 177 | |
| 178 | - $question = new Question('Hostname (' . gethostname() . ') or IP address for local virtual boxes, default: [192.168.33.10]: ', '192.168.33.10'); |
|
| 178 | + $question = new Question('Hostname ('.gethostname().') or IP address for local virtual boxes, default: [192.168.33.10]: ', '192.168.33.10'); |
|
| 179 | 179 | $host = $helper->ask($this->input, $this->output, $question); |
| 180 | 180 | $host = rtrim(trim($host), '/'); |
| 181 | 181 | |
| 182 | 182 | $defaultBaseUrl = '/'; |
| 183 | - $question = new Question('Base URL [' . $defaultBaseUrl . ']: ', $defaultBaseUrl); |
|
| 183 | + $question = new Question('Base URL ['.$defaultBaseUrl.']: ', $defaultBaseUrl); |
|
| 184 | 184 | $baseUrl = $helper->ask($this->input, $this->output, $question); |
| 185 | - $baseUrl = '/' . trim(trim($baseUrl), '/') . '/'; |
|
| 185 | + $baseUrl = '/'.trim(trim($baseUrl), '/').'/'; |
|
| 186 | 186 | $baseUrl = str_replace('//', '/', $baseUrl); |
| 187 | 187 | |
| 188 | 188 | $question = new Question('Manager Language [en]: ', 'en'); |
| 189 | 189 | $language = $helper->ask($this->input, $this->output, $question); |
| 190 | 190 | |
| 191 | - $defaultMgrUser = basename(MODX_PATH) . '_admin'; |
|
| 192 | - $question = new Question('Manager User [' . $defaultMgrUser . ']: ', $defaultMgrUser); |
|
| 191 | + $defaultMgrUser = basename(MODX_PATH).'_admin'; |
|
| 192 | + $question = new Question('Manager User ['.$defaultMgrUser.']: ', $defaultMgrUser); |
|
| 193 | 193 | $managerUser = $helper->ask($this->input, $this->output, $question); |
| 194 | 194 | |
| 195 | 195 | $question = new Question('Manager User Password [generated]: ', 'generate'); |
| 196 | 196 | $question->setHidden(true); |
| 197 | - $question->setValidator(function ($value) { |
|
| 197 | + $question->setValidator(function($value) { |
|
| 198 | 198 | if (empty($value) || strlen($value) < 8) { |
| 199 | 199 | throw new \RuntimeException( |
| 200 | 200 | 'Please specify a password of at least 8 characters to continue.' |
@@ -235,11 +235,11 @@ discard block |
||
| 235 | 235 | 'admin_password' => $managerPass, |
| 236 | 236 | 'admin_email' => $managerEmail, |
| 237 | 237 | |
| 238 | - 'core_path' => MODX_PATH . 'core/', |
|
| 239 | - 'mgr_path' => MODX_PATH . 'manager/', |
|
| 240 | - 'mgr_url' => $baseUrl . 'manager/', |
|
| 241 | - 'connectors_path' => MODX_PATH . 'connectors/', |
|
| 242 | - 'connectors_url' => $baseUrl . 'connectors/', |
|
| 238 | + 'core_path' => MODX_PATH.'core/', |
|
| 239 | + 'mgr_path' => MODX_PATH.'manager/', |
|
| 240 | + 'mgr_url' => $baseUrl.'manager/', |
|
| 241 | + 'connectors_path' => MODX_PATH.'connectors/', |
|
| 242 | + 'connectors_url' => $baseUrl.'connectors/', |
|
| 243 | 243 | 'web_path' => MODX_PATH, |
| 244 | 244 | 'web_url' => $baseUrl, |
| 245 | 245 | 'remove_setup_directory' => true, |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | * @param mixed |
| 262 | 262 | * @return bool|mixed |
| 263 | 263 | */ |
| 264 | - protected function getUserInstallConfigValue($key, $default=false) |
|
| 264 | + protected function getUserInstallConfigValue($key, $default = false) |
|
| 265 | 265 | { |
| 266 | 266 | if (isset($this->install_config[$key])) { |
| 267 | 267 | return $this->install_config[$key]; |
@@ -275,8 +275,8 @@ discard block |
||
| 275 | 275 | $modx = null; |
| 276 | 276 | |
| 277 | 277 | /* to validate installation, instantiate the modX class and run a few tests */ |
| 278 | - if (include_once (MODX_PATH . 'core/model/modx/modx.class.php')) { |
|
| 279 | - $modx = new \modX(MODX_PATH . 'core/config/', array( |
|
| 278 | + if (include_once (MODX_PATH.'core/model/modx/modx.class.php')) { |
|
| 279 | + $modx = new \modX(MODX_PATH.'core/config/', array( |
|
| 280 | 280 | \xPDO::OPT_SETUP => true, |
| 281 | 281 | )); |
| 282 | 282 | if (!is_object($modx) || !($modx instanceof modX)) { |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $modx->setLogTarget(array( |
| 286 | 286 | 'target' => 'FILE', |
| 287 | 287 | 'options' => array( |
| 288 | - 'filename' => 'install.' . (defined('MODX_CONFIG_KEY') ? MODX_CONFIG_PATH : '') . '.' . strftime('%Y%m%dT%H%M%S') . '.log' |
|
| 288 | + 'filename' => 'install.'.(defined('MODX_CONFIG_KEY') ? MODX_CONFIG_PATH : '').'.'.strftime('%Y%m%dT%H%M%S').'.log' |
|
| 289 | 289 | ) |
| 290 | 290 | )); |
| 291 | 291 | |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $output->writeln('Done! ' . $this->getRunStats()); |
|
| 116 | + $output->writeln('Done! '.$this->getRunStats()); |
|
| 117 | 117 | |
| 118 | 118 | return 0; |
| 119 | 119 | } |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | 76 | // Try to look for a file with the API Key from a file within the gitify working directory |
| 77 | - if (!empty($provider_data['api_key']) && file_exists(MODX_PATH . '/' . $provider_data['api_key'])) { |
|
| 78 | - $credentials['api_key'] = trim(file_get_contents(MODX_PATH . '/' . $provider_data['api_key'])); |
|
| 77 | + if (!empty($provider_data['api_key']) && file_exists(MODX_PATH.'/'.$provider_data['api_key'])) { |
|
| 78 | + $credentials['api_key'] = trim(file_get_contents(MODX_PATH.'/'.$provider_data['api_key'])); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // load provider credentials from file |
| 82 | - if (!empty($provider_data['credential_file']) && file_exists(MODX_PATH . '/' . $provider_data['credential_file'])) { |
|
| 83 | - $credentials_content = trim(file_get_contents(MODX_PATH . '/' . $provider_data['credential_file'])); |
|
| 82 | + if (!empty($provider_data['credential_file']) && file_exists(MODX_PATH.'/'.$provider_data['credential_file'])) { |
|
| 83 | + $credentials_content = trim(file_get_contents(MODX_PATH.'/'.$provider_data['credential_file'])); |
|
| 84 | 84 | $credentials = Gitify::fromYAML($credentials_content); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | private function install($package, $provider = 0, array $installOptions = array()) |
| 124 | 124 | { |
| 125 | - $this->modx->addPackage('modx.transport', MODX_CORE_PATH . 'model/'); |
|
| 125 | + $this->modx->addPackage('modx.transport', MODX_CORE_PATH.'model/'); |
|
| 126 | 126 | |
| 127 | 127 | if (!($provider instanceof \modTransportProvider) && is_numeric($provider) && $provider > 0) |
| 128 | 128 | { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | private function download($packageName, $provider, $options = array()) { |
| 164 | 164 | $this->modx->getVersionData(); |
| 165 | - $product_version = $this->modx->version['code_name'] . '-' . $this->modx->version['full_version']; |
|
| 165 | + $product_version = $this->modx->version['code_name'].'-'.$this->modx->version['full_version']; |
|
| 166 | 166 | |
| 167 | 167 | $response = $provider->verify(); |
| 168 | 168 | if ($response !== true) { |
@@ -189,13 +189,13 @@ discard block |
||
| 189 | 189 | // when we got a match (non 404), extract package information |
| 190 | 190 | if (!$response->isError()) { |
| 191 | 191 | |
| 192 | - $foundPkg = simplexml_load_string ( $response->response ); |
|
| 192 | + $foundPkg = simplexml_load_string($response->response); |
|
| 193 | 193 | |
| 194 | - $packages [strtolower((string) $foundPkg->name)] = array ( |
|
| 195 | - 'name' => (string) $foundPkg->name, |
|
| 196 | - 'version' => (string) $foundPkg->version, |
|
| 197 | - 'location' => (string) $foundPkg->location, |
|
| 198 | - 'signature' => (string) $foundPkg->signature |
|
| 194 | + $packages [strtolower((string)$foundPkg->name)] = array( |
|
| 195 | + 'name' => (string)$foundPkg->name, |
|
| 196 | + 'version' => (string)$foundPkg->version, |
|
| 197 | + 'location' => (string)$foundPkg->location, |
|
| 198 | + 'signature' => (string)$foundPkg->signature |
|
| 199 | 199 | ); |
| 200 | 200 | } |
| 201 | 201 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | // process found packages |
| 230 | 230 | if (!empty($packages)) { |
| 231 | 231 | |
| 232 | - $this->output->writeln('Found ' . count($packages) . ' package(s).'); |
|
| 232 | + $this->output->writeln('Found '.count($packages).' package(s).'); |
|
| 233 | 233 | |
| 234 | 234 | $helper = $this->getHelper('question'); |
| 235 | 235 | |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | public function loadModxInstall() |
| 80 | 80 | { |
| 81 | 81 | /* to validate installation, instantiate the modX class and run a few tests */ |
| 82 | - if (include_once (M_CORE_PATH . 'model/modx/modx.class.php')) { |
|
| 83 | - $modx = new modX(M_CORE_PATH . 'config/', [ |
|
| 82 | + if (include_once (M_CORE_PATH.'model/modx/modx.class.php')) { |
|
| 83 | + $modx = new modX(M_CORE_PATH.'config/', [ |
|
| 84 | 84 | \xPDO::OPT_SETUP => true, |
| 85 | 85 | ]); |
| 86 | 86 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $modx->setLogTarget(array( |
| 91 | 91 | 'target' => 'FILE', |
| 92 | 92 | 'options' => array( |
| 93 | - 'filename' => 'install.' . MODX_CONFIG_KEY . '.' . strftime('%Y%m%dT%H%M%S') . '.log' |
|
| 93 | + 'filename' => 'install.'.MODX_CONFIG_KEY.'.'.strftime('%Y%m%dT%H%M%S').'.log' |
|
| 94 | 94 | ) |
| 95 | 95 | )); |
| 96 | 96 | |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | $curTime = microtime(true); |
| 114 | 114 | $duration = $curTime - $this->startTime; |
| 115 | 115 | |
| 116 | - $output = 'Time: ' . number_format($duration * 1000, 0) . 'ms | '; |
|
| 117 | - $output .= 'Memory Usage: ' . $this->convertBytes(memory_get_usage(false)) . ' | '; |
|
| 118 | - $output .= 'Peak Memory Usage: ' . $this->convertBytes(memory_get_peak_usage(false)); |
|
| 116 | + $output = 'Time: '.number_format($duration * 1000, 0).'ms | '; |
|
| 117 | + $output .= 'Memory Usage: '.$this->convertBytes(memory_get_usage(false)).' | '; |
|
| 118 | + $output .= 'Peak Memory Usage: '.$this->convertBytes(memory_get_peak_usage(false)); |
|
| 119 | 119 | return $output; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | protected function convertBytes($bytes) |
| 127 | 127 | { |
| 128 | - $unit = array('b','kb','mb','gb','tb','pb'); |
|
| 129 | - return @round($bytes/pow(1024,($i=floor(log($bytes,1024)))),2).' '.$unit[$i]; |
|
| 128 | + $unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb'); |
|
| 129 | + return @round($bytes / pow(1024, ($i = floor(log($bytes, 1024)))), 2).' '.$unit[$i]; |
|
| 130 | 130 | } |
| 131 | 131 | } |
@@ -72,25 +72,25 @@ discard block |
||
| 72 | 72 | $id = $input->getOption('id'); |
| 73 | 73 | $date = $input->getOption('date'); |
| 74 | 74 | |
| 75 | - if ( $object == 'c' || $object == 'chunk' ) { |
|
| 75 | + if ($object == 'c' || $object == 'chunk') { |
|
| 76 | 76 | $this->seedChunks($type, $name, $id); |
| 77 | 77 | |
| 78 | - } elseif ( $object == 'p' || $object == 'plugin' ) { |
|
| 78 | + } elseif ($object == 'p' || $object == 'plugin') { |
|
| 79 | 79 | $this->seedPlugins($type, $name, $id); |
| 80 | 80 | |
| 81 | - } elseif ( $object == 'r' || $object == 'resource' ) { |
|
| 81 | + } elseif ($object == 'r' || $object == 'resource') { |
|
| 82 | 82 | $this->seedResources($type, $name, $id, $date); |
| 83 | 83 | |
| 84 | - } elseif ( $object == 's' || $object == 'snippet' ) { |
|
| 84 | + } elseif ($object == 's' || $object == 'snippet') { |
|
| 85 | 85 | $this->seedSnippets($type, $name, $id); |
| 86 | 86 | |
| 87 | - } elseif ( $object == 'x' || $object == 'systemSettings' ) { |
|
| 87 | + } elseif ($object == 'x' || $object == 'systemSettings') { |
|
| 88 | 88 | $this->seedSystemSettings($type, $name, $id, $date); |
| 89 | 89 | |
| 90 | - } elseif ( $object == 't' || $object == 'template' ) { |
|
| 90 | + } elseif ($object == 't' || $object == 'template') { |
|
| 91 | 91 | $this->seedTemplates($type, $name, $id); |
| 92 | 92 | |
| 93 | - } elseif ( $object == 'a' || $object == 'site' ) { |
|
| 93 | + } elseif ($object == 'a' || $object == 'site') { |
|
| 94 | 94 | $this->blender->makeSiteSeed($type, $name); |
| 95 | 95 | |
| 96 | 96 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $query = $this->modx->newQuery('modResource', ['id:IN' => $ids]); |
| 200 | 200 | $query->select(['modResource.parent']); |
| 201 | 201 | $query->prepare(); |
| 202 | - $criteria->orCondition('`modResource`.`id` IN(' . $query->toSQL() . ')'); |
|
| 202 | + $criteria->orCondition('`modResource`.`id` IN('.$query->toSQL().')'); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | if ($this->consoleUserInteractionHandler->promptConfirm('Would you like to include direct children?')) { |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $query->select(['modResource.id']); |
| 209 | 209 | $query->prepare(); |
| 210 | 210 | $children_sql = $query->toSQL(); |
| 211 | - $criteria->orCondition('`modResource`.`id` IN(' . $children_sql . ')'); |
|
| 211 | + $criteria->orCondition('`modResource`.`id` IN('.$children_sql.')'); |
|
| 212 | 212 | |
| 213 | 213 | if ($this->consoleUserInteractionHandler->promptConfirm('Would you like to include direct grand children?')) { |
| 214 | 214 | // get grand children |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | $id = $input->getOption('id'); |
| 76 | 76 | $count = $input->getOption('count'); |
| 77 | 77 | |
| 78 | - if ( $input->getOption('generate') ) { |
|
| 78 | + if ($input->getOption('generate')) { |
|
| 79 | 79 | $output->writeln('Generate name: '.$name); |
| 80 | 80 | // create a blank migration class |
| 81 | 81 | $this->blender->createBlankMigrationClassFile($name, $type); |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | if (!$connected) { |
| 20 | 20 | // connect with xPDO: |
| 21 | - $dsnArray= \xPDO\xPDO :: parseDSN($this->modx->getOption('dsn')); |
|
| 21 | + $dsnArray = \xPDO\xPDO :: parseDSN($this->modx->getOption('dsn')); |
|
| 22 | 22 | |
| 23 | 23 | // Create the MODX database: |
| 24 | - $created= $this->modx->manager->createSourceContainer($dsnArray, $this->modx->config['username'], $this->modx->config['password']); |
|
| 24 | + $created = $this->modx->manager->createSourceContainer($dsnArray, $this->modx->config['username'], $this->modx->config['password']); |
|
| 25 | 25 | if (!$created) { |
| 26 | 26 | $this->addResultMessage([xPDO::LOG_LEVEL_ERROR => $this->modx->lexicon('db_err_create')]); |
| 27 | 27 | } else { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | // create MODX tables |
| 46 | 46 | foreach ($this->modx_tables as $class) { |
| 47 | - if (!$dbcreated= $this->modx->manager->createObjectContainer($class)) { |
|
| 47 | + if (!$dbcreated = $this->modx->manager->createObjectContainer($class)) { |
|
| 48 | 48 | $this->addResultMessage([xPDO::LOG_LEVEL_ERROR => $this->modx->lexicon('table_err_create', ['class' => $class])]); |
| 49 | 49 | } else { |
| 50 | 50 | $this->addResultMessage([xPDO::LOG_LEVEL_DEBUG + 1 => $this->modx->lexicon('table_created', ['class' => $class])]); |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | // drop tables |
| 145 | 145 | foreach ($this->modx_tables as $class) { |
| 146 | - if (!$dbcreated= $this->modx->manager->removeObjectContainer($class)) { |
|
| 147 | - $this->results[]= [xPDO::LOG_LEVEL_ERROR => $this->modx->lexicon('table_err_remove', ['class' => $class])]; |
|
| 146 | + if (!$dbcreated = $this->modx->manager->removeObjectContainer($class)) { |
|
| 147 | + $this->results[] = [xPDO::LOG_LEVEL_ERROR => $this->modx->lexicon('table_err_remove', ['class' => $class])]; |
|
| 148 | 148 | } else { |
| 149 | - $this->results[]= [xPDO::LOG_LEVEL_DEBUG + 1 => $this->modx->lexicon('table_removed', ['class' => $class])]; |
|
| 149 | + $this->results[] = [xPDO::LOG_LEVEL_DEBUG + 1 => $this->modx->lexicon('table_removed', ['class' => $class])]; |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /* if language != en, set cultureKey, manager_language, manager_lang_attribute to it */ |
| 244 | - $language = $this->getUserInstallConfigValue('language','en'); |
|
| 244 | + $language = $this->getUserInstallConfigValue('language', 'en'); |
|
| 245 | 245 | if ($language != 'en') { |
| 246 | 246 | /** @var \LCI\Blend\Blendable\SystemSetting $systemSetting */ |
| 247 | 247 | $systemSetting = $this->blender->getBlendableSystemSetting(); |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | |
| 281 | 281 | $maxFileSize = ini_get('upload_max_filesize'); |
| 282 | 282 | $maxFileSize = trim($maxFileSize); |
| 283 | - $last = strtolower($maxFileSize[strlen($maxFileSize)-1]); |
|
| 283 | + $last = strtolower($maxFileSize[strlen($maxFileSize) - 1]); |
|
| 284 | 284 | switch ($last) { |
| 285 | 285 | // The 'G' modifier is available since PHP 5.1.0 |
| 286 | 286 | case 'g': |
@@ -305,15 +305,15 @@ discard block |
||
| 305 | 305 | { |
| 306 | 306 | /** @var \modNamespace $namespace */ |
| 307 | 307 | $namespace = $this->modx->newObject('modNamespace'); |
| 308 | - $namespace->set('name','core'); |
|
| 309 | - $namespace->set('path','{core_path}'); |
|
| 310 | - $namespace->set('assets_path','{assets_path}'); |
|
| 308 | + $namespace->set('name', 'core'); |
|
| 309 | + $namespace->set('path', '{core_path}'); |
|
| 310 | + $namespace->set('assets_path', '{assets_path}'); |
|
| 311 | 311 | |
| 312 | 312 | $namespace->save(); |
| 313 | 313 | |
| 314 | 314 | /** @var \modWorkspace $workspace */ |
| 315 | 315 | $workspace = $this->modx->newObject('modWorkspace'); |
| 316 | - $workspace->fromArray(array ( |
|
| 316 | + $workspace->fromArray(array( |
|
| 317 | 317 | 'id' => 1, |
| 318 | 318 | 'name' => 'Default MODX workspace', |
| 319 | 319 | 'path' => '{core_path}', |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | |
| 324 | 324 | /* modx.com extras provisioner */ |
| 325 | 325 | $transportProvider = $this->modx->newObject('transport.modTransportProvider'); |
| 326 | - $transportProvider->fromArray(array ( |
|
| 326 | + $transportProvider->fromArray(array( |
|
| 327 | 327 | 'id' => 1, |
| 328 | 328 | 'name' => 'modx.com', |
| 329 | 329 | 'description' => 'The official MODX transport provider for 3rd party components.', |
@@ -340,12 +340,12 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | /* setup load only anonymous ACL */ |
| 342 | 342 | /** @var modAccessPolicy $loadOnly */ |
| 343 | - $loadOnly = $this->modx->getObject('modAccessPolicy',array( |
|
| 343 | + $loadOnly = $this->modx->getObject('modAccessPolicy', array( |
|
| 344 | 344 | 'name' => 'Load Only', |
| 345 | 345 | )); |
| 346 | 346 | if ($loadOnly) { |
| 347 | 347 | /** @var modAccessContext $access */ |
| 348 | - $access= $this->modx->newObject('modAccessContext'); |
|
| 348 | + $access = $this->modx->newObject('modAccessContext'); |
|
| 349 | 349 | $access->fromArray(array( |
| 350 | 350 | 'target' => 'web', |
| 351 | 351 | 'principal_class' => 'modUserGroup', |
@@ -361,16 +361,16 @@ discard block |
||
| 361 | 361 | |
| 362 | 362 | /* setup default admin ACLs */ |
| 363 | 363 | /** @var modAccessPolicy $adminPolicy */ |
| 364 | - $adminPolicy = $this->modx->getObject('modAccessPolicy',array( |
|
| 364 | + $adminPolicy = $this->modx->getObject('modAccessPolicy', array( |
|
| 365 | 365 | 'name' => 'Administrator', |
| 366 | 366 | )); |
| 367 | 367 | /** @var modUserGroup $adminGroup */ |
| 368 | - $adminGroup = $this->modx->getObject('modUserGroup',array( |
|
| 368 | + $adminGroup = $this->modx->getObject('modUserGroup', array( |
|
| 369 | 369 | 'name' => 'Administrator', |
| 370 | 370 | )); |
| 371 | 371 | if ($adminPolicy && $adminGroup) { |
| 372 | 372 | /** @var modAccessContext $access */ |
| 373 | - $access= $this->modx->newObject('modAccessContext'); |
|
| 373 | + $access = $this->modx->newObject('modAccessContext'); |
|
| 374 | 374 | $access->fromArray(array( |
| 375 | 375 | 'target' => 'mgr', |
| 376 | 376 | 'principal_class' => 'modUserGroup', |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | $access->save(); |
| 382 | 382 | unset($access); |
| 383 | 383 | |
| 384 | - $access= $this->modx->newObject('modAccessContext'); |
|
| 384 | + $access = $this->modx->newObject('modAccessContext'); |
|
| 385 | 385 | $access->fromArray(array( |
| 386 | 386 | 'target' => 'web', |
| 387 | 387 | 'principal_class' => 'modUserGroup', |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | $access->save(); |
| 393 | 393 | unset($access); |
| 394 | 394 | } |
| 395 | - unset($adminPolicy,$adminGroup); |
|
| 395 | + unset($adminPolicy, $adminGroup); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | /** |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $userGroupMembership->set('role', 2); |
| 424 | 424 | $saved = $userGroupMembership->save(); |
| 425 | 425 | |
| 426 | - $user->set('primary_group',1); |
|
| 426 | + $user->set('primary_group', 1); |
|
| 427 | 427 | $user->save(); |
| 428 | 428 | } |
| 429 | 429 | if ($saved) { |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | } |
| 437 | 437 | } |
| 438 | 438 | if (!$saved) { |
| 439 | - $this->addResultMessage([xPDO::LOG_LEVEL_ERROR => $this->modx->lexicon('dau_err_save').'<br />' . print_r($this->modx->errorInfo(), true)]); |
|
| 439 | + $this->addResultMessage([xPDO::LOG_LEVEL_ERROR => $this->modx->lexicon('dau_err_save').'<br />'.print_r($this->modx->errorInfo(), true)]); |
|
| 440 | 440 | } else { |
| 441 | 441 | $this->addResultMessage([xPDO::LOG_LEVEL_DEBUG + 1 => $this->modx->lexicon('dau_saved')]); |
| 442 | 442 | } |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | protected function upAttachPolicyTemplates() |
| 448 | 448 | { |
| 449 | 449 | // replaces: _build/resolvers/resolve.policytemplates.php |
| 450 | - $success= false; |
|
| 450 | + $success = false; |
|
| 451 | 451 | |
| 452 | 452 | /* map of Template -> TemplateGroup */ |
| 453 | 453 | $map = [ |
@@ -463,9 +463,9 @@ discard block |
||
| 463 | 463 | $templates = $this->modx->getCollection('modAccessPolicyTemplate'); |
| 464 | 464 | foreach ($templates as $template) { |
| 465 | 465 | if (isset($map[$template->get('name')])) { |
| 466 | - $templateGroup = $this->modx->getObject('modAccessPolicyTemplateGroup',array('name' => $map[$template->get('name')])); |
|
| 466 | + $templateGroup = $this->modx->getObject('modAccessPolicyTemplateGroup', array('name' => $map[$template->get('name')])); |
|
| 467 | 467 | if ($templateGroup) { |
| 468 | - $template->set('template_group',$templateGroup->get('id')); |
|
| 468 | + $template->set('template_group', $templateGroup->get('id')); |
|
| 469 | 469 | $success = $template->save(); |
| 470 | 470 | } else { |
| 471 | 471 | $this->modx->log(xPDO::LOG_LEVEL_ERROR, "Core AccessPolicyTemplateGroup {$map[$template->get('name')]} is missing!"); |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | { |
| 482 | 482 | // replaces: _build/resolvers/resolve.policies.php |
| 483 | 483 | |
| 484 | - $success= false; |
|
| 484 | + $success = false; |
|
| 485 | 485 | |
| 486 | 486 | /* map of Policy -> Template */ |
| 487 | 487 | $map = [ |
@@ -501,9 +501,9 @@ discard block |
||
| 501 | 501 | $policies = $this->modx->getCollection('modAccessPolicy'); |
| 502 | 502 | foreach ($policies as $policy) { |
| 503 | 503 | if (isset($map[$policy->get('name')])) { |
| 504 | - $template = $this->modx->getObject('modAccessPolicyTemplate',array('name' => $map[$policy->get('name')])); |
|
| 504 | + $template = $this->modx->getObject('modAccessPolicyTemplate', array('name' => $map[$policy->get('name')])); |
|
| 505 | 505 | if ($template) { |
| 506 | - $policy->set('template',$template->get('id')); |
|
| 506 | + $policy->set('template', $template->get('id')); |
|
| 507 | 507 | $success = $policy->save(); |
| 508 | 508 | } else { |
| 509 | 509 | $this->modx->log(xPDO::LOG_LEVEL_ERROR, "Core AccessPolicyTemplate {$map[$policy->get('name')]} is missing! Could not resolve AccessPolicy {$policy->get('name')}."); |
@@ -542,20 +542,20 @@ discard block |
||
| 542 | 542 | //$widgets = $this->modx->getCollection('modDashboardWidget'); |
| 543 | 543 | foreach ($map as $widgetName) { |
| 544 | 544 | /** @var \modDashboardWidget $widget */ |
| 545 | - $widget = $this->modx->getObject('modDashboardWidget',array( |
|
| 545 | + $widget = $this->modx->getObject('modDashboardWidget', array( |
|
| 546 | 546 | 'name' => $widgetName, |
| 547 | 547 | )); |
| 548 | 548 | if ($widget) { |
| 549 | 549 | /** @var \modDashboardWidgetPlacement $placement */ |
| 550 | - $placement = $this->modx->getObject('modDashboardWidgetPlacement',array( |
|
| 550 | + $placement = $this->modx->getObject('modDashboardWidgetPlacement', array( |
|
| 551 | 551 | 'widget' => $widget->get('id'), |
| 552 | 552 | 'dashboard' => $dashboard->get('id'), |
| 553 | 553 | )); |
| 554 | 554 | if (!$placement) { |
| 555 | 555 | $placement = $this->modx->newObject('modDashboardWidgetPlacement'); |
| 556 | - $placement->set('widget',$widget->get('id')); |
|
| 557 | - $placement->set('dashboard',$dashboard->get('id')); |
|
| 558 | - $placement->set('rank',$idx); |
|
| 556 | + $placement->set('widget', $widget->get('id')); |
|
| 557 | + $placement->set('dashboard', $dashboard->get('id')); |
|
| 558 | + $placement->set('rank', $idx); |
|
| 559 | 559 | $success = $placement->save(); |
| 560 | 560 | } else { |
| 561 | 561 | $success = true; |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | protected function upAttachActionFields() |
| 570 | 570 | { |
| 571 | 571 | // replaces: _build/resolvers/resolve.actionfields.php |
| 572 | - $success= true; |
|
| 572 | + $success = true; |
|
| 573 | 573 | |
| 574 | 574 | $xmlFile = MODX_CORE_PATH.'model/schema/modx.action.fields.schema.xml'; |
| 575 | 575 | if (!file_exists($xmlFile)) return false; |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | foreach ($action->tab as $tab) { |
| 591 | 591 | $tabName = (string)$tab['name']; |
| 592 | 592 | if ($tabName != 'modx-resource-content') { |
| 593 | - $tabObj = $this->modx->getObject('modActionField',array( |
|
| 593 | + $tabObj = $this->modx->getObject('modActionField', array( |
|
| 594 | 594 | 'action' => (string)$action['controller'], |
| 595 | 595 | 'name' => $tabName, |
| 596 | 596 | 'type' => 'tab', |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | |
| 613 | 613 | $fieldIdx = 0; |
| 614 | 614 | foreach ($tab->field as $field) { |
| 615 | - $fieldObj = $this->modx->getObject('modActionField',array( |
|
| 615 | + $fieldObj = $this->modx->getObject('modActionField', array( |
|
| 616 | 616 | 'action' => (string)$action['controller'], |
| 617 | 617 | 'name' => (string)$field['name'], |
| 618 | 618 | 'type' => 'field', |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | { |
| 645 | 645 | /** @var \modContext $webContext */ |
| 646 | 646 | $webContext = $this->modx->newObject('modContext'); |
| 647 | - $webContext->fromArray(array ( |
|
| 647 | + $webContext->fromArray(array( |
|
| 648 | 648 | 'key' => 'web', |
| 649 | 649 | 'name' => 'Website', |
| 650 | 650 | 'description' => 'The default front-end context for your web site.', |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | |
| 655 | 655 | /** @var \modContext $managerContext */ |
| 656 | 656 | $managerContext = $this->modx->newObject('modContext'); |
| 657 | - $managerContext->fromArray(array ( |
|
| 657 | + $managerContext->fromArray(array( |
|
| 658 | 658 | 'key' => 'mgr', |
| 659 | 659 | 'name' => 'Manager', |
| 660 | 660 | 'description' => 'The default manager or administration context for content management activity.', |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | protected function upInitSiteContent() |
| 666 | 666 | { |
| 667 | 667 | /* add base template and home resource */ |
| 668 | - $templateContent = file_get_contents($this->blender->getSeedsPath($this->getSeedsDir()) . 'base_template.tpl'); |
|
| 668 | + $templateContent = file_get_contents($this->blender->getSeedsPath($this->getSeedsDir()).'base_template.tpl'); |
|
| 669 | 669 | |
| 670 | 670 | $template_name = ($this->modx->lexicon('base_template') ? $this->modx->lexicon('base_template') : 'Base Template'); |
| 671 | 671 | /** @var \LCI\Blend\Blendable\Template $baseTemplate */ |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | /** @var modResource $resource */ |
| 694 | 694 | $resource = $blendResource->getResourceFromSeedKey('index'); |
| 695 | 695 | $resource->set('pagetitle', (!empty($this->modx->lexicon('home')) ? $this->modx->lexicon('home') : 'Home')); |
| 696 | - $resource->set('longtitle', ( !empty($this->modx->lexicon('congratulations')) ? $this->modx->lexicon('congratulations') : 'Congratulations')); |
|
| 696 | + $resource->set('longtitle', (!empty($this->modx->lexicon('congratulations')) ? $this->modx->lexicon('congratulations') : 'Congratulations')); |
|
| 697 | 697 | $resource->set('template', $template->get('id')); |
| 698 | 698 | |
| 699 | 699 | if ($resource->save()) { |
@@ -7,8 +7,8 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | $policies = array(); |
| 9 | 9 | |
| 10 | -$policies['1']= $xpdo->newObject('modAccessPolicy'); |
|
| 11 | -$policies['1']->fromArray(array ( |
|
| 10 | +$policies['1'] = $xpdo->newObject('modAccessPolicy'); |
|
| 11 | +$policies['1']->fromArray(array( |
|
| 12 | 12 | 'id' => 1, |
| 13 | 13 | 'name' => 'Resource', |
| 14 | 14 | 'description' => 'MODX Resource Policy with all attributes.', |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | 'lexicon' => 'permissions', |
| 19 | 19 | ), '', true, true); |
| 20 | 20 | |
| 21 | -$policies['2']= $xpdo->newObject('modAccessPolicy'); |
|
| 22 | -$policies['2']->fromArray(array ( |
|
| 21 | +$policies['2'] = $xpdo->newObject('modAccessPolicy'); |
|
| 22 | +$policies['2']->fromArray(array( |
|
| 23 | 23 | 'id' => 2, |
| 24 | 24 | 'name' => 'Administrator', |
| 25 | 25 | 'description' => 'Context administration policy with all permissions.', |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | 'lexicon' => 'permissions', |
| 30 | 30 | ), '', true, true); |
| 31 | 31 | |
| 32 | -$policies['3']= $xpdo->newObject('modAccessPolicy'); |
|
| 33 | -$policies['3']->fromArray(array ( |
|
| 32 | +$policies['3'] = $xpdo->newObject('modAccessPolicy'); |
|
| 33 | +$policies['3']->fromArray(array( |
|
| 34 | 34 | 'id' => 3, |
| 35 | 35 | 'name' => 'Load Only', |
| 36 | 36 | 'description' => 'A minimal policy with permission to load an object.', |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | 'lexicon' => 'permissions', |
| 41 | 41 | ), '', true, true); |
| 42 | 42 | |
| 43 | -$policies['4']= $xpdo->newObject('modAccessPolicy'); |
|
| 44 | -$policies['4']->fromArray(array ( |
|
| 43 | +$policies['4'] = $xpdo->newObject('modAccessPolicy'); |
|
| 44 | +$policies['4']->fromArray(array( |
|
| 45 | 45 | 'id' => 4, |
| 46 | 46 | 'name' => 'Load, List and View', |
| 47 | 47 | 'description' => 'Provides load, list and view permissions only.', |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | 'lexicon' => 'permissions', |
| 52 | 52 | ), '', true, true); |
| 53 | 53 | |
| 54 | -$policies['5']= $xpdo->newObject('modAccessPolicy'); |
|
| 55 | -$policies['5']->fromArray(array ( |
|
| 54 | +$policies['5'] = $xpdo->newObject('modAccessPolicy'); |
|
| 55 | +$policies['5']->fromArray(array( |
|
| 56 | 56 | 'id' => 5, |
| 57 | 57 | 'name' => 'Object', |
| 58 | 58 | 'description' => 'An Object policy with all permissions.', |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | 'lexicon' => 'permissions', |
| 63 | 63 | ), '', true, true); |
| 64 | 64 | |
| 65 | -$policies['6']= $xpdo->newObject('modAccessPolicy'); |
|
| 66 | -$policies['6']->fromArray(array ( |
|
| 65 | +$policies['6'] = $xpdo->newObject('modAccessPolicy'); |
|
| 66 | +$policies['6']->fromArray(array( |
|
| 67 | 67 | 'id' => 6, |
| 68 | 68 | 'name' => 'Element', |
| 69 | 69 | 'description' => 'MODX Element policy with all attributes.', |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | 'lexicon' => 'permissions', |
| 74 | 74 | ), '', true, true); |
| 75 | 75 | |
| 76 | -$policies['7']= $xpdo->newObject('modAccessPolicy'); |
|
| 77 | -$policies['7']->fromArray(array ( |
|
| 76 | +$policies['7'] = $xpdo->newObject('modAccessPolicy'); |
|
| 77 | +$policies['7']->fromArray(array( |
|
| 78 | 78 | 'id' => 7, |
| 79 | 79 | 'name' => 'Content Editor', |
| 80 | 80 | 'description' => 'Context administration policy with limited, content-editing related Permissions, but no publishing.', |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | 'lexicon' => 'permissions', |
| 85 | 85 | ), '', true, true); |
| 86 | 86 | |
| 87 | -$policies['8']= $xpdo->newObject('modAccessPolicy'); |
|
| 88 | -$policies['8']->fromArray(array ( |
|
| 87 | +$policies['8'] = $xpdo->newObject('modAccessPolicy'); |
|
| 88 | +$policies['8']->fromArray(array( |
|
| 89 | 89 | 'id' => 8, |
| 90 | 90 | 'name' => 'Media Source Admin', |
| 91 | 91 | 'description' => 'Media Source administration policy.', |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | 'lexicon' => 'permissions', |
| 96 | 96 | ), '', true, true); |
| 97 | 97 | |
| 98 | -$policies['9']= $xpdo->newObject('modAccessPolicy'); |
|
| 99 | -$policies['9']->fromArray(array ( |
|
| 98 | +$policies['9'] = $xpdo->newObject('modAccessPolicy'); |
|
| 99 | +$policies['9']->fromArray(array( |
|
| 100 | 100 | 'id' => 9, |
| 101 | 101 | 'name' => 'Media Source User', |
| 102 | 102 | 'description' => 'Media Source user policy, with basic viewing and using - but no editing - of Media Sources.', |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | 'lexicon' => 'permissions', |
| 107 | 107 | ), '', true, true); |
| 108 | 108 | |
| 109 | -$policies['10']= $xpdo->newObject('modAccessPolicy'); |
|
| 110 | -$policies['10']->fromArray(array ( |
|
| 109 | +$policies['10'] = $xpdo->newObject('modAccessPolicy'); |
|
| 110 | +$policies['10']->fromArray(array( |
|
| 111 | 111 | 'id' => 10, |
| 112 | 112 | 'name' => 'Developer', |
| 113 | 113 | 'description' => 'Context administration policy with most Permissions except Administrator and Security functions.', |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | 'lexicon' => 'permissions', |
| 118 | 118 | ), '', true, true); |
| 119 | 119 | |
| 120 | -$policies['11']= $xpdo->newObject('modAccessPolicy'); |
|
| 121 | -$policies['11']->fromArray(array ( |
|
| 120 | +$policies['11'] = $xpdo->newObject('modAccessPolicy'); |
|
| 121 | +$policies['11']->fromArray(array( |
|
| 122 | 122 | 'id' => 11, |
| 123 | 123 | 'name' => 'Context', |
| 124 | 124 | 'description' => 'A standard Context policy that you can apply when creating Context ACLs for basic read/write and view_unpublished access within a Context.', |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | 'lexicon' => 'permissions', |
| 129 | 129 | ), '', true, true); |
| 130 | 130 | |
| 131 | -$policies['12']= $xpdo->newObject('modAccessPolicy'); |
|
| 132 | -$policies['12']->fromArray(array ( |
|
| 131 | +$policies['12'] = $xpdo->newObject('modAccessPolicy'); |
|
| 132 | +$policies['12']->fromArray(array( |
|
| 133 | 133 | 'id' => 12, |
| 134 | 134 | 'name' => 'Hidden Namespace', |
| 135 | 135 | 'description' => 'Hidden Namespace policy, will not show Namespace in lists.', |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | -$collection['1']= $xpdo->newObject('modUserGroupRole'); |
|
| 3 | -$collection['1']->fromArray(array ( |
|
| 2 | +$collection['1'] = $xpdo->newObject('modUserGroupRole'); |
|
| 3 | +$collection['1']->fromArray(array( |
|
| 4 | 4 | 'id' => 1, |
| 5 | 5 | 'name' => 'Member', |
| 6 | 6 | 'description' => 'NULL', |
| 7 | 7 | 'authority' => 9999, |
| 8 | 8 | ), '', true, true); |
| 9 | -$collection['2']= $xpdo->newObject('modUserGroupRole'); |
|
| 10 | -$collection['2']->fromArray(array ( |
|
| 9 | +$collection['2'] = $xpdo->newObject('modUserGroupRole'); |
|
| 10 | +$collection['2']->fromArray(array( |
|
| 11 | 11 | 'id' => 2, |
| 12 | 12 | 'name' => 'Super User', |
| 13 | 13 | 'description' => 'NULL', |