@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param int $property_set |
41 | 41 | * @return $this |
42 | 42 | */ |
43 | - public function attachOnEvent($event_name, $priority=0, $property_set=0) |
|
43 | + public function attachOnEvent($event_name, $priority = 0, $property_set = 0) |
|
44 | 44 | { |
45 | 45 | $this->related_data[] = [ |
46 | 46 | 'event' => $event_name, |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | /** |
138 | 138 | * @var string $type blend or revert |
139 | 139 | */ |
140 | - protected function seedRelated($type='blend') |
|
140 | + protected function seedRelated($type = 'blend') |
|
141 | 141 | { |
142 | 142 | // get all related Events: |
143 | 143 | $events = []; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param string $destination ~ full path of destination |
22 | 22 | * @param int $file_count |
23 | 23 | */ |
24 | - public function copyDirectory($source, $destination, $file_count=4000) |
|
24 | + public function copyDirectory($source, $destination, $file_count = 4000) |
|
25 | 25 | { |
26 | 26 | if (!is_dir($destination)) { |
27 | 27 | mkdir($destination, 0700); |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | /** @var \DirectoryIterator $item */ |
45 | 45 | foreach ($recursiveIteratorIterator as $item) { |
46 | 46 | if ($item->isDir()) { |
47 | - if (is_dir($destination. DIRECTORY_SEPARATOR. $recursiveIteratorIterator->getSubPathName())) { |
|
47 | + if (is_dir($destination.DIRECTORY_SEPARATOR.$recursiveIteratorIterator->getSubPathName())) { |
|
48 | 48 | continue; |
49 | 49 | } |
50 | - mkdir($destination . DIRECTORY_SEPARATOR . $recursiveIteratorIterator->getSubPathName()); |
|
50 | + mkdir($destination.DIRECTORY_SEPARATOR.$recursiveIteratorIterator->getSubPathName()); |
|
51 | 51 | |
52 | 52 | } else { |
53 | - copy($item, $destination . DIRECTORY_SEPARATOR . $recursiveIteratorIterator->getSubPathName()); |
|
53 | + copy($item, $destination.DIRECTORY_SEPARATOR.$recursiveIteratorIterator->getSubPathName()); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | if (isset($progress) && $progress instanceof ProgressBar) { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param string $key |
35 | 35 | * @return bool|mixed |
36 | 36 | */ |
37 | - public function get($key='install-config') |
|
37 | + public function get($key = 'install-config') |
|
38 | 38 | { |
39 | 39 | $path = $this->getFullKeyPath($key); |
40 | 40 | $data = false; |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | * @param string $key |
51 | 51 | * @param array $data |
52 | 52 | */ |
53 | - public function set($key='install-config', $data=[]) |
|
53 | + public function set($key = 'install-config', $data = []) |
|
54 | 54 | { |
55 | 55 | $content = '<?php '.PHP_EOL. |
56 | - 'return ' . var_export($data, true) . ';'; |
|
56 | + 'return '.var_export($data, true).';'; |
|
57 | 57 | |
58 | 58 | file_put_contents($this->getFullKeyPath($key), $content); |
59 | 59 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | /** |
62 | 62 | * @param null|string $key ~ if null will delete the complete directory |
63 | 63 | */ |
64 | - public function remove($key=null) |
|
64 | + public function remove($key = null) |
|
65 | 65 | { |
66 | 66 | if (!empty($key)) { |
67 | 67 | $path = $this->getFullKeyPath($key); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | } else { |
73 | 73 | // clean the directory: |
74 | - $this->deleteDirectory(MODX_PATH . $this->directory); |
|
74 | + $this->deleteDirectory(MODX_PATH.$this->directory); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | */ |
82 | 82 | protected function getFullKeyPath($key) |
83 | 83 | { |
84 | - return rtrim($this->directory, '/') . DIRECTORY_SEPARATOR . |
|
85 | - preg_replace('/[^A-Za-z0-9\_\-]/', '', str_replace(['/', ' '], '_', $key)) . |
|
84 | + return rtrim($this->directory, '/').DIRECTORY_SEPARATOR. |
|
85 | + preg_replace('/[^A-Za-z0-9\_\-]/', '', str_replace(['/', ' '], '_', $key)). |
|
86 | 86 | '.php'; |
87 | 87 | } |
88 | 88 |
@@ -21,22 +21,22 @@ discard block |
||
21 | 21 | * @param string $config_path |
22 | 22 | * @param array $config |
23 | 23 | */ |
24 | - public function __construct($config_path, array $config=[]) |
|
24 | + public function __construct($config_path, array $config = []) |
|
25 | 25 | { |
26 | 26 | |
27 | - $this->config_path = $config_path . 'core/config/' . (defined('MODX_CONFIG_KEY') ? MODX_CONFIG_PATH : 'config'). '.inc.php'; |
|
27 | + $this->config_path = $config_path.'core/config/'.(defined('MODX_CONFIG_KEY') ? MODX_CONFIG_PATH : 'config').'.inc.php'; |
|
28 | 28 | |
29 | 29 | $defaults = [ |
30 | - 'site_sessionname' => 'SN' . uniqid(''), |
|
31 | - 'core_path' => (defined('MODX_CORE_PATH') ? MODX_CORE_PATH : MODX_PATH . 'core/'), |
|
32 | - 'mgr_path' => (defined('MODX_MANAGER_PATH') ? MODX_MANAGER_PATH : MODX_PATH . 'manager/'), |
|
30 | + 'site_sessionname' => 'SN'.uniqid(''), |
|
31 | + 'core_path' => (defined('MODX_CORE_PATH') ? MODX_CORE_PATH : MODX_PATH.'core/'), |
|
32 | + 'mgr_path' => (defined('MODX_MANAGER_PATH') ? MODX_MANAGER_PATH : MODX_PATH.'manager/'), |
|
33 | 33 | 'mgr_url' => (defined('MODX_MANAGER_URL') ? MODX_MANAGER_URL : '/manager/'), |
34 | - 'connectors_path' => (defined('MODX_CONNECTORS_PATH') ? MODX_CONNECTORS_PATH : MODX_PATH . 'connectors/'), |
|
34 | + 'connectors_path' => (defined('MODX_CONNECTORS_PATH') ? MODX_CONNECTORS_PATH : MODX_PATH.'connectors/'), |
|
35 | 35 | 'connectors_url' => (defined('MODX_CONNECTORS_URL') ? MODX_CONNECTORS_URL : '/connectors/'), |
36 | 36 | 'web_path' => (defined('MODX_BASE_PATH') ? MODX_BASE_PATH : MODX_PATH), |
37 | 37 | 'web_url' => (defined('MODX_BASE_URL') ? MODX_BASE_URL : '/'), |
38 | - 'processors_path' => (defined('MODX_CORE_PATH') ? MODX_CORE_PATH : MODX_PATH . 'core/') . 'model/modx/processors/', |
|
39 | - 'assets_path' => (defined('MODX_ASSETS_PATH') ? MODX_ASSETS_PATH : MODX_PATH . 'assets/'), |
|
38 | + 'processors_path' => (defined('MODX_CORE_PATH') ? MODX_CORE_PATH : MODX_PATH.'core/').'model/modx/processors/', |
|
39 | + 'assets_path' => (defined('MODX_ASSETS_PATH') ? MODX_ASSETS_PATH : MODX_PATH.'assets/'), |
|
40 | 40 | 'assets_url' => (defined('MODX_ASSETS_URL') ? MODX_ASSETS_URL : '/assets/'), |
41 | 41 | |
42 | 42 | 'database_dsn' => '', |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $this->config['database_password'] = addslashes($this->config['database_password']); |
103 | 103 | |
104 | 104 | $this->config['last_install_time'] = time(); |
105 | - $this->config['site_id'] = uniqid('modx',true); |
|
105 | + $this->config['site_id'] = uniqid('modx', true); |
|
106 | 106 | |
107 | 107 | /* make UUID if not set */ |
108 | 108 | if (empty($this->config['uuid'])) { |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | $replace = []; |
119 | 119 | foreach ($this->config as $key => $value) { |
120 | 120 | if (is_scalar($value)) { |
121 | - $replace['{' . $key . '}'] = $value; |
|
121 | + $replace['{'.$key.'}'] = $value; |
|
122 | 122 | } elseif (is_array($value)) { |
123 | - $replace['{' . $key . '}'] = var_export($value, true); |
|
123 | + $replace['{'.$key.'}'] = var_export($value, true); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | */ |
169 | 169 | protected function generateUUID() { |
170 | 170 | srand(intval(microtime(true) * 1000)); |
171 | - $b = md5(uniqid(rand(),true),true); |
|
171 | + $b = md5(uniqid(rand(), true), true); |
|
172 | 172 | $b[6] = chr((ord($b[6]) & 0x0F) | 0x40); |
173 | 173 | $b[8] = chr((ord($b[8]) & 0x3F) | 0x80); |
174 | - return implode('-',unpack('H8a/H4b/H4c/H4d/H12e',$b)); |
|
174 | + return implode('-', unpack('H8a/H4b/H4c/H4d/H12e', $b)); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | \ No newline at end of file |
@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | class BlendMigrations extends \LCI\Blend\Model\xPDO\BlendMigrations |
7 | 7 | { |
8 | 8 | |
9 | - public static $metaMap = array ( |
|
9 | + public static $metaMap = array( |
|
10 | 10 | 'package' => 'LCI\\Blend\\Model\\xPDO', |
11 | 11 | 'version' => '3.0', |
12 | 12 | 'table' => 'blend_migrations', |
13 | 13 | 'extends' => 'xPDO\\Om\\xPDOSimpleObject', |
14 | 14 | 'fields' => |
15 | - array ( |
|
15 | + array( |
|
16 | 16 | 'name' => NULL, |
17 | 17 | 'version' => NULL, |
18 | 18 | 'type' => 'master', |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | 'processed_at' => NULL, |
24 | 24 | ), |
25 | 25 | 'fieldMeta' => |
26 | - array ( |
|
26 | + array( |
|
27 | 27 | 'name' => |
28 | - array ( |
|
28 | + array( |
|
29 | 29 | 'dbtype' => 'varchar', |
30 | 30 | 'precision' => '255', |
31 | 31 | 'phptype' => 'string', |
32 | 32 | 'null' => false, |
33 | 33 | ), |
34 | 34 | 'version' => |
35 | - array ( |
|
35 | + array( |
|
36 | 36 | 'dbtype' => 'varchar', |
37 | 37 | 'precision' => '32', |
38 | 38 | 'phptype' => 'string', |
39 | 39 | 'null' => true, |
40 | 40 | ), |
41 | 41 | 'type' => |
42 | - array ( |
|
42 | + array( |
|
43 | 43 | 'dbtype' => 'set', |
44 | 44 | 'precision' => '\'master\',\'stagging\',\'dev\',\'local\'', |
45 | 45 | 'phptype' => 'string', |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | 'default' => 'master', |
48 | 48 | ), |
49 | 49 | 'description' => |
50 | - array ( |
|
50 | + array( |
|
51 | 51 | 'dbtype' => 'text', |
52 | 52 | 'phptype' => 'string', |
53 | 53 | 'null' => true, |
54 | 54 | ), |
55 | 55 | 'status' => |
56 | - array ( |
|
56 | + array( |
|
57 | 57 | 'dbtype' => 'varchar', |
58 | 58 | 'precision' => '16', |
59 | 59 | 'phptype' => 'string', |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | 'default' => 'ready', |
62 | 62 | ), |
63 | 63 | 'author' => |
64 | - array ( |
|
64 | + array( |
|
65 | 65 | 'dbtype' => 'varchar', |
66 | 66 | 'precision' => '255', |
67 | 67 | 'phptype' => 'string', |
68 | 68 | 'null' => true, |
69 | 69 | ), |
70 | 70 | 'created_at' => |
71 | - array ( |
|
71 | + array( |
|
72 | 72 | 'dbtype' => 'timestamp', |
73 | 73 | 'phptype' => 'timestamp', |
74 | 74 | 'null' => false, |
75 | 75 | 'default' => 'CURRENT_TIMESTAMP', |
76 | 76 | ), |
77 | 77 | 'processed_at' => |
78 | - array ( |
|
78 | + array( |
|
79 | 79 | 'dbtype' => 'timestamp', |
80 | 80 | 'phptype' => 'timestamp', |
81 | 81 | 'null' => true, |
@@ -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 | ), |
@@ -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 | } |
@@ -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' ) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $this->results[] = $message; |
119 | 119 | // now cache it: |
120 | 120 | |
121 | - $simpleCache = new SimpleCache(BLEND_CACHE_DIR . 'modx/'); |
|
121 | + $simpleCache = new SimpleCache(BLEND_CACHE_DIR.'modx/'); |
|
122 | 122 | $simpleCache->set($this->getSeedsDir().'-'.$this->method, $this->results); |
123 | 123 | } |
124 | 124 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | { |
130 | 130 | $key = 'install-config-v'.str_replace(['.', '-'], '_', $this->version).'_install'; |
131 | 131 | |
132 | - $simpleCache = new SimpleCache(BLEND_CACHE_DIR . 'modx/'); |
|
132 | + $simpleCache = new SimpleCache(BLEND_CACHE_DIR.'modx/'); |
|
133 | 133 | $this->install_config = $simpleCache->get($key); |
134 | 134 | } |
135 | 135 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @param mixed |
139 | 139 | * @return bool|mixed |
140 | 140 | */ |
141 | - protected function getUserInstallConfigValue($key, $default=false) |
|
141 | + protected function getUserInstallConfigValue($key, $default = false) |
|
142 | 142 | { |
143 | 143 | if (isset($this->install_config[$key])) { |
144 | 144 | return $this->install_config[$key]; |
@@ -152,6 +152,6 @@ discard block |
||
152 | 152 | */ |
153 | 153 | protected function loadCurrentVersionInfo() |
154 | 154 | { |
155 | - $this->current_version = include MODX_CORE_PATH . 'docs/version.inc.php'; |
|
155 | + $this->current_version = include MODX_CORE_PATH.'docs/version.inc.php'; |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | \ No newline at end of file |