@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | -$xpdo_meta_map = array ( |
|
| 2 | +$xpdo_meta_map = array( |
|
| 3 | 3 | 'version' => '3.0', |
| 4 | 4 | 'namespace' => 'LCI\\Blend\\Model\\xPDO', |
| 5 | 5 | 'class_map' => |
| 6 | - array ( |
|
| 6 | + array( |
|
| 7 | 7 | 'xPDO\\Om\\xPDOSimpleObject' => |
| 8 | - array ( |
|
| 8 | + array( |
|
| 9 | 9 | 0 => 'LCI\\Blend\\Model\\xPDO\\BlendMigrations', |
| 10 | 10 | ), |
| 11 | 11 | ), |
@@ -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 | |
@@ -244,8 +244,7 @@ |
||
| 244 | 244 | |
| 245 | 245 | if ($this->interactive) { |
| 246 | 246 | continue; |
| 247 | - } |
|
| 248 | - else { |
|
| 247 | + } else { |
|
| 249 | 248 | return true; |
| 250 | 249 | } |
| 251 | 250 | } |
@@ -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 |
@@ -81,7 +81,7 @@ |
||
| 81 | 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 | 87 | } elseif ( $object == 'x' || $object == 'systemSettings' ) { |
@@ -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); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @param UserInteractionHandler $userInteractionHandler |
| 79 | 79 | * @param array $config |
| 80 | 80 | */ |
| 81 | - public function __construct(modX $modx, UserInteractionHandler $userInteractionHandler, $config=[]) |
|
| 81 | + public function __construct(modX $modx, UserInteractionHandler $userInteractionHandler, $config = []) |
|
| 82 | 82 | { |
| 83 | 83 | $this->modx = $modx; |
| 84 | 84 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | $this->userInteractionHandler = $userInteractionHandler; |
| 88 | 88 | |
| 89 | - if (version_compare($this->modx_version_info['full_version'], '3.0') >= 0 ) { |
|
| 89 | + if (version_compare($this->modx_version_info['full_version'], '3.0') >= 0) { |
|
| 90 | 90 | $this->xpdo_version = 3; |
| 91 | 91 | $this->blend_class_object = 'LCI\\Blend\\Model\\xPDO\\BlendMigrations'; |
| 92 | 92 | $this->blend_package = 'LCI\\Blend\\Model\\xPDO'; |
@@ -101,10 +101,10 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $this->config = [ |
| 104 | - 'migration_templates_path' => __DIR__. '/Migrations/templates/', |
|
| 104 | + 'migration_templates_path' => __DIR__.'/Migrations/templates/', |
|
| 105 | 105 | 'migrations_path' => $blend_modx_migration_dir.'database/migrations/', |
| 106 | 106 | 'seeds_path' => $blend_modx_migration_dir.'database/seeds/', |
| 107 | - 'model_dir' => __DIR__ . ($this->xpdo_version >= 3 ? '/' : '/xpdo2/'), |
|
| 107 | + 'model_dir' => __DIR__.($this->xpdo_version >= 3 ? '/' : '/xpdo2/'), |
|
| 108 | 108 | 'extras' => [ |
| 109 | 109 | 'tagger' => false |
| 110 | 110 | ] |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $this->seeds_dir = date('Y_m_d_His'); |
| 115 | 115 | |
| 116 | - $tagger_path = $this->modx->getOption('tagger.core_path', null, $this->modx->getOption('core_path') . 'components/tagger/') . 'model/tagger/'; |
|
| 116 | + $tagger_path = $this->modx->getOption('tagger.core_path', null, $this->modx->getOption('core_path').'components/tagger/').'model/tagger/'; |
|
| 117 | 117 | if (is_dir($tagger_path)) { |
| 118 | 118 | $this->config['extras']['tagger'] = true; |
| 119 | 119 | /** @var \Tagger $tagger */ |
@@ -175,11 +175,11 @@ discard block |
||
| 175 | 175 | * @param null $directory_key |
| 176 | 176 | * @return string |
| 177 | 177 | */ |
| 178 | - public function getSeedsPath($directory_key=null) |
|
| 178 | + public function getSeedsPath($directory_key = null) |
|
| 179 | 179 | { |
| 180 | 180 | $seed_path = $this->config['seeds_path']; |
| 181 | 181 | if (!empty($directory_key)) { |
| 182 | - $seed_path .= trim($directory_key, '/') . DIRECTORY_SEPARATOR; |
|
| 182 | + $seed_path .= trim($directory_key, '/').DIRECTORY_SEPARATOR; |
|
| 183 | 183 | } |
| 184 | 184 | return $seed_path; |
| 185 | 185 | } |
@@ -201,21 +201,21 @@ discard block |
||
| 201 | 201 | * |
| 202 | 202 | * @return array ~ array of \BlendMigrations |
| 203 | 203 | */ |
| 204 | - public function getBlendMigrationCollection($reload=false, $dir='ASC', $count=0, $id=0, $name=null) |
|
| 204 | + public function getBlendMigrationCollection($reload = false, $dir = 'ASC', $count = 0, $id = 0, $name = null) |
|
| 205 | 205 | { |
| 206 | 206 | if (!$this->blendMigrations || $reload) { |
| 207 | 207 | $blendMigrations = []; |
| 208 | 208 | |
| 209 | 209 | /** @var \xPDOQuery $query */ |
| 210 | 210 | $query = $this->modx->newQuery($this->blend_class_object); |
| 211 | - if ($id > 0 ) { |
|
| 211 | + if ($id > 0) { |
|
| 212 | 212 | $query->where(['id' => $id]); |
| 213 | 213 | } elseif (!empty($name)) { |
| 214 | 214 | $query->where(['name' => $name]); |
| 215 | 215 | } |
| 216 | 216 | // @TODO need a ran sequence column to better order of down |
| 217 | 217 | $query->sortBy('name', $dir); |
| 218 | - if ($count > 0 ) { |
|
| 218 | + if ($count > 0) { |
|
| 219 | 219 | $query->limit($count); |
| 220 | 220 | } |
| 221 | 221 | $query->prepare(); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | return $this->tagger; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - public function getCategoryMap($refresh=false) |
|
| 242 | + public function getCategoryMap($refresh = false) |
|
| 243 | 243 | { |
| 244 | 244 | if (count($this->category_map) == 0 || $refresh) { |
| 245 | 245 | $this->category_map = [ |
@@ -284,14 +284,14 @@ discard block |
||
| 284 | 284 | public function getBlendableChunk($name) |
| 285 | 285 | { |
| 286 | 286 | /** @var \LCI\Blend\Blendable\Chunk $chunk */ |
| 287 | - $chunk = new Chunk($this->modx, $this, $name); |
|
| 287 | + $chunk = new Chunk($this->modx, $this, $name); |
|
| 288 | 288 | return $chunk->setSeedsDir($this->getSeedsDir()); |
| 289 | 289 | } |
| 290 | 290 | /** |
| 291 | 291 | * @param array $chunks |
| 292 | 292 | * @param string $seeds_dir |
| 293 | 293 | */ |
| 294 | - public function blendManyChunks($chunks=[], $seeds_dir='') |
|
| 294 | + public function blendManyChunks($chunks = [], $seeds_dir = '') |
|
| 295 | 295 | { |
| 296 | 296 | // will update if element does exist or create new |
| 297 | 297 | foreach ($chunks as $seed_key) { |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | if ($blendChunk->blendFromSeed($seed_key)) { |
| 304 | 304 | $this->out($seed_key.' has been blended into ID: '); |
| 305 | 305 | |
| 306 | - } elseif($blendChunk->isExists()) { |
|
| 306 | + } elseif ($blendChunk->isExists()) { |
|
| 307 | 307 | // @TODO prompt Do you want to blend Y/N/Compare |
| 308 | 308 | $this->out($seed_key.' chunk already exists', true); |
| 309 | 309 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | * @param array $chunks |
| 322 | 322 | * @param string $seeds_dir |
| 323 | 323 | */ |
| 324 | - public function revertBlendManyChunks($chunks=[], $seeds_dir='') |
|
| 324 | + public function revertBlendManyChunks($chunks = [], $seeds_dir = '') |
|
| 325 | 325 | { |
| 326 | 326 | // will update if system setting does exist or create new |
| 327 | 327 | foreach ($chunks as $seed_key) { |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $blendChunk->setSeedsDir($seeds_dir); |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if ( $blendChunk->revertBlend() ) { |
|
| 334 | + if ($blendChunk->revertBlend()) { |
|
| 335 | 335 | $this->out($blendChunk->getName().' chunk has been reverted to '.$seeds_dir); |
| 336 | 336 | |
| 337 | 337 | } else { |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | public function getBlendableContext($key) |
| 349 | 349 | { |
| 350 | 350 | /** @var \LCI\Blend\Blendable\Context $chunk */ |
| 351 | - $context = new Context($this->modx, $this, $key); |
|
| 351 | + $context = new Context($this->modx, $this, $key); |
|
| 352 | 352 | return $context->setSeedsDir($this->getSeedsDir()); |
| 353 | 353 | } |
| 354 | 354 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | * @param array $contexts |
| 357 | 357 | * @param string $seeds_dir |
| 358 | 358 | */ |
| 359 | - public function blendManyContexts($contexts=[], $seeds_dir='') |
|
| 359 | + public function blendManyContexts($contexts = [], $seeds_dir = '') |
|
| 360 | 360 | { |
| 361 | 361 | // will update if element does exist or create new |
| 362 | 362 | foreach ($contexts as $seed_key) { |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | if ($blendContext->blendFromSeed($seed_key)) { |
| 369 | 369 | $this->out($seed_key.' has been blended '); |
| 370 | 370 | |
| 371 | - } elseif($blendContext->isExists()) { |
|
| 371 | + } elseif ($blendContext->isExists()) { |
|
| 372 | 372 | // @TODO prompt Do you want to blend Y/N/Compare |
| 373 | 373 | $this->out($seed_key.' chunk already exists', true); |
| 374 | 374 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | * @param array $contexts |
| 387 | 387 | * @param string $seeds_dir |
| 388 | 388 | */ |
| 389 | - public function revertBlendManyContexts($contexts=[], $seeds_dir='') |
|
| 389 | + public function revertBlendManyContexts($contexts = [], $seeds_dir = '') |
|
| 390 | 390 | { |
| 391 | 391 | // will update if system setting does exist or create new |
| 392 | 392 | foreach ($contexts as $seed_key) { |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | $blendContext->setSeedsDir($seeds_dir); |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - if ( $blendContext->revertBlend() ) { |
|
| 399 | + if ($blendContext->revertBlend()) { |
|
| 400 | 400 | $this->out($blendContext->getFieldKey().' context has been reverted to '.$seeds_dir); |
| 401 | 401 | |
| 402 | 402 | } else { |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | public function getBlendableMediaSource($name) |
| 414 | 414 | { |
| 415 | 415 | /** @var \LCI\Blend\Blendable\MediaSource $mediaSource */ |
| 416 | - $mediaSource = new MediaSource($this->modx, $this, $name); |
|
| 416 | + $mediaSource = new MediaSource($this->modx, $this, $name); |
|
| 417 | 417 | return $mediaSource |
| 418 | 418 | ->setFieldName($name) |
| 419 | 419 | ->setSeedsDir($this->getSeedsDir()); |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | * @param array $media_sources |
| 424 | 424 | * @param string $seeds_dir |
| 425 | 425 | */ |
| 426 | - public function blendManyMediaSources($media_sources=[], $seeds_dir='') |
|
| 426 | + public function blendManyMediaSources($media_sources = [], $seeds_dir = '') |
|
| 427 | 427 | { |
| 428 | 428 | // will update if element does exist or create new |
| 429 | 429 | foreach ($media_sources as $seed_key) { |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | if ($blendMediaSource->blendFromSeed($seed_key)) { |
| 436 | 436 | $this->out($seed_key.' has been blended into ID: '); |
| 437 | 437 | |
| 438 | - } elseif($blendMediaSource->isExists()) { |
|
| 438 | + } elseif ($blendMediaSource->isExists()) { |
|
| 439 | 439 | // @TODO add Compare as option |
| 440 | 440 | $this->out($seed_key.' media source already exists', true); |
| 441 | 441 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | * @param array $media_sources |
| 454 | 454 | * @param string $seeds_dir |
| 455 | 455 | */ |
| 456 | - public function revertBlendManyMediaSources($media_sources=[], $seeds_dir='') |
|
| 456 | + public function revertBlendManyMediaSources($media_sources = [], $seeds_dir = '') |
|
| 457 | 457 | { |
| 458 | 458 | // will update if system setting does exist or create new |
| 459 | 459 | foreach ($media_sources as $seed_key) { |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | $blendMediaSource->setSeedsDir($seeds_dir); |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | - if ( $blendMediaSource->revertBlend() ) { |
|
| 466 | + if ($blendMediaSource->revertBlend()) { |
|
| 467 | 467 | $this->out($blendMediaSource->getFieldName().' media source has been reverted to '.$seeds_dir); |
| 468 | 468 | |
| 469 | 469 | } else { |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | public function getBlendablePlugin($name) |
| 481 | 481 | { |
| 482 | 482 | /** @var \LCI\Blend\Blendable\Plugin $plugin */ |
| 483 | - $plugin = new Plugin($this->modx, $this, $name); |
|
| 483 | + $plugin = new Plugin($this->modx, $this, $name); |
|
| 484 | 484 | return $plugin->setSeedsDir($this->getSeedsDir()); |
| 485 | 485 | } |
| 486 | 486 | |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | * @param array $plugins |
| 489 | 489 | * @param string $seeds_dir |
| 490 | 490 | */ |
| 491 | - public function blendManyPlugins($plugins=[], $seeds_dir='') |
|
| 491 | + public function blendManyPlugins($plugins = [], $seeds_dir = '') |
|
| 492 | 492 | { |
| 493 | 493 | // will update if element does exist or create new |
| 494 | 494 | foreach ($plugins as $seed_key) { |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | if ($blendPlugin->blendFromSeed($seed_key)) { |
| 501 | 501 | $this->out($seed_key.' has been blended into ID: '); |
| 502 | 502 | |
| 503 | - } elseif($blendPlugin->isExists()) { |
|
| 503 | + } elseif ($blendPlugin->isExists()) { |
|
| 504 | 504 | // @TODO prompt Do you want to blend Y/N/Compare |
| 505 | 505 | $this->out($seed_key.' plugin already exists', true); |
| 506 | 506 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | * @param array $plugins |
| 519 | 519 | * @param string $seeds_dir |
| 520 | 520 | */ |
| 521 | - public function revertBlendManyPlugins($plugins=[], $seeds_dir='') |
|
| 521 | + public function revertBlendManyPlugins($plugins = [], $seeds_dir = '') |
|
| 522 | 522 | { |
| 523 | 523 | // will update if system setting does exist or create new |
| 524 | 524 | foreach ($plugins as $seed_key) { |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | $blendPlugin->setSeedsDir($seeds_dir); |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | - if ( $blendPlugin->revertBlend() ) { |
|
| 531 | + if ($blendPlugin->revertBlend()) { |
|
| 532 | 532 | $this->out($blendPlugin->getFieldName().' plugin has been reverted to '.$seeds_dir); |
| 533 | 533 | |
| 534 | 534 | } else { |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | public function getBlendableSnippet($name) |
| 546 | 546 | { |
| 547 | 547 | /** @var Snippet $snippet */ |
| 548 | - $snippet = new Snippet($this->modx, $this, $name); |
|
| 548 | + $snippet = new Snippet($this->modx, $this, $name); |
|
| 549 | 549 | return $snippet->setSeedsDir($this->getSeedsDir()); |
| 550 | 550 | } |
| 551 | 551 | |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | * @param array $snippets |
| 554 | 554 | * @param string $seeds_dir |
| 555 | 555 | */ |
| 556 | - public function blendManySnippets($snippets=[], $seeds_dir='') |
|
| 556 | + public function blendManySnippets($snippets = [], $seeds_dir = '') |
|
| 557 | 557 | { |
| 558 | 558 | // will update if element does exist or create new |
| 559 | 559 | foreach ($snippets as $seed_key) { |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | if ($blendSnippet->blendFromSeed($seed_key)) { |
| 566 | 566 | $this->out($seed_key.' has been blended'); |
| 567 | 567 | |
| 568 | - } elseif($blendSnippet->isExists()) { |
|
| 568 | + } elseif ($blendSnippet->isExists()) { |
|
| 569 | 569 | // @TODO prompt Do you want to blend Y/N/Compare |
| 570 | 570 | $this->out($seed_key.' snippet already exists', true); |
| 571 | 571 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | * @param array $snippets |
| 583 | 583 | * @param string $seeds_dir |
| 584 | 584 | */ |
| 585 | - public function revertBlendManySnippets($snippets=[], $seeds_dir='') |
|
| 585 | + public function revertBlendManySnippets($snippets = [], $seeds_dir = '') |
|
| 586 | 586 | { |
| 587 | 587 | // will update if system setting does exist or create new |
| 588 | 588 | foreach ($snippets as $seed_key) { |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | $blendSnippet->setSeedsDir($seeds_dir); |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | - if ( $blendSnippet->revertBlend() ) { |
|
| 595 | + if ($blendSnippet->revertBlend()) { |
|
| 596 | 596 | $this->out($blendSnippet->getFieldName().' snippet has been reverted to '.$seeds_dir); |
| 597 | 597 | |
| 598 | 598 | } else { |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | public function getBlendableTemplate($name) |
| 610 | 610 | { |
| 611 | 611 | /** @var \LCI\Blend\Blendable\Template $template */ |
| 612 | - $template = new Template($this->modx, $this, $name); |
|
| 612 | + $template = new Template($this->modx, $this, $name); |
|
| 613 | 613 | return $template->setSeedsDir($this->seeds_dir); |
| 614 | 614 | } |
| 615 | 615 | |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | * @param string $seeds_dir |
| 619 | 619 | * @param bool $overwrite |
| 620 | 620 | */ |
| 621 | - public function blendManyTemplates($templates=[], $seeds_dir='', $overwrite=false) |
|
| 621 | + public function blendManyTemplates($templates = [], $seeds_dir = '', $overwrite = false) |
|
| 622 | 622 | { |
| 623 | 623 | // will update if template does exist or create new |
| 624 | 624 | foreach ($templates as $seed_key) { |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | if ($blendTemplate->blendFromSeed($seed_key, $overwrite)) { |
| 632 | 632 | $this->out($seed_key.' has been blended'); |
| 633 | 633 | |
| 634 | - } elseif($blendTemplate->isExists()) { |
|
| 634 | + } elseif ($blendTemplate->isExists()) { |
|
| 635 | 635 | $this->out($seed_key.' template already exists', true); |
| 636 | 636 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
| 637 | 637 | if ($blendTemplate->blendFromSeed($seed_key, true)) { |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | * @param array $templates |
| 649 | 649 | * @param string $seeds_dir |
| 650 | 650 | */ |
| 651 | - public function revertBlendManyTemplates($templates=[], $seeds_dir='') |
|
| 651 | + public function revertBlendManyTemplates($templates = [], $seeds_dir = '') |
|
| 652 | 652 | { |
| 653 | 653 | // will update if system setting does exist or create new |
| 654 | 654 | foreach ($templates as $seed_key) { |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | $blendTemplate->setSeedsDir($seeds_dir); |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | - if ( $blendTemplate->revertBlend() ) { |
|
| 661 | + if ($blendTemplate->revertBlend()) { |
|
| 662 | 662 | $this->out($blendTemplate->getFieldName().' template has been reverted to '.$seeds_dir); |
| 663 | 663 | |
| 664 | 664 | } else { |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | public function getBlendableTemplateVariable($name) |
| 676 | 676 | { |
| 677 | 677 | /** @var \LCI\Blend\Blendable\TemplateVariable $tv */ |
| 678 | - $tv = new TemplateVariable($this->modx, $this, $name); |
|
| 678 | + $tv = new TemplateVariable($this->modx, $this, $name); |
|
| 679 | 679 | return $tv->setSeedsDir($this->seeds_dir); |
| 680 | 680 | } |
| 681 | 681 | |
@@ -684,10 +684,10 @@ discard block |
||
| 684 | 684 | * @param string $context |
| 685 | 685 | * @return \LCI\Blend\Blendable\Resource |
| 686 | 686 | */ |
| 687 | - public function getBlendableResource($alias, $context='web') |
|
| 687 | + public function getBlendableResource($alias, $context = 'web') |
|
| 688 | 688 | { |
| 689 | 689 | /** @var \LCI\Blend\Blendable\Resource $resource */ |
| 690 | - $resource = new Resource($this->modx, $this, $alias, $context); |
|
| 690 | + $resource = new Resource($this->modx, $this, $alias, $context); |
|
| 691 | 691 | return $resource |
| 692 | 692 | ->setSeedsDir($this->getSeedsDir()); |
| 693 | 693 | } |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | * |
| 699 | 699 | * @return bool |
| 700 | 700 | */ |
| 701 | - public function blendManyResources($resources=[], $seeds_dir='', $overwrite=false) |
|
| 701 | + public function blendManyResources($resources = [], $seeds_dir = '', $overwrite = false) |
|
| 702 | 702 | { |
| 703 | 703 | $saved = true; |
| 704 | 704 | // will update if resource does exist or create new |
@@ -712,19 +712,19 @@ discard block |
||
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | if ($blendResource->blendFromSeed($seed_key, $overwrite)) { |
| 715 | - $this->out($seed_key . ' has been blended into ID: '); |
|
| 715 | + $this->out($seed_key.' has been blended into ID: '); |
|
| 716 | 716 | |
| 717 | 717 | } elseif ($blendResource->isExists()) { |
| 718 | 718 | // @TODO prompt Do you want to blend Y/N/Compare |
| 719 | - $this->out($seed_key . ' already exists', true); |
|
| 719 | + $this->out($seed_key.' already exists', true); |
|
| 720 | 720 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
| 721 | 721 | if ($blendResource->blendFromSeed($seed_key, true)) { |
| 722 | - $this->out($seed_key . ' has been blended into ID: '); |
|
| 722 | + $this->out($seed_key.' has been blended into ID: '); |
|
| 723 | 723 | } |
| 724 | 724 | } |
| 725 | 725 | } else { |
| 726 | - $this->out('There was an error saving ' . $seed_key, true); |
|
| 727 | - echo 'There was an error saving ' . $seed_key; exit(); |
|
| 726 | + $this->out('There was an error saving '.$seed_key, true); |
|
| 727 | + echo 'There was an error saving '.$seed_key; exit(); |
|
| 728 | 728 | $saved = false; |
| 729 | 729 | } |
| 730 | 730 | } |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | * |
| 741 | 741 | * @return bool |
| 742 | 742 | */ |
| 743 | - public function revertBlendManyResources($resources=[], $seeds_dir='', $overwrite=false) |
|
| 743 | + public function revertBlendManyResources($resources = [], $seeds_dir = '', $overwrite = false) |
|
| 744 | 744 | { |
| 745 | 745 | $saved = true; |
| 746 | 746 | // will update if resource does exist or create new |
@@ -753,10 +753,10 @@ discard block |
||
| 753 | 753 | $blendResource->setSeedsDir($seeds_dir); |
| 754 | 754 | } |
| 755 | 755 | if ($blendResource->revertBlend()) { |
| 756 | - $this->out($seed_key . ' has been reverted '); |
|
| 756 | + $this->out($seed_key.' has been reverted '); |
|
| 757 | 757 | |
| 758 | 758 | } else { |
| 759 | - $this->out('There was an error reverting resource ' . $seed_key, true); |
|
| 759 | + $this->out('There was an error reverting resource '.$seed_key, true); |
|
| 760 | 760 | $saved = false; |
| 761 | 761 | } |
| 762 | 762 | } |
@@ -769,10 +769,10 @@ discard block |
||
| 769 | 769 | * @param string $key |
| 770 | 770 | * @return \LCI\Blend\Blendable\SystemSetting |
| 771 | 771 | */ |
| 772 | - public function getBlendableSystemSetting($key='') |
|
| 772 | + public function getBlendableSystemSetting($key = '') |
|
| 773 | 773 | { |
| 774 | 774 | /** @var \LCI\Blend\Blendable\SystemSetting $systemSetting */ |
| 775 | - $systemSetting = new SystemSetting($this->modx, $this, $key); |
|
| 775 | + $systemSetting = new SystemSetting($this->modx, $this, $key); |
|
| 776 | 776 | return $systemSetting->setSeedsDir($this->getSeedsDir()); |
| 777 | 777 | } |
| 778 | 778 | |
@@ -782,7 +782,7 @@ discard block |
||
| 782 | 782 | * |
| 783 | 783 | * @return bool |
| 784 | 784 | */ |
| 785 | - public function blendManySystemSettings($settings=[], $seeds_dir='') |
|
| 785 | + public function blendManySystemSettings($settings = [], $seeds_dir = '') |
|
| 786 | 786 | { |
| 787 | 787 | $success = true; |
| 788 | 788 | // will update if system setting does exist or create new |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | * |
| 828 | 828 | * @return bool |
| 829 | 829 | */ |
| 830 | - public function revertBlendManySystemSettings($settings=[], $seeds_dir='') |
|
| 830 | + public function revertBlendManySystemSettings($settings = [], $seeds_dir = '') |
|
| 831 | 831 | { |
| 832 | 832 | $success = true; |
| 833 | 833 | // will update if system setting does exist or create new |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | $systemSetting->setSeedsDir($seeds_dir); |
| 858 | 858 | } |
| 859 | 859 | |
| 860 | - if ( $systemSetting->revertBlend() ) { |
|
| 860 | + if ($systemSetting->revertBlend()) { |
|
| 861 | 861 | $this->out($systemSetting->getFieldName().' setting has been reverted to '.$seeds_dir); |
| 862 | 862 | |
| 863 | 863 | } else { |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | * |
| 876 | 876 | * @return mixed |
| 877 | 877 | */ |
| 878 | - protected function prompt($question, $default='') |
|
| 878 | + protected function prompt($question, $default = '') |
|
| 879 | 879 | { |
| 880 | 880 | return $this->userInteractionHandler->promptInput($question, $default); |
| 881 | 881 | } |
@@ -885,7 +885,7 @@ discard block |
||
| 885 | 885 | * @param bool $default |
| 886 | 886 | * @return bool |
| 887 | 887 | */ |
| 888 | - protected function promptConfirm($question, $default=true) |
|
| 888 | + protected function promptConfirm($question, $default = true) |
|
| 889 | 889 | { |
| 890 | 890 | return $this->userInteractionHandler->promptConfirm($question, $default); |
| 891 | 891 | } |
@@ -896,7 +896,7 @@ discard block |
||
| 896 | 896 | * @param array $options ~ ex: ['Option1' => 'value', 'Option2' => 'value2', ...] |
| 897 | 897 | * @return mixed ~ selected value |
| 898 | 898 | */ |
| 899 | - protected function promptSelectOneOption($question, $default, $options=[]) |
|
| 899 | + protected function promptSelectOneOption($question, $default, $options = []) |
|
| 900 | 900 | { |
| 901 | 901 | return $this->userInteractionHandler->promptSelectOneOption($question, $default, $options); |
| 902 | 902 | } |
@@ -907,7 +907,7 @@ discard block |
||
| 907 | 907 | * @param array $options ~ ex: ['Option1' => 'value', 'Option2' => 'value2', ...] |
| 908 | 908 | * @return array ~ array of selected values |
| 909 | 909 | */ |
| 910 | - protected function promptSelectMultipleOptions($question, $default, $options=[]) |
|
| 910 | + protected function promptSelectMultipleOptions($question, $default, $options = []) |
|
| 911 | 911 | { |
| 912 | 912 | return $this->userInteractionHandler->promptSelectMultipleOptions($question, $default, $options); |
| 913 | 913 | } |
@@ -916,7 +916,7 @@ discard block |
||
| 916 | 916 | * @param string $message |
| 917 | 917 | * @param bool $error |
| 918 | 918 | */ |
| 919 | - public function out($message, $error=false) |
|
| 919 | + public function out($message, $error = false) |
|
| 920 | 920 | { |
| 921 | 921 | if ($error) { |
| 922 | 922 | $this->userInteractionHandler->tellUser($message, userInteractionHandler::MASSAGE_ERROR); |
@@ -940,7 +940,7 @@ discard block |
||
| 940 | 940 | * |
| 941 | 941 | * @return bool |
| 942 | 942 | */ |
| 943 | - public function createBlankMigrationClassFile($name, $server_type='master') |
|
| 943 | + public function createBlankMigrationClassFile($name, $server_type = 'master') |
|
| 944 | 944 | { |
| 945 | 945 | return $this->writeMigrationClassFile('blank', [], $server_type, $name); |
| 946 | 946 | } |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | * |
| 954 | 954 | * @return array |
| 955 | 955 | */ |
| 956 | - public function makeChunkSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
| 956 | + public function makeChunkSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
| 957 | 957 | { |
| 958 | 958 | $keys = []; |
| 959 | 959 | $collection = $this->modx->getCollection('modChunk', $criteria); |
@@ -982,7 +982,7 @@ discard block |
||
| 982 | 982 | * |
| 983 | 983 | * @return array |
| 984 | 984 | */ |
| 985 | - public function makeContextSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
| 985 | + public function makeContextSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
| 986 | 986 | { |
| 987 | 987 | $keys = []; |
| 988 | 988 | $collection = $this->modx->getCollection('modContext', $criteria); |
@@ -1011,7 +1011,7 @@ discard block |
||
| 1011 | 1011 | * |
| 1012 | 1012 | * @return array |
| 1013 | 1013 | */ |
| 1014 | - public function makeMediaSourceSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
| 1014 | + public function makeMediaSourceSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
| 1015 | 1015 | { |
| 1016 | 1016 | $keys = []; |
| 1017 | 1017 | $collection = $this->modx->getCollection('modMediaSource', $criteria); |
@@ -1040,7 +1040,7 @@ discard block |
||
| 1040 | 1040 | * |
| 1041 | 1041 | * @return array |
| 1042 | 1042 | */ |
| 1043 | - public function makePluginSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
| 1043 | + public function makePluginSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
| 1044 | 1044 | { |
| 1045 | 1045 | $keys = []; |
| 1046 | 1046 | $collection = $this->modx->getCollection('modPlugin', $criteria); |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | * |
| 1070 | 1070 | * @return array |
| 1071 | 1071 | */ |
| 1072 | - public function makeResourceSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
| 1072 | + public function makeResourceSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
| 1073 | 1073 | { |
| 1074 | 1074 | $keys = [ |
| 1075 | 1075 | 'web' => [] |
@@ -1104,7 +1104,7 @@ discard block |
||
| 1104 | 1104 | * |
| 1105 | 1105 | * @return array |
| 1106 | 1106 | */ |
| 1107 | - public function makeSnippetSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
| 1107 | + public function makeSnippetSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
| 1108 | 1108 | { |
| 1109 | 1109 | $keys = []; |
| 1110 | 1110 | $collection = $this->modx->getCollection('modSnippet', $criteria); |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | * |
| 1134 | 1134 | * @return array |
| 1135 | 1135 | */ |
| 1136 | - public function makeSystemSettingSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
| 1136 | + public function makeSystemSettingSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
| 1137 | 1137 | { |
| 1138 | 1138 | $collection = $this->modx->getCollection('modSystemSetting', $criteria); |
| 1139 | 1139 | |
@@ -1166,7 +1166,7 @@ discard block |
||
| 1166 | 1166 | * |
| 1167 | 1167 | * @return array |
| 1168 | 1168 | */ |
| 1169 | - public function makeTemplateSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
| 1169 | + public function makeTemplateSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
| 1170 | 1170 | { |
| 1171 | 1171 | $keys = []; |
| 1172 | 1172 | $collection = $this->modx->getCollection('modTemplate', $criteria); |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | * @param string $server_type |
| 1192 | 1192 | * @param null|string $name |
| 1193 | 1193 | */ |
| 1194 | - public function makeSiteSeed($server_type='master', $name=null) |
|
| 1194 | + public function makeSiteSeed($server_type = 'master', $name = null) |
|
| 1195 | 1195 | { |
| 1196 | 1196 | $site_data = [ |
| 1197 | 1197 | 'mediaSources' => $this->makeMediaSourceSeeds(null, $server_type, $name, false), |
@@ -1211,7 +1211,7 @@ discard block |
||
| 1211 | 1211 | * @param string $method |
| 1212 | 1212 | * @param bool $prompt |
| 1213 | 1213 | */ |
| 1214 | - public function install($method='up', $prompt=false) |
|
| 1214 | + public function install($method = 'up', $prompt = false) |
|
| 1215 | 1215 | { |
| 1216 | 1216 | $migration_name = 'install_blender'; |
| 1217 | 1217 | $custom_migration_dir = __DIR__.'/Migrations/Blend/'; |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | * @param string $method |
| 1227 | 1227 | * @param bool $prompt |
| 1228 | 1228 | */ |
| 1229 | - protected function runInstallMigration($migration_name, $custom_migration_path=null, $seed_root_path=null, $method='up', $prompt=false) |
|
| 1229 | + protected function runInstallMigration($migration_name, $custom_migration_path = null, $seed_root_path = null, $method = 'up', $prompt = false) |
|
| 1230 | 1230 | { |
| 1231 | 1231 | // new blender for each instance |
| 1232 | 1232 | $config = $this->config; |
@@ -1261,10 +1261,10 @@ discard block |
||
| 1261 | 1261 | $migration->set('status', 'up_complete'); |
| 1262 | 1262 | $migration->set('created_at', date('Y-m-d H:i:s')); |
| 1263 | 1263 | $migration->set('processed_at', date('Y-m-d H:i:s')); |
| 1264 | - if ($migration->save() ) { |
|
| 1264 | + if ($migration->save()) { |
|
| 1265 | 1265 | $this->outSuccess($migration_name.' ran and logged'); |
| 1266 | 1266 | } else { |
| 1267 | - $this->out($migration_name . ' did not log correctly', true); |
|
| 1267 | + $this->out($migration_name.' did not log correctly', true); |
|
| 1268 | 1268 | } |
| 1269 | 1269 | |
| 1270 | 1270 | // does the migration directory exist? |
@@ -1279,12 +1279,12 @@ discard block |
||
| 1279 | 1279 | } |
| 1280 | 1280 | if ($create) { |
| 1281 | 1281 | mkdir($this->getMigrationPath(), 0700, true); |
| 1282 | - $this->outSuccess('Created migration directory: '. $this->getMigrationPath()); |
|
| 1282 | + $this->outSuccess('Created migration directory: '.$this->getMigrationPath()); |
|
| 1283 | 1283 | } |
| 1284 | 1284 | } |
| 1285 | 1285 | |
| 1286 | 1286 | } else { |
| 1287 | - $this->out($migration_name . ' did not log correctly', true); |
|
| 1287 | + $this->out($migration_name.' did not log correctly', true); |
|
| 1288 | 1288 | } |
| 1289 | 1289 | |
| 1290 | 1290 | } elseif ($method == 'down') { |
@@ -1307,7 +1307,7 @@ discard block |
||
| 1307 | 1307 | /** |
| 1308 | 1308 | * @param string $branch |
| 1309 | 1309 | */ |
| 1310 | - public function runModxInstallGitBranchMigration($branch, $config=[]) |
|
| 1310 | + public function runModxInstallGitBranchMigration($branch, $config = []) |
|
| 1311 | 1311 | { |
| 1312 | 1312 | $version = ''; |
| 1313 | 1313 | switch ($branch) { |
@@ -1324,7 +1324,7 @@ discard block |
||
| 1324 | 1324 | /** |
| 1325 | 1325 | * @param string $release |
| 1326 | 1326 | */ |
| 1327 | - public function runModxInstallGitReleaseMigration($release, $config=[]) |
|
| 1327 | + public function runModxInstallGitReleaseMigration($release, $config = []) |
|
| 1328 | 1328 | { |
| 1329 | 1329 | $release = str_replace(['.', '-'], '_', $release); |
| 1330 | 1330 | |
@@ -1337,7 +1337,7 @@ discard block |
||
| 1337 | 1337 | * @param string $method |
| 1338 | 1338 | * @param bool $prompt |
| 1339 | 1339 | */ |
| 1340 | - protected function runModxInstallMigration($migration_name= 'v3_0_0_dev_install', $method='up', $prompt=false) |
|
| 1340 | + protected function runModxInstallMigration($migration_name = 'v3_0_0_dev_install', $method = 'up', $prompt = false) |
|
| 1341 | 1341 | { |
| 1342 | 1342 | $custom_migration_dir = __DIR__.'/database/modx/migration/'; |
| 1343 | 1343 | $seeds_root_path = __DIR__.'/database/modx/seeds/'; |
@@ -1348,16 +1348,16 @@ discard block |
||
| 1348 | 1348 | /** |
| 1349 | 1349 | * @param string $version_key |
| 1350 | 1350 | */ |
| 1351 | - protected function cacheUserInstallConfig($version_key, $config=[]) |
|
| 1351 | + protected function cacheUserInstallConfig($version_key, $config = []) |
|
| 1352 | 1352 | { |
| 1353 | - $simpleCache = new SimpleCache(BLEND_CACHE_DIR . 'modx/'); |
|
| 1353 | + $simpleCache = new SimpleCache(BLEND_CACHE_DIR.'modx/'); |
|
| 1354 | 1354 | $simpleCache->set('install-config-'.$version_key, $config); |
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | 1357 | /** |
| 1358 | 1358 | * @param string $method |
| 1359 | 1359 | */ |
| 1360 | - public function update($method='up') |
|
| 1360 | + public function update($method = 'up') |
|
| 1361 | 1361 | { |
| 1362 | 1362 | $current_vesion = $this->modx->getOption('blend.version'); |
| 1363 | 1363 | |
@@ -1368,7 +1368,7 @@ discard block |
||
| 1368 | 1368 | $blender = new Blender($this->modx, $this->getUserInteractionHandler(), $config); |
| 1369 | 1369 | |
| 1370 | 1370 | foreach ($this->update_migrations as $v => $migration_name) { |
| 1371 | - if (version_compare($v, $current_vesion) === 1 ) { |
|
| 1371 | + if (version_compare($v, $current_vesion) === 1) { |
|
| 1372 | 1372 | // can not use as xPDO get queries fill the SELECT with the DB fields and since we are adding one this is a SQL error |
| 1373 | 1373 | //$blender->runMigration($method, 'master', 0, 0, $migration_name); |
| 1374 | 1374 | |
@@ -1393,7 +1393,7 @@ discard block |
||
| 1393 | 1393 | $migration->set('status', 'up_complete'); |
| 1394 | 1394 | $migration->set('created_at', date('Y-m-d H:i:s')); |
| 1395 | 1395 | $migration->set('processed_at', date('Y-m-d H:i:s')); |
| 1396 | - if ($migration->save() ) { |
|
| 1396 | + if ($migration->save()) { |
|
| 1397 | 1397 | $this->outSuccess('Blend updated to '.$v); |
| 1398 | 1398 | } else { |
| 1399 | 1399 | $this->out('Blend did not update to '.$v, true); |
@@ -1433,7 +1433,7 @@ discard block |
||
| 1433 | 1433 | |
| 1434 | 1434 | $current_vesion = $this->modx->getOption('blend.version'); |
| 1435 | 1435 | // FILE version, DB Version |
| 1436 | - if ( $this->isBlendInstalledInModx() && ( !$current_vesion || version_compare($this->getVersion(), $current_vesion)) ) { |
|
| 1436 | + if ($this->isBlendInstalledInModx() && (!$current_vesion || version_compare($this->getVersion(), $current_vesion))) { |
|
| 1437 | 1437 | $upgrade = true; |
| 1438 | 1438 | } |
| 1439 | 1439 | |
@@ -1478,7 +1478,7 @@ discard block |
||
| 1478 | 1478 | * @param int $id |
| 1479 | 1479 | * @param string $name |
| 1480 | 1480 | */ |
| 1481 | - public function runMigration($method='up', $type='master', $count=0, $id=0, $name=null) |
|
| 1481 | + public function runMigration($method = 'up', $type = 'master', $count = 0, $id = 0, $name = null) |
|
| 1482 | 1482 | { |
| 1483 | 1483 | $dir = 'ASC'; |
| 1484 | 1484 | if ($method == 'down') { |
@@ -1512,7 +1512,7 @@ discard block |
||
| 1512 | 1512 | /** @var string $server_type */ |
| 1513 | 1513 | $server_type = $migration->get('type'); |
| 1514 | 1514 | |
| 1515 | - if ( ($server_type != $type) || ($method == 'up' && $status == 'up_complete') || ($method == 'down' && $status != 'up_complete') ) { |
|
| 1515 | + if (($server_type != $type) || ($method == 'up' && $status == 'up_complete') || ($method == 'down' && $status != 'up_complete')) { |
|
| 1516 | 1516 | continue; |
| 1517 | 1517 | } |
| 1518 | 1518 | |
@@ -1610,7 +1610,7 @@ discard block |
||
| 1610 | 1610 | if (file_exists($file)) { |
| 1611 | 1611 | require_once $file; |
| 1612 | 1612 | |
| 1613 | - if(class_exists($name)) { |
|
| 1613 | + if (class_exists($name)) { |
|
| 1614 | 1614 | /** @var Migrations $migrationProcessClass */ |
| 1615 | 1615 | $migrationProcessClass = new $name($this->modx, $blender); |
| 1616 | 1616 | } |
@@ -1624,7 +1624,7 @@ discard block |
||
| 1624 | 1624 | * @param null $name |
| 1625 | 1625 | * @return string |
| 1626 | 1626 | */ |
| 1627 | - public function getMigrationName($type, $name=null) |
|
| 1627 | + public function getMigrationName($type, $name = null) |
|
| 1628 | 1628 | { |
| 1629 | 1629 | $dir_name = 'm'.$this->seeds_dir.'_'; |
| 1630 | 1630 | if (empty($name)) { |
@@ -1648,7 +1648,7 @@ discard block |
||
| 1648 | 1648 | * |
| 1649 | 1649 | * @return bool |
| 1650 | 1650 | */ |
| 1651 | - protected function writeMigrationClassFile($type, $class_data=[], $server_type='master', $name=null, $log=true) |
|
| 1651 | + protected function writeMigrationClassFile($type, $class_data = [], $server_type = 'master', $name = null, $log = true) |
|
| 1652 | 1652 | { |
| 1653 | 1653 | $class_name = $this->getMigrationName($type, $name); |
| 1654 | 1654 | |
@@ -1743,19 +1743,19 @@ discard block |
||
| 1743 | 1743 | |
| 1744 | 1744 | $write = false; |
| 1745 | 1745 | if (file_exists($this->getMigrationPath().$class_name.'.php')) { |
| 1746 | - $this->out($this->getMigrationPath() . $class_name . '.php migration file already exists', true); |
|
| 1746 | + $this->out($this->getMigrationPath().$class_name.'.php migration file already exists', true); |
|
| 1747 | 1747 | |
| 1748 | 1748 | } elseif (is_object($this->modx->getObject($this->blend_class_object, ['name' => $class_name]))) { |
| 1749 | - $this->out($class_name . ' migration already has been created in the blend_migrations table', true); |
|
| 1749 | + $this->out($class_name.' migration already has been created in the blend_migrations table', true); |
|
| 1750 | 1750 | |
| 1751 | 1751 | } else { |
| 1752 | 1752 | try { |
| 1753 | - $write = file_put_contents($this->getMigrationPath() . $class_name . '.php', $file_contents); |
|
| 1753 | + $write = file_put_contents($this->getMigrationPath().$class_name.'.php', $file_contents); |
|
| 1754 | 1754 | $migration = $this->modx->newObject($this->blend_class_object); |
| 1755 | 1755 | if ($migration && $log) { |
| 1756 | 1756 | $migration->set('name', $class_name); |
| 1757 | 1757 | $migration->set('type', 'master'); |
| 1758 | - $migration->set('description', '');// @TODO |
|
| 1758 | + $migration->set('description', ''); // @TODO |
|
| 1759 | 1759 | $migration->set('version', ''); |
| 1760 | 1760 | $migration->set('status', 'seed export'); |
| 1761 | 1761 | $migration->set('created_at', date('Y-m-d H:i:s')); |
@@ -1765,7 +1765,7 @@ discard block |
||
| 1765 | 1765 | $this->out($exception->getMessage(), true); |
| 1766 | 1766 | } |
| 1767 | 1767 | if (!$write) { |
| 1768 | - $this->out($this->getMigrationPath() . $class_name . '.php Did not write to file', true); |
|
| 1768 | + $this->out($this->getMigrationPath().$class_name.'.php Did not write to file', true); |
|
| 1769 | 1769 | $this->out('Verify that the folders exists and are writable by PHP', true); |
| 1770 | 1770 | } |
| 1771 | 1771 | } |
@@ -1785,21 +1785,21 @@ discard block |
||
| 1785 | 1785 | $class_name = $this->getMigrationName($type, $name); |
| 1786 | 1786 | |
| 1787 | 1787 | $removed = false; |
| 1788 | - $migration_file = $this->getMigrationPath() . $class_name . '.php'; |
|
| 1788 | + $migration_file = $this->getMigrationPath().$class_name.'.php'; |
|
| 1789 | 1789 | if (file_exists($migration_file)) { |
| 1790 | 1790 | if (unlink($migration_file)) { |
| 1791 | 1791 | $removed = true; |
| 1792 | 1792 | $migration = $this->modx->getObject($this->blend_class_object, ['name' => $class_name]); |
| 1793 | 1793 | if (is_object($migration) && $migration->remove()) { |
| 1794 | - $this->out($class_name . ' migration has been removed from the blend_migrations table'); |
|
| 1794 | + $this->out($class_name.' migration has been removed from the blend_migrations table'); |
|
| 1795 | 1795 | |
| 1796 | 1796 | } |
| 1797 | 1797 | } else { |
| 1798 | - $this->out($class_name . ' migration has not been removed from the blend_migrations table', true); |
|
| 1798 | + $this->out($class_name.' migration has not been removed from the blend_migrations table', true); |
|
| 1799 | 1799 | } |
| 1800 | 1800 | |
| 1801 | 1801 | } else { |
| 1802 | - $this->out($this->getMigrationPath() . $class_name . '.php migration could not be found to remove', true); |
|
| 1802 | + $this->out($this->getMigrationPath().$class_name.'.php migration could not be found to remove', true); |
|
| 1803 | 1803 | } |
| 1804 | 1804 | |
| 1805 | 1805 | return $removed; |
@@ -1837,7 +1837,7 @@ discard block |
||
| 1837 | 1837 | * |
| 1838 | 1838 | * @return bool|int |
| 1839 | 1839 | */ |
| 1840 | - public function getResourceIDFromSeedKey($seed_key, $context='web') |
|
| 1840 | + public function getResourceIDFromSeedKey($seed_key, $context = 'web') |
|
| 1841 | 1841 | { |
| 1842 | 1842 | if (!isset($this->resource_seek_key_map[$context])) { |
| 1843 | 1843 | $this->resource_seek_key_map[$context] = []; |
@@ -1916,9 +1916,9 @@ discard block |
||
| 1916 | 1916 | * |
| 1917 | 1917 | * @return string |
| 1918 | 1918 | */ |
| 1919 | - protected function prettyVarExport($data, $tabs=1) |
|
| 1919 | + protected function prettyVarExport($data, $tabs = 1) |
|
| 1920 | 1920 | { |
| 1921 | - $spacing = str_repeat(' ', 4*$tabs); |
|
| 1921 | + $spacing = str_repeat(' ', 4 * $tabs); |
|
| 1922 | 1922 | |
| 1923 | 1923 | $string = ''; |
| 1924 | 1924 | $parts = preg_split('/\R/', var_export($data, true)); |
@@ -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()) { |
@@ -572,10 +572,14 @@ |
||
| 572 | 572 | $success= true; |
| 573 | 573 | |
| 574 | 574 | $xmlFile = MODX_CORE_PATH.'model/schema/modx.action.fields.schema.xml'; |
| 575 | - if (!file_exists($xmlFile)) return false; |
|
| 575 | + if (!file_exists($xmlFile)) { |
|
| 576 | + return false; |
|
| 577 | + } |
|
| 576 | 578 | |
| 577 | 579 | $xml = @file_get_contents($xmlFile); |
| 578 | - if (empty($xml)) return false; |
|
| 580 | + if (empty($xml)) { |
|
| 581 | + return false; |
|
| 582 | + } |
|
| 579 | 583 | |
| 580 | 584 | $xml = @simplexml_load_string($xml); |
| 581 | 585 | |