3 commits - lib/kolab_client_api.php lib/kolab_client_api_result.php lib/kolab_client_output.php lib/kolab_client_task.php lib/kolab_utils.php
Aleksander Machniak
machniak at kolabsys.com
Thu Feb 23 15:29:47 CET 2012
lib/kolab_client_api.php | 4 +-
lib/kolab_client_api_result.php | 27 ++++++++++++++++
lib/kolab_client_output.php | 67 +++++++++++++++++++++++++++++++++++++---
lib/kolab_client_task.php | 2 -
lib/kolab_utils.php | 4 +-
5 files changed, 95 insertions(+), 9 deletions(-)
New commits:
commit 4b616974b6ecf5d66fa1b8aeb84f381e45844255
Author: Aleksander Machniak <alec at alec.pl>
Date: Thu Feb 23 15:27:10 2012 +0100
More phpdoc
diff --git a/lib/kolab_client_api.php b/lib/kolab_client_api.php
index 6c6401c..b8d101a 100644
--- a/lib/kolab_client_api.php
+++ b/lib/kolab_client_api.php
@@ -22,7 +22,9 @@
+--------------------------------------------------------------------------+
*/
-
+/**
+ * Helper class to connect to the API
+ */
class kolab_client_api
{
/**
diff --git a/lib/kolab_client_output.php b/lib/kolab_client_output.php
index 2cbc862..fe157bb 100644
--- a/lib/kolab_client_output.php
+++ b/lib/kolab_client_output.php
@@ -23,6 +23,9 @@
+--------------------------------------------------------------------------+
*/
+/**
+ * Output functionality for Kolab Web Admin Client
+ */
class kolab_client_output
{
private $tpl_vars = array();
@@ -32,13 +35,21 @@ class kolab_client_output
private $labels = array();
private $skin;
+ /**
+ * Class constructor.
+ *
+ * @param string $skin Interface skin name
+ */
public function __construct($skin = null)
{
$this->skin = $skin ? $skin : 'default';
$this->init();
}
- public function init()
+ /**
+ * Initialization.
+ */
+ private function init()
{
require_once 'Smarty/Smarty.class.php';
@@ -52,6 +63,11 @@ class kolab_client_output
$this->tpl = $SMARTY;
}
+ /**
+ * Sends output to the browser.
+ *
+ * @param string $template HTML template name
+ */
public function send($template = null)
{
if ($this->is_ajax()) {
@@ -62,6 +78,9 @@ class kolab_client_output
}
}
+ /**
+ * JSON output.
+ */
private function send_json()
{
header('Content-Type: application/json');
@@ -98,6 +117,11 @@ class kolab_client_output
return json_encode($response);
}
+ /**
+ * HTML output.
+ *
+ * @param string $template HTML template name
+ */
private function send_tpl($template)
{
if (!$template) {
@@ -142,21 +166,45 @@ class kolab_client_output
$this->tpl->display($template . '.html');
}
+ /**
+ * Request type checker.
+ *
+ * @return bool True on AJAX request, False otherwise
+ */
public function is_ajax()
{
return !empty($_REQUEST['remote']);
}
+ /**
+ * Assigns value to a template variable.
+ *
+ * @param string $name Variable name
+ * @param mixed $value Variable value
+ */
public function assign($name, $value)
{
$this->tpl_vars[$name] = $value;
}
+ /**
+ * Assigns value to browser environment.
+ *
+ * @param string $name Variable name
+ * @param mixed $value Variable value
+ */
public function set_env($name, $value)
{
$this->env[$name] = $value;
}
+ /**
+ * Sets conntent of a HTML object.
+ *
+ * @param string $name Object's identifier (HTML ID attribute)
+ * @param string $content Object's content
+ * @param bool $is_template Set to true if $content is a template name
+ */
public function set_object($name, $content, $is_template = false)
{
if ($is_template) {
@@ -166,6 +214,13 @@ class kolab_client_output
$this->objects[$name] = $content;
}
+ /**
+ * Returns HTML template output.
+ *
+ * @param string $name Template name
+ *
+ * @return string Template output
+ */
public function get_template($name)
{
ob_start();
@@ -176,18 +231,20 @@ class kolab_client_output
return $content;
}
+ /**
+ * Sets javascript command (to be added to the request).
+ */
public function command()
{
$this->commands[] = func_get_args();
}
+ /**
+ * Adds one or more translation labels to the browser env.
+ */
public function add_translation()
{
$this->labels = array_merge($this->labels, func_get_args());
}
- public static function escape($str)
- {
-
- }
}
commit 6a3976668de6b2d294b72da50759d7150b32b9a8
Author: Aleksander Machniak <alec at alec.pl>
Date: Thu Feb 23 15:12:24 2012 +0100
Added phpdoc
diff --git a/lib/kolab_client_api_result.php b/lib/kolab_client_api_result.php
index a46a369..0bf86d8 100644
--- a/lib/kolab_client_api_result.php
+++ b/lib/kolab_client_api_result.php
@@ -22,6 +22,9 @@
+--------------------------------------------------------------------------+
*/
+/**
+ * API result wrapper
+ */
class kolab_client_api_result
{
/**
@@ -33,6 +36,13 @@ class kolab_client_api_result
private $error_str;
+ /**
+ * Class constructor.
+ *
+ * @param array $data Result data
+ * @param int $error_code Error code
+ * @param string $error_str Error message
+ */
public function __construct($data = array(), $error_code = null, $error_str = null)
{
if (is_array($data) && isset($data['result'])) {
@@ -43,16 +53,33 @@ class kolab_client_api_result
$this->error_str = $error_str;
}
+ /**
+ * Error code getter.
+ *
+ * @return int Error code
+ */
public function get_error_code()
{
return $this->error_code;
}
+ /**
+ * Error message getter.
+ *
+ * @return string Error message
+ */
public function get_error_str()
{
return $this->error_str;
}
+ /**
+ * Response data getter.
+ *
+ * @param string $name Response member name
+ *
+ * @return array|string Data member or complete response data (when $name is null)
+ */
public function get($name = null)
{
if ($name !== null) {
commit 43f4daade3e7c4366898f1bf9959be31e46ccfb6
Author: Aleksander Machniak <alec at alec.pl>
Date: Thu Feb 23 15:05:05 2012 +0100
Fixed methods' argument description
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 6a6fac1..c2d479b 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -407,7 +407,7 @@ class kolab_client_task
*
* @param string $name Parameter name
* @param string $type Parameter type (GET|POST|NULL)
- * @param bool $allow_html Enable to strip invalid/unsecure content
+ * @param bool $allow_html Disables stripping of insecure content (HTML tags)
*
* @see kolab_utils::get_input
* @return mixed Input value.
diff --git a/lib/kolab_utils.php b/lib/kolab_utils.php
index 390b9eb..2694f71 100644
--- a/lib/kolab_utils.php
+++ b/lib/kolab_utils.php
@@ -55,7 +55,7 @@ class kolab_utils
*
* @param string $name Parameter name
* @param int $type Parameter type
- * @param bool $allow_html Enable to strip invalid/unsecure content
+ * @param bool $allow_html Disables stripping of insecure content (HTML tags)
*
* @return mixed Input value
*/
@@ -78,7 +78,7 @@ class kolab_utils
* Input parsing.
*
* @param mixed $value Input value
- * @param bool $allow_html Enable to strip invalid/unsecure content
+ * @param bool $allow_html Disables stripping of insecure content (HTML tags)
*
* @return mixed Input value
*/
More information about the commits
mailing list