diff --git a/docs/en/installation/common-problems.md b/docs/en/installation/common-problems.md index 1f2e3c2c6..1485d54b4 100644 --- a/docs/en/installation/common-problems.md +++ b/docs/en/installation/common-problems.md @@ -52,7 +52,7 @@ handle the new code. Here are some specifics situations: ## My edited CMS content doesn't show on the website If you've set up your site and it used to be working, but now it's suddenly totally broken, you may have forgotten to -publish your draft content. Go to the CMS and use the "publish" button. You can visit `admin/publishall` to publish +publish your draft content. Go to the CMS and use the "publish" button. You can visit `admin/pages/publishall` to publish every page on the site, if that's easier. ## I can see unparsed PHP output in my browser diff --git a/docs/en/reference/urlvariabletools.md b/docs/en/reference/urlvariabletools.md index 74d7968e1..c4fe6b5c8 100644 --- a/docs/en/reference/urlvariabletools.md +++ b/docs/en/reference/urlvariabletools.md @@ -59,8 +59,8 @@ Redirections](security#redirect_back_to_another_page_after_login) for more infor | Site URL | | Action | | -------- | | ------ | | http://yoursite.com**/dev/build** | | Rebuild the entire database and manifest, see below for additional URL Variables | - | http://yoursite.com**/admin/publishall/** | | Publish all pages on the site - + | http://yoursite.com**/admin/pages/publishall/** | | Publish all pages on the site + ### /dev/build | URL Variable | | Values | | Description | diff --git a/filesystem/GD.php b/filesystem/GD.php index ac28bbd14..e4af07982 100644 --- a/filesystem/GD.php +++ b/filesystem/GD.php @@ -351,7 +351,6 @@ class GDBackend extends Object implements Image_Backend { */ public function paddedResize($width, $height, $backgroundColor = "FFFFFF") { if(!$this->gd) return; - $width = round($width); $height = round($height); diff --git a/forms/CheckboxField.php b/forms/CheckboxField.php index 6adf1a325..7f0c6c814 100644 --- a/forms/CheckboxField.php +++ b/forms/CheckboxField.php @@ -56,7 +56,7 @@ class CheckboxField_Readonly extends ReadonlyField { } public function Value() { - return Convert::raw2xml($this->value ? _t('CheckboxField.YES', 'Yes') : _t('CheckboxField.NO', 'No')); + return Convert::raw2xml($this->value ? _t('CheckboxField.YESANSWER', 'Yes') : _t('CheckboxField.NOANSWER', 'No')); } } diff --git a/lang/en.yml b/lang/en.yml index 3c1d2561b..40a64be71 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -60,8 +60,8 @@ en: ERRORNOTREC: 'That username / password isn''t recognised' Boolean: ANY: Any - NO: No - YES: Yes + NOANSWER: No + YESANSWER: Yes CMSLoadingScreen.ss: LOADING: Loading... REQUIREJS: 'The CMS requires that you have JavaScript enabled.' @@ -79,8 +79,8 @@ en: HELLO: Hi PASSWORD: Password CheckboxField: - NO: No - YES: Yes + NOANSWER: No + YESANSWER: Yes ComplexTableField: CLOSEPOPUP: 'Close Popup' SUCCESSADD2: 'Added {name}' diff --git a/model/Image.php b/model/Image.php index 8d551a64f..ecdf33079 100644 --- a/model/Image.php +++ b/model/Image.php @@ -346,10 +346,10 @@ class Image extends File { * @param integer $height The height to size to * @return Image */ - public function PaddedImage($width, $height) { + public function PaddedImage($width, $height, $backgroundColor=null) { return $this->isSize($width, $height) ? $this - : $this->getFormattedImage('PaddedImage', $width, $height); + : $this->getFormattedImage('PaddedImage', $width, $height, $backgroundColor); } /** @@ -360,8 +360,8 @@ class Image extends File { * @param integer $height The height to size to * @return Image_Backend */ - public function generatePaddedImage(Image_Backend $backend, $width, $height) { - return $backend->paddedResize($width, $height); + public function generatePaddedImage(Image_Backend $backend, $width, $height, $backgroundColor=null) { + return $backend->paddedResize($width, $height, $backgroundColor); } /** @@ -399,17 +399,20 @@ class Image extends File { * Return an image object representing the image in the given format. * This image will be generated using generateFormattedImage(). * The generated image is cached, to flush the cache append ?flush=1 to your URL. + * + * Just pass the correct number of parameters expected by the working function + * * @param string $format The name of the format. - * @param string $arg1 An argument to pass to the generate function. - * @param string $arg2 A second argument to pass to the generate function. * @return Image_Cached */ - public function getFormattedImage($format, $arg1 = null, $arg2 = null) { + public function getFormattedImage($format) { + $args = func_get_args(); + if($this->ID && $this->Filename && Director::fileExists($this->Filename)) { - $cacheFile = $this->cacheFilename($format, $arg1, $arg2); - + $cacheFile = call_user_func_array(array($this, "cacheFilename"), $args); + if(!file_exists(Director::baseFolder()."/".$cacheFile) || isset($_GET['flush'])) { - $this->generateFormattedImage($format, $arg1, $arg2); + call_user_func_array(array($this, "generateFormattedImage"), $args); } $cached = new Image_Cached($cacheFile); @@ -424,14 +427,14 @@ class Image extends File { /** * Return the filename for the cached image, given it's format name and arguments. * @param string $format The format name. - * @param string $arg1 The first argument passed to the generate function. - * @param string $arg2 The second argument passed to the generate function. * @return string */ - public function cacheFilename($format, $arg1 = null, $arg2 = null) { + public function cacheFilename($format) { + $args = func_get_args(); + array_shift($args); $folder = $this->ParentID ? $this->Parent()->Filename : ASSETS_DIR . "/"; - $format = $format.$arg1.'x'.$arg2; + $format = $format.implode('x', $args); return $folder . "_resampled/$format-" . $this->Name; } @@ -442,11 +445,11 @@ class Image extends File { * using the specific 'generate' method for the specified format. * * @param string $format Name of the format to generate. - * @param string $arg1 Argument to pass to the generate method. - * @param string $arg2 A second argument to pass to the generate method. */ - public function generateFormattedImage($format, $arg1 = null, $arg2 = null) { - $cacheFile = $this->cacheFilename($format, $arg1, $arg2); + public function generateFormattedImage($format) { + $args = func_get_args(); + + $cacheFile = call_user_func_array(array($this, "cacheFilename"), $args); $backend = Injector::inst()->createWithArgs(self::$backend, array( Director::baseFolder()."/" . $this->Filename @@ -456,7 +459,11 @@ class Image extends File { $generateFunc = "generate$format"; if($this->hasMethod($generateFunc)){ - $backend = $this->$generateFunc($backend, $arg1, $arg2); + + array_shift($args); + array_unshift($args, $backend); + + $backend = call_user_func_array(array($this, $generateFunc), $args); if($backend){ $backend->writeTo(Director::baseFolder()."/" . $cacheFile); } @@ -560,7 +567,7 @@ class Image extends File { // All generate functions may appear any number of times in the image cache name. $generateFuncs = implode('|', $generateFuncs); $pattern = "/^((?P{$generateFuncs})(?P\d*)x(?P\d*)\-)+" . preg_quote($this->Name) . "$/i"; - + foreach($cachedFiles as $cfile) { if(preg_match($pattern, $cfile, $matches)) { if(Director::fileExists($cacheDir . $cfile)) { diff --git a/model/fieldtypes/Boolean.php b/model/fieldtypes/Boolean.php index 2b363ee3d..0431813bb 100644 --- a/model/fieldtypes/Boolean.php +++ b/model/fieldtypes/Boolean.php @@ -27,7 +27,7 @@ class Boolean extends DBField { } public function Nice() { - return ($this->value) ? _t('Boolean.YES', 'Yes') : _t('Boolean.NO', 'No'); + return ($this->value) ? _t('Boolean.YESANSWER', 'Yes') : _t('Boolean.NOANSWER', 'No'); } public function NiceAsBoolean() { @@ -53,8 +53,8 @@ class Boolean extends DBField { public function scaffoldSearchField($title = null) { $anyText = _t('Boolean.ANY', 'Any'); $source = array( - 1 => _t('Boolean.YES', 'Yes'), - 0 => _t('Boolean.NO', 'No') + 1 => _t('Boolean.YESANSWER', 'Yes'), + 0 => _t('Boolean.NOANSWER', 'No') ); $field = new DropdownField($this->name, $title, $source); diff --git a/tests/forms/CheckboxFieldTest.php b/tests/forms/CheckboxFieldTest.php index d30392e99..8e21e9041 100644 --- a/tests/forms/CheckboxFieldTest.php +++ b/tests/forms/CheckboxFieldTest.php @@ -123,18 +123,18 @@ class CheckboxFieldTest extends SapphireTest { $field1 = new CheckboxField('IsChecked', 'Checked'); $field1->setValue('on'); $copy = $field1->performReadonlyTransformation(); - $this->assertEquals(_t('CheckboxField.YES', 'Yes'), + $this->assertEquals(_t('CheckboxField.YESANSWER', 'Yes'), trim(strip_tags($field1->performReadonlyTransformation()->Field()))); // Test 2: an checkbox with the value set to false to "No" $field2 = new CheckboxField('IsChecked', 'Checked'); $field2->setValue(false); - $this->assertEquals(_t('CheckboxField.NO', 'No'), + $this->assertEquals(_t('CheckboxField.NOANSWER', 'No'), trim(strip_tags($field2->performReadonlyTransformation()->Field()))); // Test 3: an checkbox with no value ever set goes to "No" $field3 = new CheckboxField('IsChecked', 'Checked'); - $this->assertEquals(_t('CheckboxField.NO', 'No'), + $this->assertEquals(_t('CheckboxField.NOANSWER', 'No'), trim(strip_tags($field3->performReadonlyTransformation()->Field()))); }