summaryrefslogtreecommitdiff
path: root/tw/error
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2007-05-19 08:34:02 +0100
committerAndrew Dolgov <[email protected]>2007-05-19 08:34:02 +0100
commit9daf4133bf6f61cbe3787a46b021d261242a85f0 (patch)
tree960e54d1e43010fc72f4df11725af2ad0a718e97 /tw/error
parentff15256d60c571a6137e2d667cae8187b558b84e (diff)
add tagwall
Diffstat (limited to 'tw/error')
-rw-r--r--tw/error/FOO_error.php43
-rw-r--r--tw/error/LINK_error.php94
-rw-r--r--tw/error/__Template_error.php69
3 files changed, 206 insertions, 0 deletions
diff --git a/tw/error/FOO_error.php b/tw/error/FOO_error.php
new file mode 100644
index 000000000..3924768ee
--- /dev/null
+++ b/tw/error/FOO_error.php
@@ -0,0 +1,43 @@
+<?
+/*
+ * tag|wall | PHP Tag Filter|
+ * ---------------------------------------------------------------------
+
+ Copyright (C) 2002 Juraj 'HVGE' Durech
+ Copyright (C) 2002 www.designia.sk
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ * ---------------------------------------------------------------------
+ * tag|wall error module
+ *
+ * description:
+ * - this is default error module.
+ */
+class FOO_error extends TW_errors
+{
+ function FOO_error($options = 0)
+ {
+ $this->TW_errors($options);
+ }
+
+ function add($errval, $position, $show_code, $param1=null, $param2=null )
+ {
+ $this->ErrorArray["TW_err_".$this->identifier++] = array($errval, $param1, $param2, $position, $show_code);
+ if($errval & 0xff00) $this->IsError = 1;
+ return null;
+ }
+}
+?> \ No newline at end of file
diff --git a/tw/error/LINK_error.php b/tw/error/LINK_error.php
new file mode 100644
index 000000000..580e15fbc
--- /dev/null
+++ b/tw/error/LINK_error.php
@@ -0,0 +1,94 @@
+<?
+/*
+ * tag|wall | PHP Tag Filter|
+ * ---------------------------------------------------------------------
+
+ Copyright (C) 2002 Juraj 'HVGE' Durech
+ Copyright (C) 2002 www.designia.sk
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ * ---------------------------------------------------------------------
+ * tag|wall error module
+ *
+ * description:
+ * - this module appending automatic links and colored piece of bad code.
+ *
+ * - Module using following CSS classes (you must define it in your CSS stylesheet)
+ *
+ * .tw-err-int - internal error (in output string)
+ * .tw-err-err - standard error
+ * .tw-err-war - warning
+ * .tw-err-com - comment
+ *
+ * .tw-err-int-l - internal error (in error list)
+ * .tw-err-err-l - standard error
+ * .tw-err-war-l - warning
+ * .tw-err-com-l - comment
+
+ */
+class LINK_error extends TW_errors
+{
+ function LINK_error($options = 0)
+ {
+ $this->TW_errors($options);
+ }
+
+ function add($errval, $position, $show_code, $param1=null, $param2=null )
+ {
+ $err_id = "TW_err_".$this->identifier++;
+ $this->ErrorArray[$err_id] = array($errval, $param1, $param2, $position, $show_code);
+ if($errval & 0xff00) $this->IsError = 1;
+
+ // append errors and warnings
+ if(($errval & 0x0ff0) && $show_code != null )
+ return '<a name="'.$err_id.'"><span class="'.$this->get_error_class($errval).'">'.$show_code.'</span></a>';
+
+ return null;
+ }
+
+ // You can call this method from your project and create nice list of errors.
+ //
+ // $lang - error string pack
+ // $mask - any combination of following masks:
+ // 0xf000 - internal,
+ // 0x0f00 - errors,
+ // 0x00f0 - warnings,
+ // 0x000f - comments
+ //
+ function create_list (&$lang, $mask = 0x0ff0)
+ {
+ $errors = $this->get_by_mask($mask);
+
+ $out = "<ul>";
+ foreach($errors as $key => $value)
+ {
+ $errno = $value[TWE_ERRNO];
+ $piece = '<span class="'.$this->get_error_class($errno).'">'.$value[TWE_CODE].'</span>';
+ $list ='<a href="#'.$key.'">'.$this->get_error_text($key,$lang).$piece.'</a>';
+ $out .= '<li class="'.$this->get_error_class($errno).'-l">'.$list.'</li>';
+ }
+ return $out."</ul>";
+ }
+
+ function get_error_class ($error)
+ {
+ if($error&0xf000) return "tw-err-int";
+ if($error&0x0f00) return "tw-err-err";
+ if($error&0x00f0) return "tw-err-war";
+ return "tw-err-com";
+ }
+}
+?> \ No newline at end of file
diff --git a/tw/error/__Template_error.php b/tw/error/__Template_error.php
new file mode 100644
index 000000000..194f4a272
--- /dev/null
+++ b/tw/error/__Template_error.php
@@ -0,0 +1,69 @@
+<?
+/*
+ * tag|wall ver 0.1.0 | PHP Tag Filter|
+ * ---------------------------------------------------------------------
+
+ Copyright (C) 2002 Juraj 'HVGE' Durech
+ Copyright (C) 2002 www.designia.sk
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ * ---------------------------------------------------------------------
+ * tag|wall error module
+ *
+ * description:
+ * - TODO: add module description
+ *
+ * output modifications:
+ * - TODO: add your output modifications here
+ */
+class ???_error extends TW_errors
+{
+ // TODO: add module depended variables here
+
+ // Class constructor
+ // NOTE: parser calling this with his options. See twParser constructor.
+ //
+ function ???_error($options = 0)
+ {
+ // call parent class constructor
+ $this->TW_errors($options);
+
+ // TODO: add your own module initializations here
+ }
+
+ // You must implement your own add method.
+
+ function add($errval, $position, $show_code, $param1=null, $param2=null )
+ {
+ $err_id = "TW_err_".$this->identifier++;
+ //
+ // This is basic error implementation. Modify this code only if you really need it.
+ //
+ $this->ErrorArray[$err_id] = array($errval, $param1, $param2, $position, $show_code);
+ if($errval & 0xff00) $this->IsError = 1;
+
+ // TODO: create your output additions here, and return it as string
+
+ return null;
+ }
+
+ // TODO:
+ // You can implement ohther methods here.
+ // For example: special error filters, post-parsing functions for generating
+ // error lists, etc...
+
+}
+?> \ No newline at end of file