Browse Source

Check before using deprecated Js helper

Mark Scherer 10 years ago
parent
commit
791f64fd20
2 changed files with 6 additions and 4 deletions
  1. 3 3
      config/bootstrap.php
  2. 3 1
      src/Template/Element/pagination.ctp

+ 3 - 3
config/bootstrap.php

@@ -175,8 +175,8 @@ function extractFileInfo($filename, $type = null) {
  * Improves it by not returning non-file-name characters from url files if specified.
  * Improves it by not returning non-file-name characters from url files if specified.
  * So "filename.ext?foo=bar#hash" would simply be "filename.ext" then.
  * So "filename.ext?foo=bar#hash" would simply be "filename.ext" then.
  *
  *
- * @param string filename to check on
- * @param string type (extension/ext, filename/file, basename/base, dirname/dir)
+ * @param string $filename to check on
+ * @param string $type (extension/ext, filename/file, basename/base, dirname/dir)
  * @param bool $fromUrl
  * @param bool $fromUrl
  * @return mixed
  * @return mixed
  */
  */
@@ -199,7 +199,7 @@ function extractPathInfo($filename, $type = null, $fromUrl = false) {
 			$infoType = PATHINFO_DIRNAME;
 			$infoType = PATHINFO_DIRNAME;
 			break;
 			break;
 		default:
 		default:
-			$infoType = null;
+			$infoType = $type;
 	}
 	}
 	$result = pathinfo($filename, $infoType);
 	$result = pathinfo($filename, $infoType);
 	if ($fromUrl) {
 	if ($fromUrl) {

+ 3 - 1
src/Template/Element/pagination.ctp

@@ -74,5 +74,7 @@ $escape = isset($escape) ? $escape : true;
 	});
 	});
 });";
 });";
 
 
-	$this->Js->buffer($script);
+	if (isset($this->Js)) {
+		$this->Js->buffer($script);
+	}
 } ?>
 } ?>