@@ -18,7 +18,7 @@ |
||
| 18 | 18 | $target = null, |
| 19 | 19 | $includeParent = false, |
| 20 | 20 | $includeChildren = true, |
| 21 | - $duplicateStrategy='overwrite', |
|
| 21 | + $duplicateStrategy = 'overwrite', |
|
| 22 | 22 | $params = array() |
| 23 | 23 | ) { |
| 24 | 24 | if ($contentItem) { |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | * How to handle duplication |
| 44 | 44 | * @param array $params All parameters passed with the import request. |
| 45 | 45 | */ |
| 46 | - public function import($contentItem, $target, $includeParent = false, $includeChildren = true, $duplicateStrategy='Overwrite', $params = array()) |
|
| 46 | + public function import($contentItem, $target, $includeParent = false, $includeChildren = true, $duplicateStrategy = 'Overwrite', $params = array()) |
|
| 47 | 47 | { |
| 48 | 48 | $this->runOnImportStart(); |
| 49 | 49 | $this->params = $params; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (!$filterFunction) { |
| 143 | - $filterFunction = function ($node) use ($filter) { |
|
| 143 | + $filterFunction = function($node) use ($filter) { |
|
| 144 | 144 | return $filter->isPageIncluded($node); |
| 145 | 145 | }; |
| 146 | 146 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | // Render using full-subtree template |
| 178 | 178 | return $markingSet->renderChildren( |
| 179 | - [ self::class . '_SubTree', 'type' => 'Includes' ], |
|
| 179 | + [self::class . '_SubTree', 'type' => 'Includes'], |
|
| 180 | 180 | $this->getTreeNodeCustomisations() |
| 181 | 181 | ); |
| 182 | 182 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | protected function getTreeNodeCustomisations() |
| 190 | 190 | { |
| 191 | 191 | $rootTitle = $this->getCMSTreeTitle(); |
| 192 | - return function ($node) use ($rootTitle) { |
|
| 192 | + return function($node) use ($rootTitle) { |
|
| 193 | 193 | return [ |
| 194 | 194 | 'listViewLink' => $this->LinkListViewChildren($node->ID), |
| 195 | 195 | 'rootTitle' => $rootTitle, |
@@ -338,11 +338,11 @@ discard block |
||
| 338 | 338 | { |
| 339 | 339 | $form = $this->getEditForm(); |
| 340 | 340 | $migrationTarget = isset($request['MigrationTarget']) ? $request['MigrationTarget'] : ''; |
| 341 | - $fileMigrationTarget = isset($request['FileMigrationTarget']) ? $request['FileMigrationTarget'] : ''; |
|
| 341 | + $fileMigrationTarget = isset($request['FileMigrationTarget']) ? $request['FileMigrationTarget'] : ''; |
|
| 342 | 342 | $includeSelected = isset($request['IncludeSelected']) ? $request['IncludeSelected'] : 0; |
| 343 | 343 | $includeChildren = isset($request['IncludeChildren']) ? $request['IncludeChildren'] : 0; |
| 344 | - $duplicates = isset($request['DuplicateMethod']) ? $request['DuplicateMethod'] : ExternalContentTransformer::DS_OVERWRITE; |
|
| 345 | - $selected = isset($request['ID']) ? $request['ID'] : 0; |
|
| 344 | + $duplicates = isset($request['DuplicateMethod']) ? $request['DuplicateMethod'] : ExternalContentTransformer::DS_OVERWRITE; |
|
| 345 | + $selected = isset($request['ID']) ? $request['ID'] : 0; |
|
| 346 | 346 | |
| 347 | 347 | if (!$selected) { |
| 348 | 348 | $messageType = 'bad'; |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | $visible = explode('\\', $class); |
| 638 | - $classes[$key] = FormField::name_to_label($visible[count($visible)-1]); |
|
| 638 | + $classes[$key] = FormField::name_to_label($visible[count($visible) - 1]); |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | $fields = FieldList::create( |
@@ -668,11 +668,10 @@ discard block |
||
| 668 | 668 | // Providers are ALWAYS at the root |
| 669 | 669 | $parent = 0; |
| 670 | 670 | $name = (isset($_REQUEST['Name'])) ? |
| 671 | - basename($_REQUEST['Name']) : |
|
| 672 | - _t('ExternalContent.NEWCONNECTOR', "New Connector"); |
|
| 671 | + basename($_REQUEST['Name']) : _t('ExternalContent.NEWCONNECTOR', "New Connector"); |
|
| 673 | 672 | $type = $_REQUEST['ProviderType']; |
| 674 | 673 | $providerClasses = array_map( |
| 675 | - function ($item) { |
|
| 674 | + function($item) { |
|
| 676 | 675 | return strtolower($item); |
| 677 | 676 | }, |
| 678 | 677 | ClassInfo::subclassesFor(self::$tree_class) |
@@ -832,9 +831,9 @@ discard block |
||
| 832 | 831 | { |
| 833 | 832 | $css = ''; |
| 834 | 833 | |
| 835 | - $sourceClasses = ClassInfo::subclassesFor(ExternalContentSource::class); |
|
| 836 | - $itemClasses = ClassInfo::subclassesFor(ExternalContentItem::class); |
|
| 837 | - $classes = array_merge($sourceClasses, $itemClasses); |
|
| 834 | + $sourceClasses = ClassInfo::subclassesFor(ExternalContentSource::class); |
|
| 835 | + $itemClasses = ClassInfo::subclassesFor(ExternalContentItem::class); |
|
| 836 | + $classes = array_merge($sourceClasses, $itemClasses); |
|
| 838 | 837 | |
| 839 | 838 | foreach ($classes as $class) { |
| 840 | 839 | $obj = singleton($class); |
@@ -922,7 +921,7 @@ discard block |
||
| 922 | 921 | } |
| 923 | 922 | |
| 924 | 923 | if (!$record || !$record->ID) { |
| 925 | - $this->httpError(404, "Bad record ID #" . (int)$data['ID']); |
|
| 924 | + $this->httpError(404, "Bad record ID #" . (int) $data['ID']); |
|
| 926 | 925 | } |
| 927 | 926 | |
| 928 | 927 | $type = $record->ClassName; |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | * @param int $expiry |
| 68 | 68 | * How many seconds to cache this object for (no value uses the configured default) |
| 69 | 69 | */ |
| 70 | - public function store($key, $value, $expiry=0) |
|
| 70 | + public function store($key, $value, $expiry = 0) |
|
| 71 | 71 | { |
| 72 | 72 | if ($expiry == 0) { |
| 73 | 73 | $expiry = $this->expiry; |
@@ -5,11 +5,10 @@ discard block |
||
| 5 | 5 | All rights reserved. |
| 6 | 6 | |
| 7 | 7 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: |
| 8 | - |
|
| 9 | - * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. |
|
| 10 | - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the |
|
| 8 | + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. |
|
| 9 | + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the |
|
| 11 | 10 | documentation and/or other materials provided with the distribution. |
| 12 | - * Neither the name of SilverStripe nor the names of its contributors may be used to endorse or promote products derived from this software |
|
| 11 | + * Neither the name of SilverStripe nor the names of its contributors may be used to endorse or promote products derived from this software |
|
| 13 | 12 | without specific prior written permission. |
| 14 | 13 | |
| 15 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
@@ -18,8 +17,7 @@ discard block |
||
| 18 | 17 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 19 | 18 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
| 20 | 19 | OF SUCH DAMAGE. |
| 21 | - |
|
| 22 | -*/ |
|
| 20 | + */ |
|
| 23 | 21 | |
| 24 | 22 | /** |
| 25 | 23 | * An object that acts as a client to a web API of some sort. |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * Create a new webapi client |
| 164 | 164 | * |
| 165 | 165 | */ |
| 166 | - public function __construct($url, $methods=null, $globalParams=null) |
|
| 166 | + public function __construct($url, $methods = null, $globalParams = null) |
|
| 167 | 167 | { |
| 168 | 168 | $this->baseUrl = $url; |
| 169 | 169 | $this->methods = $methods; |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | if (preg_match_all('/{(\w+)}/', $uri, $matches)) { |
| 211 | 211 | foreach ($matches[1] as $match) { |
| 212 | 212 | if (isset($args[$match])) { |
| 213 | - $uri = str_replace('{'.$match.'}', $args[$match], $uri); |
|
| 213 | + $uri = str_replace('{' . $match . '}', $args[$match], $uri); |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | } |
@@ -280,10 +280,10 @@ discard block |
||
| 280 | 280 | } |
| 281 | 281 | } else { |
| 282 | 282 | if ($response->getStatus() == 500) { |
| 283 | - error_log("Failure: ".$response->getBody()); |
|
| 283 | + error_log("Failure: " . $response->getBody()); |
|
| 284 | 284 | error_log(var_export($client, true)); |
| 285 | 285 | } |
| 286 | - throw new FailedRequestException("Failed executing $method: ".$response->getMessage()." for request to $uri (".$client->getUri(true).')', $response->getBody()); |
|
| 286 | + throw new FailedRequestException("Failed executing $method: " . $response->getMessage() . " for request to $uri (" . $client->getUri(true) . ')', $response->getBody()); |
|
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | $client->setMethod($requestType); |
| 336 | 336 | // set the encoding type |
| 337 | 337 | $client->setEncType($enctype); |
| 338 | - $paramMethod = 'setParameter'.$requestType; |
|
| 338 | + $paramMethod = 'setParameter' . $requestType; |
|
| 339 | 339 | // make sure to add the alfTicket parameter |
| 340 | 340 | if ($this->globalParams) { |
| 341 | 341 | foreach ($this->globalParams as $key => $value) { |
@@ -357,10 +357,10 @@ discard block |
||
| 357 | 357 | } |
| 358 | 358 | } else { |
| 359 | 359 | if ($response->getStatus() == 500) { |
| 360 | - error_log("Failure: ".$response->getBody()); |
|
| 360 | + error_log("Failure: " . $response->getBody()); |
|
| 361 | 361 | error_log(var_export($client, true)); |
| 362 | 362 | } |
| 363 | - throw new FailedRequestException("Failed executing $url: ".$response->getMessage()." for request to $uri (".$client->getUri(true).')', $response->getBody()); |
|
| 363 | + throw new FailedRequestException("Failed executing $url: " . $response->getMessage() . " for request to $uri (" . $client->getUri(true) . ')', $response->getBody()); |
|
| 364 | 364 | } |
| 365 | 365 | } |
| 366 | 366 | |