|
@@ -4,12 +4,17 @@ namespace Memcache_UI\Core {
|
|
protected $logLevelClasses = NULL;
|
|
protected $logLevelClasses = NULL;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Base URL for the script.
|
|
|
|
|
|
+ * Base URL for the script, for HTTP paths
|
|
*
|
|
*
|
|
* @var string
|
|
* @var string
|
|
*/
|
|
*/
|
|
protected $base;
|
|
protected $base;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Base directory for the script, for file operations
|
|
|
|
+ */
|
|
|
|
+ protected $directory;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Graphics context
|
|
* Graphics context
|
|
*
|
|
*
|
|
@@ -95,6 +100,14 @@ namespace Memcache_UI\Core {
|
|
return $this->base;
|
|
return $this->base;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function getDirectory() {
|
|
|
|
+ if (!isset($this->directory)) {
|
|
|
|
+ $this->directory = dirname($_SERVER['SCRIPT_FILENAME']);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return $this->directory;
|
|
|
|
+ }
|
|
|
|
+
|
|
public function getLogLevel() {
|
|
public function getLogLevel() {
|
|
if (!isset($this->logLevel)) {
|
|
if (!isset($this->logLevel)) {
|
|
$usLogLevel = NULL;
|
|
$usLogLevel = NULL;
|
|
@@ -272,5 +285,23 @@ namespace Memcache_UI\Core {
|
|
static function t($message, $args = array()) {
|
|
static function t($message, $args = array()) {
|
|
return strtr(gettext($message), $args);
|
|
return strtr(gettext($message), $args);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Embryonic version of Drupal url().
|
|
|
|
+ *
|
|
|
|
+ * @param string $path
|
|
|
|
+ * @param array $options
|
|
|
|
+ * - No option currently recognized.
|
|
|
|
+ * - 'absolute' likely at some point
|
|
|
|
+ *
|
|
|
|
+ * @return string
|
|
|
|
+ */
|
|
|
|
+ static function url($path = NULL, $options = array()) {
|
|
|
|
+ $options += array(
|
|
|
|
+ // 'absolute' => FALSE,
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ return $this->getBase() . '?q=' . urlencode($path);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|