// These two options enable SMTP authentication when sending
// digests. Require DIGEST_SMTP_HOST.
- define('ENABLE_TAGWALL', true);
- // Disable this if you are having troubles with Tagwall library which
- // is used to strip potentially unsafe content from RSS articles. When
- // disabled, simpler version of processing will be used when needed.
- // Try disabling when having problems with showing articles and/or
- // loading feeds.
-
define('CONFIG_VERSION', 10);
// Expected config version. Please update this option in config.php
// if necessary (after migrating all new options from this file).
require_once 'magpierss/rss_utils.inc';
}
- if (ENABLE_TAGWALL) {
- include_once "tw/tw-config.php";
- include_once "tw/tw.php";
- include_once TW_SETUP . "paranoya.php";
-
- $tw_parser = new twParser();
- }
-
function _debug($msg) {
$ts = strftime("%H:%M:%S", time());
print "[$ts] $msg\n";
if (get_pref($link, "STRIP_UNSAFE_TAGS") || $force_strip_tags) {
- if (ENABLE_TAGWALL) {
- global $tw_parser;
- global $tw_paranoya_setup;
-
- $res = $tw_parser->strip_tags($res, $tw_paranoya_setup);
- } else {
-
- $res = strip_tags_long($res, "<p><a><i><em><b><strong><blockquote><br><img><div><span>");
-
- }
+ $res = strip_tags_long($res,
+ "<p><a><i><em><b><strong><blockquote><br><img><div><span><ul><ol><li>");
// $res = preg_replace("/\r\n|\n|\r/", "", $res);
// $res = strip_tags_long($res, "<p><a><i><em><b><strong><blockquote><br><img><div><span>");
+++ /dev/null
-\r
- Universal (X)HTML Tag Filter\r
- --------------------------------------------\r
- \r
- <Idea,Code>\r
-\r
- Juraj 'HVGE' Durech\r
-\r
- hvge@cauldron.sk\r
- minimal-huge.host.sk\r
-\r
-\r
- <ThanxTo,Support,Respect>\r
-\r
- www.designia.sk\r
- www.martincohen.info\r
- www.fczbkk.com\r
-\r
- --------------------------------------------
\ No newline at end of file
+++ /dev/null
- GNU GENERAL PUBLIC LICENSE\r
- Version 2, June 1991\r
-\r
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.\r
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- Everyone is permitted to copy and distribute verbatim copies\r
- of this license document, but changing it is not allowed.\r
-\r
- Preamble\r
-\r
- The licenses for most software are designed to take away your\r
-freedom to share and change it. By contrast, the GNU General Public\r
-License is intended to guarantee your freedom to share and change free\r
-software--to make sure the software is free for all its users. This\r
-General Public License applies to most of the Free Software\r
-Foundation's software and to any other program whose authors commit to\r
-using it. (Some other Free Software Foundation software is covered by\r
-the GNU Library General Public License instead.) You can apply it to\r
-your programs, too.\r
-\r
- When we speak of free software, we are referring to freedom, not\r
-price. Our General Public Licenses are designed to make sure that you\r
-have the freedom to distribute copies of free software (and charge for\r
-this service if you wish), that you receive source code or can get it\r
-if you want it, that you can change the software or use pieces of it\r
-in new free programs; and that you know you can do these things.\r
-\r
- To protect your rights, we need to make restrictions that forbid\r
-anyone to deny you these rights or to ask you to surrender the rights.\r
-These restrictions translate to certain responsibilities for you if you\r
-distribute copies of the software, or if you modify it.\r
-\r
- For example, if you distribute copies of such a program, whether\r
-gratis or for a fee, you must give the recipients all the rights that\r
-you have. You must make sure that they, too, receive or can get the\r
-source code. And you must show them these terms so they know their\r
-rights.\r
-\r
- We protect your rights with two steps: (1) copyright the software, and\r
-(2) offer you this license which gives you legal permission to copy,\r
-distribute and/or modify the software.\r
-\r
- Also, for each author's protection and ours, we want to make certain\r
-that everyone understands that there is no warranty for this free\r
-software. If the software is modified by someone else and passed on, we\r
-want its recipients to know that what they have is not the original, so\r
-that any problems introduced by others will not reflect on the original\r
-authors' reputations.\r
-\r
- Finally, any free program is threatened constantly by software\r
-patents. We wish to avoid the danger that redistributors of a free\r
-program will individually obtain patent licenses, in effect making the\r
-program proprietary. To prevent this, we have made it clear that any\r
-patent must be licensed for everyone's free use or not licensed at all.\r
-\r
- The precise terms and conditions for copying, distribution and\r
-modification follow.\r
-\f\r
- GNU GENERAL PUBLIC LICENSE\r
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\r
-\r
- 0. This License applies to any program or other work which contains\r
-a notice placed by the copyright holder saying it may be distributed\r
-under the terms of this General Public License. The "Program", below,\r
-refers to any such program or work, and a "work based on the Program"\r
-means either the Program or any derivative work under copyright law:\r
-that is to say, a work containing the Program or a portion of it,\r
-either verbatim or with modifications and/or translated into another\r
-language. (Hereinafter, translation is included without limitation in\r
-the term "modification".) Each licensee is addressed as "you".\r
-\r
-Activities other than copying, distribution and modification are not\r
-covered by this License; they are outside its scope. The act of\r
-running the Program is not restricted, and the output from the Program\r
-is covered only if its contents constitute a work based on the\r
-Program (independent of having been made by running the Program).\r
-Whether that is true depends on what the Program does.\r
-\r
- 1. You may copy and distribute verbatim copies of the Program's\r
-source code as you receive it, in any medium, provided that you\r
-conspicuously and appropriately publish on each copy an appropriate\r
-copyright notice and disclaimer of warranty; keep intact all the\r
-notices that refer to this License and to the absence of any warranty;\r
-and give any other recipients of the Program a copy of this License\r
-along with the Program.\r
-\r
-You may charge a fee for the physical act of transferring a copy, and\r
-you may at your option offer warranty protection in exchange for a fee.\r
-\r
- 2. You may modify your copy or copies of the Program or any portion\r
-of it, thus forming a work based on the Program, and copy and\r
-distribute such modifications or work under the terms of Section 1\r
-above, provided that you also meet all of these conditions:\r
-\r
- a) You must cause the modified files to carry prominent notices\r
- stating that you changed the files and the date of any change.\r
-\r
- b) You must cause any work that you distribute or publish, that in\r
- whole or in part contains or is derived from the Program or any\r
- part thereof, to be licensed as a whole at no charge to all third\r
- parties under the terms of this License.\r
-\r
- c) If the modified program normally reads commands interactively\r
- when run, you must cause it, when started running for such\r
- interactive use in the most ordinary way, to print or display an\r
- announcement including an appropriate copyright notice and a\r
- notice that there is no warranty (or else, saying that you provide\r
- a warranty) and that users may redistribute the program under\r
- these conditions, and telling the user how to view a copy of this\r
- License. (Exception: if the Program itself is interactive but\r
- does not normally print such an announcement, your work based on\r
- the Program is not required to print an announcement.)\r
-\f\r
-These requirements apply to the modified work as a whole. If\r
-identifiable sections of that work are not derived from the Program,\r
-and can be reasonably considered independent and separate works in\r
-themselves, then this License, and its terms, do not apply to those\r
-sections when you distribute them as separate works. But when you\r
-distribute the same sections as part of a whole which is a work based\r
-on the Program, the distribution of the whole must be on the terms of\r
-this License, whose permissions for other licensees extend to the\r
-entire whole, and thus to each and every part regardless of who wrote it.\r
-\r
-Thus, it is not the intent of this section to claim rights or contest\r
-your rights to work written entirely by you; rather, the intent is to\r
-exercise the right to control the distribution of derivative or\r
-collective works based on the Program.\r
-\r
-In addition, mere aggregation of another work not based on the Program\r
-with the Program (or with a work based on the Program) on a volume of\r
-a storage or distribution medium does not bring the other work under\r
-the scope of this License.\r
-\r
- 3. You may copy and distribute the Program (or a work based on it,\r
-under Section 2) in object code or executable form under the terms of\r
-Sections 1 and 2 above provided that you also do one of the following:\r
-\r
- a) Accompany it with the complete corresponding machine-readable\r
- source code, which must be distributed under the terms of Sections\r
- 1 and 2 above on a medium customarily used for software interchange; or,\r
-\r
- b) Accompany it with a written offer, valid for at least three\r
- years, to give any third party, for a charge no more than your\r
- cost of physically performing source distribution, a complete\r
- machine-readable copy of the corresponding source code, to be\r
- distributed under the terms of Sections 1 and 2 above on a medium\r
- customarily used for software interchange; or,\r
-\r
- c) Accompany it with the information you received as to the offer\r
- to distribute corresponding source code. (This alternative is\r
- allowed only for noncommercial distribution and only if you\r
- received the program in object code or executable form with such\r
- an offer, in accord with Subsection b above.)\r
-\r
-The source code for a work means the preferred form of the work for\r
-making modifications to it. For an executable work, complete source\r
-code means all the source code for all modules it contains, plus any\r
-associated interface definition files, plus the scripts used to\r
-control compilation and installation of the executable. However, as a\r
-special exception, the source code distributed need not include\r
-anything that is normally distributed (in either source or binary\r
-form) with the major components (compiler, kernel, and so on) of the\r
-operating system on which the executable runs, unless that component\r
-itself accompanies the executable.\r
-\r
-If distribution of executable or object code is made by offering\r
-access to copy from a designated place, then offering equivalent\r
-access to copy the source code from the same place counts as\r
-distribution of the source code, even though third parties are not\r
-compelled to copy the source along with the object code.\r
-\f\r
- 4. You may not copy, modify, sublicense, or distribute the Program\r
-except as expressly provided under this License. Any attempt\r
-otherwise to copy, modify, sublicense or distribute the Program is\r
-void, and will automatically terminate your rights under this License.\r
-However, parties who have received copies, or rights, from you under\r
-this License will not have their licenses terminated so long as such\r
-parties remain in full compliance.\r
-\r
- 5. You are not required to accept this License, since you have not\r
-signed it. However, nothing else grants you permission to modify or\r
-distribute the Program or its derivative works. These actions are\r
-prohibited by law if you do not accept this License. Therefore, by\r
-modifying or distributing the Program (or any work based on the\r
-Program), you indicate your acceptance of this License to do so, and\r
-all its terms and conditions for copying, distributing or modifying\r
-the Program or works based on it.\r
-\r
- 6. Each time you redistribute the Program (or any work based on the\r
-Program), the recipient automatically receives a license from the\r
-original licensor to copy, distribute or modify the Program subject to\r
-these terms and conditions. You may not impose any further\r
-restrictions on the recipients' exercise of the rights granted herein.\r
-You are not responsible for enforcing compliance by third parties to\r
-this License.\r
-\r
- 7. If, as a consequence of a court judgment or allegation of patent\r
-infringement or for any other reason (not limited to patent issues),\r
-conditions are imposed on you (whether by court order, agreement or\r
-otherwise) that contradict the conditions of this License, they do not\r
-excuse you from the conditions of this License. If you cannot\r
-distribute so as to satisfy simultaneously your obligations under this\r
-License and any other pertinent obligations, then as a consequence you\r
-may not distribute the Program at all. For example, if a patent\r
-license would not permit royalty-free redistribution of the Program by\r
-all those who receive copies directly or indirectly through you, then\r
-the only way you could satisfy both it and this License would be to\r
-refrain entirely from distribution of the Program.\r
-\r
-If any portion of this section is held invalid or unenforceable under\r
-any particular circumstance, the balance of the section is intended to\r
-apply and the section as a whole is intended to apply in other\r
-circumstances.\r
-\r
-It is not the purpose of this section to induce you to infringe any\r
-patents or other property right claims or to contest validity of any\r
-such claims; this section has the sole purpose of protecting the\r
-integrity of the free software distribution system, which is\r
-implemented by public license practices. Many people have made\r
-generous contributions to the wide range of software distributed\r
-through that system in reliance on consistent application of that\r
-system; it is up to the author/donor to decide if he or she is willing\r
-to distribute software through any other system and a licensee cannot\r
-impose that choice.\r
-\r
-This section is intended to make thoroughly clear what is believed to\r
-be a consequence of the rest of this License.\r
-\f\r
- 8. If the distribution and/or use of the Program is restricted in\r
-certain countries either by patents or by copyrighted interfaces, the\r
-original copyright holder who places the Program under this License\r
-may add an explicit geographical distribution limitation excluding\r
-those countries, so that distribution is permitted only in or among\r
-countries not thus excluded. In such case, this License incorporates\r
-the limitation as if written in the body of this License.\r
-\r
- 9. The Free Software Foundation may publish revised and/or new versions\r
-of the General Public License from time to time. Such new versions will\r
-be similar in spirit to the present version, but may differ in detail to\r
-address new problems or concerns.\r
-\r
-Each version is given a distinguishing version number. If the Program\r
-specifies a version number of this License which applies to it and "any\r
-later version", you have the option of following the terms and conditions\r
-either of that version or of any later version published by the Free\r
-Software Foundation. If the Program does not specify a version number of\r
-this License, you may choose any version ever published by the Free Software\r
-Foundation.\r
-\r
- 10. If you wish to incorporate parts of the Program into other free\r
-programs whose distribution conditions are different, write to the author\r
-to ask for permission. For software which is copyrighted by the Free\r
-Software Foundation, write to the Free Software Foundation; we sometimes\r
-make exceptions for this. Our decision will be guided by the two goals\r
-of preserving the free status of all derivatives of our free software and\r
-of promoting the sharing and reuse of software generally.\r
-\r
- NO WARRANTY\r
-\r
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\r
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\r
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\r
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\r
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\r
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\r
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\r
-REPAIR OR CORRECTION.\r
-\r
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\r
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\r
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\r
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\r
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\r
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\r
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\r
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\r
-POSSIBILITY OF SUCH DAMAGES.\r
-\r
- END OF TERMS AND CONDITIONS\r
-\f\r
- How to Apply These Terms to Your New Programs\r
-\r
- If you develop a new program, and you want it to be of the greatest\r
-possible use to the public, the best way to achieve this is to make it\r
-free software which everyone can redistribute and change under these terms.\r
-\r
- To do so, attach the following notices to the program. It is safest\r
-to attach them to the start of each source file to most effectively\r
-convey the exclusion of warranty; and each file should have at least\r
-the "copyright" line and a pointer to where the full notice is found.\r
-\r
- <one line to give the program's name and a brief idea of what it does.>\r
- Copyright (C) <year> <name of author>\r
-\r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
-\r
-\r
-Also add information on how to contact you by electronic and paper mail.\r
-\r
-If the program is interactive, make it output a short notice like this\r
-when it starts in an interactive mode:\r
-\r
- Gnomovision version 69, Copyright (C) year name of author\r
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\r
- This is free software, and you are welcome to redistribute it\r
- under certain conditions; type `show c' for details.\r
-\r
-The hypothetical commands `show w' and `show c' should show the appropriate\r
-parts of the General Public License. Of course, the commands you use may\r
-be called something other than `show w' and `show c'; they could even be\r
-mouse-clicks or menu items--whatever suits your program.\r
-\r
-You should also get your employer (if you work as a programmer) or your\r
-school, if any, to sign a "copyright disclaimer" for the program, if\r
-necessary. Here is a sample; alter the names:\r
-\r
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program\r
- `Gnomovision' (which makes passes at compilers) written by James Hacker.\r
-\r
- <signature of Ty Coon>, 1 April 1989\r
- Ty Coon, President of Vice\r
-\r
-This General Public License does not permit incorporating your program into\r
-proprietary programs. If your program is a subroutine library, you may\r
-consider it more useful to permit linking proprietary applications with the\r
-library. If this is what you want to do, use the GNU Library General\r
-Public License instead of this License.\r
+++ /dev/null
-<?php\r
-/*\r
- * tag|wall | PHP Tag Filter|\r
- * ---------------------------------------------------------------------\r
-\r
- Copyright (C) 2002 Juraj 'HVGE' Durech\r
- Copyright (C) 2002 www.designia.sk\r
- \r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
- \r
- * ---------------------------------------------------------------------\r
- * tag|wall error module \r
- *\r
- * description:\r
- * - this is default error module.\r
- */\r
-class FOO_error extends TW_errors\r
-{\r
- function FOO_error($options = 0)\r
- {\r
- $this->TW_errors($options);\r
- }\r
- \r
- function add($errval, $position, $show_code, $param1=null, $param2=null )\r
- {\r
- $this->ErrorArray["TW_err_".$this->identifier++] = array($errval, $param1, $param2, $position, $show_code);\r
- if($errval & 0xff00) $this->IsError = 1;\r
- return null;\r
- }\r
-}\r
-?>\r
+++ /dev/null
-<?php\r
-/*\r
- * tag|wall | PHP Tag Filter|\r
- * ---------------------------------------------------------------------\r
-\r
- Copyright (C) 2002 Juraj 'HVGE' Durech\r
- Copyright (C) 2002 www.designia.sk\r
- \r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
- \r
- * ---------------------------------------------------------------------\r
- * tag|wall error module\r
- *\r
- * description:\r
- * - this module appending automatic links and colored piece of bad code.\r
- *\r
- * - Module using following CSS classes (you must define it in your CSS stylesheet)\r
- *\r
- * .tw-err-int - internal error (in output string)\r
- * .tw-err-err - standard error\r
- * .tw-err-war - warning\r
- * .tw-err-com - comment\r
- *\r
- * .tw-err-int-l - internal error (in error list)\r
- * .tw-err-err-l - standard error\r
- * .tw-err-war-l - warning\r
- * .tw-err-com-l - comment\r
-\r
- */\r
-class LINK_error extends TW_errors\r
-{\r
- function LINK_error($options = 0)\r
- {\r
- $this->TW_errors($options);\r
- }\r
- \r
- function add($errval, $position, $show_code, $param1=null, $param2=null )\r
- {\r
- $err_id = "TW_err_".$this->identifier++;\r
- $this->ErrorArray[$err_id] = array($errval, $param1, $param2, $position, $show_code);\r
- if($errval & 0xff00) $this->IsError = 1;\r
- \r
- // append errors and warnings\r
- if(($errval & 0x0ff0) && $show_code != null )\r
- return '<a name="'.$err_id.'"><span class="'.$this->get_error_class($errval).'">'.$show_code.'</span></a>';\r
- \r
- return null;\r
- }\r
- \r
- // You can call this method from your project and create nice list of errors.\r
- //\r
- // $lang - error string pack\r
- // $mask - any combination of following masks:\r
- // 0xf000 - internal, \r
- // 0x0f00 - errors, \r
- // 0x00f0 - warnings, \r
- // 0x000f - comments\r
- //\r
- function create_list (&$lang, $mask = 0x0ff0)\r
- {\r
- $errors = $this->get_by_mask($mask);\r
- \r
- $out = "<ul>";\r
- foreach($errors as $key => $value)\r
- {\r
- $errno = $value[TWE_ERRNO];\r
- $piece = '<span class="'.$this->get_error_class($errno).'">'.$value[TWE_CODE].'</span>';\r
- $list ='<a href="#'.$key.'">'.$this->get_error_text($key,$lang).$piece.'</a>';\r
- $out .= '<li class="'.$this->get_error_class($errno).'-l">'.$list.'</li>';\r
- } \r
- return $out."</ul>";\r
- }\r
- \r
- function get_error_class ($error)\r
- {\r
- if($error&0xf000) return "tw-err-int";\r
- if($error&0x0f00) return "tw-err-err";\r
- if($error&0x00f0) return "tw-err-war";\r
- return "tw-err-com";\r
- }\r
-}\r
-?>\r
+++ /dev/null
-<?php\r
-/*\r
- * tag|wall ver 0.1.0 | PHP Tag Filter|\r
- * ---------------------------------------------------------------------\r
-\r
- Copyright (C) 2002 Juraj 'HVGE' Durech\r
- Copyright (C) 2002 www.designia.sk\r
- \r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
- \r
- * ---------------------------------------------------------------------\r
- * tag|wall error module \r
- *\r
- * description:\r
- * - TODO: add module description\r
- *\r
- * output modifications:\r
- * - TODO: add your output modifications here\r
- */\r
-class ???_error extends TW_errors\r
-{\r
- // TODO: add module depended variables here\r
- \r
- // Class constructor\r
- // NOTE: parser calling this with his options. See twParser constructor.\r
- //\r
- function ???_error($options = 0)\r
- {\r
- // call parent class constructor\r
- $this->TW_errors($options);\r
- \r
- // TODO: add your own module initializations here\r
- }\r
- \r
- // You must implement your own add method.\r
- \r
- function add($errval, $position, $show_code, $param1=null, $param2=null )\r
- {\r
- $err_id = "TW_err_".$this->identifier++;\r
- //\r
- // This is basic error implementation. Modify this code only if you really need it.\r
- // \r
- $this->ErrorArray[$err_id] = array($errval, $param1, $param2, $position, $show_code);\r
- if($errval & 0xff00) $this->IsError = 1;\r
-\r
- // TODO: create your output additions here, and return it as string\r
-\r
- return null;\r
- }\r
- \r
- // TODO:\r
- // You can implement ohther methods here. \r
- // For example: special error filters, post-parsing functions for generating \r
- // error lists, etc...\r
-\r
-}\r
-?>\r
+++ /dev/null
-<?php\r
- // WARNING:\r
- //\r
- // All tags used in configuration must be defined in tw/tw-tags.php file too.\r
- //\r
-\r
- $tw_paranoya_setup = array(\r
- \r
- "a" => array(\r
- "href" => array( TW_RQ_URL ), // value is required url \r
- "name" => array( TW_RQ_LINK ), // value is link (link+href combination must be fixed in base)\r
- "title" => null,\r
- "target" => null,\r
- ),\r
- \r
- "hr" => null, // without attributes\r
- "br" => null,\r
- "img" => array(\r
- "width" => array( TW_NUM ), // 80 - default, number must be in range <60,120>\r
- "height"=> array( TW_NUM ),\r
- "src" => array( TW_RQ_URL ),\r
- "title" => null,\r
- "border"=> array( TW_RQ_NUM, 0, 0, 0),\r
- ),\r
-\r
- "p" => array(\r
- // null - default value (null = remove attr if value not found in case array)\r
- "class" => array( TW_CASE, null, array("par1","par2","par3") ),\r
- ),\r
- \r
- "b" => "strong", // tag substitution <b> -> <strong>\r
- "strong" => null, // new tag must be configured too\r
- "i" => null,\r
- "u" => null,\r
- "div" => array(\r
- "title" => null,\r
- ),\r
- \r
- "span" => array(\r
- "class" => array( TW_CASE, null, array("my-class1","my-class2","my-class3") ),\r
- ),\r
- \r
- "blockquote" => null,\r
- "h1" => null,\r
- "h2" => null,\r
- "h3" => null,\r
- \r
- "table" => null,\r
- "td" => null,\r
- "tr" => null,\r
- "th" => null,\r
- \r
- "ul" => null,\r
- "ol" => null,\r
- "li" => null,\r
- "dl" => null,\r
- "dt" => null,\r
- "dd" => null,\r
- );\r
-?>\r
+++ /dev/null
-<?php\r
-/*\r
- * tag|wall | PHP Tag Filter |\r
- * ---------------------------------------------------------------------\r
-\r
- Copyright (C) 2002 Juraj 'HVGE' Durech\r
- Copyright (C) 2002 www.designia.sk\r
- \r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
- \r
- * ---------------------------------------------------------------------\r
- */\r
-\r
-/*\r
- * $this->pt text\r
- * $this->pti text index\r
- */\r
-class TW_base // TW_lang extends this class\r
-{\r
- var $error; // error module object\r
- var $output; // output module object\r
- var $out; // output string\r
- \r
- var $content_off;\r
- \r
- var $tags; // relationships between tags\r
- var $config; // current configuration (twParser::strip_tags())\r
- var $config_tags; // tags in current configuration\r
- var $config_attr; // attributes in current configuration\r
- var $config_req_attr; // required attributes\r
- \r
-\r
- var $TAG;\r
- var $is_attributes;\r
- var $ATTRIBUTES; // index => array("atr","value")\r
- var $ATTR; // array(atr,value)\r
- var $VALUE;\r
- \r
-/********************************************************************************************\r
- * BASE CONSTRUCTOR \r
- */\r
- function TW_base()\r
- {\r
- global $tw_tag_relations;\r
- \r
- $this->stack();\r
- $this->tags = &$tw_tag_relations;\r
- $this->content_off = 0;\r
- }\r
-/*\r
- * BASE "DESTRUCTOR" (parser call this function if end of string is rached)\r
- */\r
- function base_end()\r
- {\r
- while( $tag = $this->stack_pop() )\r
- {\r
- $this->out .= $this->output->close( $tag );\r
- }\r
- return null;\r
- }\r
-\r
-\r
-/********************************************************************************************\r
- * TAG STACK implementation\r
- */\r
- var $Tstack;\r
-\r
- function stack() { $this->Tstack[0] = null; }\r
- function stack_push( $tag ) { array_unshift( $this->Tstack, $tag ); }\r
- function stack_pop() { return array_shift( $this->Tstack ); }\r
- function stack_search( $tag ) { return in_array( $tag, $this->Tstack ); }\r
-\r
- function stack_top( $tag = null )\r
- {\r
- if( $tag ) return $this->Tstack[0] == $tag;\r
- return $this->Tstack[0];\r
- }\r
-\r
-\r
-\r
-\r
-/********************************************************************************************\r
- * S T A R T _ T A G _ f i l t e r <tag atr=value>\r
- *\r
- */ \r
- \r
- function START_TAG_filter()\r
- {\r
- $tag = $this->TAG;\r
- if( $tag == null )\r
- {\r
- //###### syntax error\r
- return;\r
- }\r
- if( in_array($tag,$this->config_tags) )\r
- {\r
- //enabled tag\r
-\r
- if(is_string($this->config_attr[$tag]))\r
- {\r
- $this->TAG = $tag = $this->config_attr[$tag];\r
- //tag substitution warning\r
- }\r
- \r
- // ------- perform attribute check -----------\r
- \r
- if($this->is_attributes)\r
- {\r
- if(!$this->config_attr[$tag])\r
- {\r
- $this->ATTRIBUTES = null;\r
- // remove attribute warning\r
- }\r
- else\r
- {\r
- foreach( $this->ATTRIBUTES as $key => $attr )\r
- {\r
- if( ! in_array($attr[0], $this->config_attr[$tag] ) )\r
- {\r
- $this->ATTRIBUTES[$key][1] = null;\r
- // remove attribute warning\r
- continue;\r
- }\r
- \r
- // --------- perform value check -----------\r
- \r
- if(($val = $attr[1])==null) continue;\r
- if(($cmda = &$this->config[$tag][$attr[0]])==null) continue; //null - accept all values\r
- switch($cmda[0] & 7)\r
- {\r
- case TW_URL:\r
- // V0.1.2: fixed some fatal bugs, big thanx to fczbkk
- //
- // TODO: make better url check with parse_url()
- \r
-// $val = strtolower($val);\r
- if(stripos($val, "http://") === false)\r
- {\r
- if(stripos($val, "ftp://") === false)\r
- if(stripos($val, "email:") === false)
- if(stripos($val, "https://") === false)
- if(stripos($val, "./") === false) // local relative url
- $val = "http://".$val;\r
- }\r
- $this->ATTRIBUTES[$key][1] = $val;\r
- break;\r
- \r
- case TW_LINK:\r
- //TODO: add link separator check here.\r
- // Do not use this attribute in config!
- break;\r
- \r
- case TW_NUM:\r
- if( $val >= $cmda[2] && $val <= $cmda[3] ) break;\r
- $this->ATTRIBUTES[$key][1] = $cmda[1];\r
- break;\r
- \r
- case TW_CASE:\r
- if( !in_array($val, $cmda[2]) ) $this->ATTRIBUTES[$key][1] = $cmda[1];\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- // check required attributes\r
- if($this->config_req_attr[$tag])\r
- {\r
- if( $this->is_attributes )\r
- foreach( $this->config_req_attr[$tag] as $required )\r
- {\r
- $req_found = 0;\r
- foreach( $this->ATTRIBUTES as $val)\r
- if( $val[0] == $required )\r
- {\r
- $req_found = 1;\r
- break;\r
- }\r
- if($req_found) continue;\r
- \r
- switch( $this->config[$tag][$required][0] & 7 )\r
- {\r
- case TW_LINK:\r
- case TW_URL:\r
- // error\r
- break;\r
- \r
- default:\r
- $this->ATTRIBUTES[$required] = array($required, $this->config[$tag][$required][1]);\r
- break;\r
- }\r
- }\r
- else\r
- {\r
- foreach( $this->config_req_attr[$tag] as $required )\r
- {\r
- switch( $this->config[$tag][$required][0] & 7 )\r
- {\r
- case TW_LINK:\r
- case TW_URL:\r
- \r
- // required tag error\r
- \r
- break;\r
- \r
- default:\r
- $this->ATTRIBUTES[$required] = array($required, $this->config[$tag][$required][1]);\r
- break;\r
- } \r
- }\r
- }\r
- \r
- } \r
- // cross tag removal algorithm\r
- \r
- $flag = $this->tags[$tag];\r
- $top = $this->stack_top();\r
- \r
- if( $flag[2] != null ) // check if tag before is specified\r
- {\r
- // yes, tag before is specified, check relationship\r
- if(! in_array($top, $flag[2]) )\r
- {\r
- if( $flag[0] & TW_OPT ) \r
- {\r
- if( $top == $tag )\r
- {\r
- // End Tag is optional and current tag is the same as last tag (on stack).\r
- // Close previos for XHTML compatibility and open new the same tag.\r
- // Return, because no manipulation with stack is required.\r
- $this->out .= $this->output->close( $tag );\r
- $this->out .= $this->output->pair( $tag, $this->ATTRIBUTES );\r
- return;\r
- }\r
- if( $this->stack_search($tag) )\r
- {\r
- // repair stack\r
- while(($top = $this->stack_pop() ) != $tag )\r
- {\r
- /*if( !($this->tags[$top][0] & TW_OPT ) )\r
- {\r
- // auto close warning\r
- }*/\r
- $this->out .= $this->output->close( $top );\r
- }\r
- $this->stack_push($tag);\r
- $this->out .= $this->output->close( $tag );\r
- $this->out .= $this->output->pair( $tag, $this->ATTRIBUTES );\r
- return;\r
- }\r
- }\r
- // <th>...<td> =>> <th>...</th><td>... (<th> & <td> they have common parent tag (<tr>) )\r
- if( $this->tags[$top][0] & TW_OPT )\r
- {\r
- if( $this->tags[$top][2] == $flag[2] )\r
- {\r
- $this->out .= $this->output->close( $this->stack_pop() );\r
- $this->out .= $this->output->pair( $tag, $this->ATTRIBUTES );\r
- $this->stack_push( $tag );\r
- return;\r
- }\r
- }\r
- // invalid relation between tags #######\r
- return;\r
- }\r
- // valid relationship\r
- }\r
- if( $flag[0] & TW_NOP )\r
- {\r
- //tag without End Tag <br />\r
- $this->out .= $this->output->single( $tag, $this->ATTRIBUTES );\r
- }\r
- else\r
- {\r
- //Tag with End Tag, push to stack\r
- if( ($top == $tag) && ($flag[0] & TW_OPT) )\r
- {\r
- // '<p><p>' => '<p></p><p>'\r
- $this->out .= $this->output->close( $tag );\r
- $this->out .= $this->output->pair( $tag, $this->ATTRIBUTES );\r
- return;\r
- }\r
- $this->out .= $this->output->pair( $tag, $this->ATTRIBUTES );\r
- $this->stack_push( $tag );\r
- }\r
- return;\r
- }\r
- else\r
- {\r
- //disabled tag (or not supported) ######\r
- return;\r
- }\r
- }\r
- \r
-/********************************************************************************************\r
- * E N D _ T A G _ f i l t e r </tag> \r
- *\r
- */\r
- function END_TAG_filter()\r
- {\r
- $tag = $this->TAG;\r
- if( $tag == null ) \r
- {\r
- // </>\r
- if ($tag = $this->stack_pop() )\r
- {\r
- $this->out .= $this->output->close($tag);\r
- return;\r
- }\r
- else\r
- {\r
- // kunda underflow :)\r
- return;\r
- }\r
- }\r
- if(in_array($tag,$this->config_tags))\r
- {\r
- // enabled tag\r
- if(is_string($this->config_attr[$tag]))\r
- {\r
- $this->TAG = $tag = $this->config_attr[$tag];\r
- //tag substitution warning\r
- }\r
-\r
- $top = $this->stack_top( $tag );\r
- if( $top )\r
- {\r
- $this->out .= $this->output->close( $tag );\r
- $this->stack_pop();\r
- return;\r
- }\r
- \r
- if( $this->stack_search($tag) )\r
- {\r
- // closing cross tags\r
- while( ($top = $this->stack_pop()) != $tag )\r
- {\r
- /*if( !($this->tags[$top][0] & TW_OPT ) )\r
- {\r
- // auto close warning\r
- }*/\r
- $this->out .= $this->output->close( $top );\r
- }\r
- $this->out .= $this->output->close( $tag );\r
- }\r
- else\r
- {\r
- // ###### cross tag error\r
- return;\r
- }\r
- }\r
- // drop out warning \r
- }\r
-\r
-\r
-/*\r
- * THERE ARE STATE IN, OUT & NEW FUNCTIONS\r
- *\r
- */\r
- \r
-/********************************************************************************************\r
- * STATE T_begin '<'\r
- */\r
- function T_begin_in()\r
- {\r
- $this->tag_position = $this->pti;\r
- $this->TAG = null;\r
- }\r
-\r
- // --- MAIN TAG-FILTER FUNCTION ---\r
-\r
- function T_begin_out($word)\r
- {\r
- $this->START_TAG_filter();\r
- }\r
-\r
-/********************************************************************************************\r
- * STATE TC_begin '</'\r
- */\r
- function T_Cbegin_in()\r
- {\r
- $this->tag_position = $this->pti;\r
- $this->TAG = null;\r
- }\r
-\r
- // TAG CLOSE function\r
- //\r
- function T_Cbegin_out($word)\r
- {\r
- $this->END_TAG_filter();\r
- }\r
-\r
-/********************************************************************************************\r
- * STATE T_gettag 'tagname'\r
- */\r
- function T_gettag_in() \r
- {\r
- $this->is_attributes = 0;\r
- $this->ATTRIBUTES = null;\r
- return;\r
- }\r
-\r
- function T_gettag_new($word) { $this->TAG = strtolower($word); } \r
- function T_gettag_out($word) { return; }\r
-\r
-/********************************************************************************************\r
- * STATE A_begin '__atr...'\r
- */\r
- function A_begin_in() { $this->ATTR = null; }\r
- function A_begin_new($word) { $this->ATTR[0] = strtolower($word); }\r
- function A_begin_out($word)\r
- {\r
- if( $this->is_attributes )\r
- {\r
- foreach( $this->ATTRIBUTES as $akey => $aval )
- {
- if($this->ATTR[0] == $aval[0])
- {
- // duplicate warning
- $this->ATTRIBUTES[$akey] = $aval;
- return;
- }
- }
- }\r
- else\r
- {\r
- $this->is_attributes = 1;\r
- }\r
- $this->ATTRIBUTES[] = $this->ATTR;\r
- }\r
-\r
-/********************************************************************************************\r
- * STATE V_begin 'atr...'\r
- */\r
- function V_begin_in() { $this->VALUE = null; }\r
- function V_begin_out($word) { $this->ATTR[1] = $this->VALUE; }\r
-\r
-/********************************************************************************************\r
- * STATE VALUE1\r
- */\r
- function VALUE1_in() { return; }\r
- function VALUE1_out($word) { $this->VALUE = substr($word,0,strlen($word)-1); }\r
-\r
-/********************************************************************************************\r
- * STATE VALUE2\r
- */\r
- function VALUE2_in() { return; }\r
- function VALUE2_out($word) \r
- {\r
- $this->VALUE = str_replace("\"", """, substr($word, 0, strlen($word)-1) );\r
- }\r
-/********************************************************************************************\r
- * STATE VALUE3\r
- */\r
- function VALUE3_in() { return; }\r
- function VALUE3_out($word) { $this->VALUE = $word; }\r
- \r
- \r
-} // END class TW_base\r
-?>
+++ /dev/null
-<?php\r
-/*\r
- * tag|wall | PHP Tag Filter |\r
- * ---------------------------------------------------------------------\r
-\r
- Copyright (C) 2002 Juraj 'HVGE' Durech\r
- Copyright (C) 2002 www.designia.sk\r
- \r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
- \r
- * ---------------------------------------------------------------------\r
- * TW - based on SHL Language File\r
- * \r
- * Spolocne so SHL\r
- * - kompatibilita s FSHL generatorom 0.4.x\r
- * - zakladna kostra stavoveho diagramu je spolocna\r
- *\r
- * Rozdiely voci SHL\r
- * - polia maju iny vyznam pretoze spracuva iny stavovy automat\r
- * - vsetky stavy sa volaju rekurentne\r
- *\r
- * function STATE_in() - vola sa pri vstupe do stavu (Ovplyvnuje flag PF_XIO)\r
- * function STATE_out() - vola sa pri opusteni stavu (_RET) (Ovplyvnuje flag PF_XIO)\r
- * tiez hned po navrate z rekurzie flag PF_XDONE sposobi zavolanie\r
- * STATE_out() a opustenie aktualneho stavu (simulovany _RET)\r
- * function STATE_new() - vola sa pri zmene stavu (Ovplyvnuje flag PF_XNEW)\r
- */ \r
-class TW_lang\r
-{\r
- var $states;\r
- var $initial_state;\r
- var $keywords;\r
- var $version;\r
- var $signature;\r
-\r
- function TW_lang()\r
- {\r
- $this->signature = "TW";\r
- $this->version = "1.0";\r
- $this->initial_state="OUT";\r
- $this->states = \r
- array\r
- (\r
- "OUT" => array (\r
- array(\r
- "<" => array("T_tagWall",0),\r
- \r
- //"&" => array("VChar",0), // validate char (currently not implemented in base) \r
- ),\r
-\r
- PF_CLEAN, // PF_CLEAN - znaky sa forwarduju na vystup\r
- 0,0\r
- ),\r
-\r
- "T_tagWall" => array (\r
- array(\r
- "ALPHA" => array("T_begin",1), // normal tag\r
- "/" => array("T_Cbegin",0), // close tag\r
- "<" => array("T_tagWall",1), // '<<<<<<<<' fix (faster than _RET)\r
- "!--" => array("HTML_comment",0),\r
- "_ALL" => array("_RET",0), // '<?' other fixes\r
- ),\r
- \r
- PF_XDONE,\r
- 0,0\r
- ),\r
-\r
-\r
- "T_Cbegin" => array (\r
- array(\r
- "ALPHA" => array("T_gettag",1),\r
- "_ALL" => array("_RET",0),\r
- ),\r
- PF_XIO | PF_XDONE, 0,0\r
- ),\r
-\r
-\r
- "T_begin" => array (\r
- array(\r
- "ALPHA" => array("T_gettag",1),\r
- "_ALL" => array("_RET",0),\r
- ),\r
- \r
- PF_XIO | PF_XDONE, 0,0\r
- ),\r
-\r
- \r
- "T_gettag" => array (\r
- array(\r
- "!ALNUM"=> array("T_in",1),\r
- ),\r
- \r
- PF_XIO | PF_XDONE | PF_XNEW, 0,0\r
- ),\r
-\r
-\r
- "T_in" => array(\r
- array(\r
- "ALPHA" => array("A_begin",1), // char back to stream\r
- ">" => array("_RET",0),\r
- "/>" => array("_RET",0), // pozor na spracovanie v T_begin\r
- ),\r
- \r
- 0,0,0\r
- ),\r
-\r
- "A_begin" => array (\r
- array(\r
- "!ALPHA"=> array("V_begin",1),\r
- ">" => array("_RET",1), // vracia string do streamu\r
- "/>" => array("_RET",1), // pozor na spracovanie v TAGbegin\r
- ),\r
- \r
- PF_XIO | PF_XDONE | PF_XNEW , 0,0\r
- ),\r
-\r
- // this is wide attribute=value implementation\r
- "V_begin" => array (\r
- array(\r
- '"' => array("VALUE1",0),\r
- "'" => array("VALUE2",0),\r
- "ALNUM" => array("VALUE3",1),\r
-\r
- ">" => array("_RET",1),\r
- "/>" => array("_RET",1),\r
- ),\r
-\r
- PF_XIO | PF_XDONE, 0,0\r
- ),\r
- \r
- // "DOUBLEQUOTED VALUE"\r
- "VALUE1" => array(\r
- array(\r
- '"' => array("_RET",0),\r
- ),\r
- PF_XIO, 0,0\r
- ),\r
-\r
- // 'SINGLEQUOTED VALUE'\r
- "VALUE2" => array(\r
- array(\r
- "'" => array("_RET",0),\r
- ),\r
- PF_XIO, 0,0\r
- ),\r
-\r
- // UNQUOTEDVALUE99\r
- "VALUE3" => array(\r
- array(\r
-/* "_" => array ("VALUE3",0), //Uncomment for better HTML4 compatibility (not recommended)\r
- "." => array ("VALUE3",0), \r
-*/\r
- "-" => array ("VALUE3",0),\r
- "!ALNUM"=> array("_RET",1),\r
- ),\r
- PF_XIO, 0,0\r
- ),\r
-\r
- // all comment content will be removed\r
- "HTML_comment" => array(\r
- array(\r
- "-->" => array("_RET",0),\r
- ),\r
- 0,0,0\r
- ),\r
- );\r
- \r
- $this->keywords=null;\r
- }\r
-}\r
-?>\r
+++ /dev/null
-<?\r
-/*\r
- * tag|wall | PHP Tag Filter|\r
- * ---------------------------------------------------------------------\r
-\r
- Copyright (C) 2002 Juraj 'HVGE' Durech\r
- Copyright (C) 2002 www.designia.sk\r
- \r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
- \r
- * ---------------------------------------------------------------------\r
- * tag|wall error strings\r
- *\r
- * NOTE:\r
- * TW not using this file directly. You can include it to your project\r
- * at your opinion. Then you can use method TW_errors::get_error_text()\r
- * for getting error texts. \r
- *\r
- * Please correct my stupid english :)\r
- */\r
-$tw_error_strings = array(\r
- \r
- // comments & tips\r
- TWE_OK => null,\r
- TWE_VERSION => "Versions: parser V %s, language V%s",\r
- TWE_CREDITS => "tag|wall: code Juraj Durech (hvge@cauldron.sk).",\r
- TWE_NOTE => "%s",\r
- \r
- // warnings\r
- TWE_STACK_UNDERFLOW => "Stack underflow, tag '%s' was dropped out.",\r
- TWE_STACK_NOT_EMPTY => "There are some unclosed tags on stack.",\r
- TWE_UNEXPECTED_EOST => "Unexpected end of stream.",\r
- TWE_UNEXPECTED_QUOTE => "Unexpected quote.",\r
- \r
- // errors\r
- TWE_SYNTAX => "HTML syntax error.",\r
- TWE_TOO_MANY_ATTRS => "Too many attributes in tag '%s'.",\r
- \r
- // internal errors\r
- TWE_FILE_NOT_FOUND => "File '%s' not found.",\r
- TWE_BAD_SIGNATURE => "Language '%s' have bad signature '%s'.",\r
- TWE_LANG_NOT_FOUND => "Language '%s' not found.",\r
- \r
- );\r
-?>
\ No newline at end of file
+++ /dev/null
-<?php\r
-/*\r
- * tag|wall | PHP Tag Filter |\r
- * ---------------------------------------------------------------------\r
-\r
- Copyright (C) 2002 Juraj 'HVGE' Durech\r
- Copyright (C) 2002 designia.sk\r
-\r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
- \r
- * ---------------------------------------------------------------------\r
- * HL_DEBUG_output.php xhtml debug output module (highlight tags)\r
- */\r
-\r
-class HL_DEBUG_output\r
-{\r
- function HL_DEBUG_output() { return; }\r
- \r
- // input: string, array()\r
- \r
- function pair ($tag, &$attributes)\r
- {\r
- if($attributes == null)\r
- return $this->highlight( "<$tag>" );\r
- $attr = null;\r
- foreach ($attributes as $value)\r
- {\r
- if($value[1]) $attr .= ' '.$value[0].'="'.$value[1].'"';\r
- }\r
- return $this->highlight( "<$tag$attr>" );\r
- }\r
- \r
- function single ($tag, &$attributes)\r
- {\r
- if($attributes == null)\r
- return $this->highlight( "<$tag />" );\r
- $attr = null;\r
- foreach ($attributes as $value)\r
- {\r
- if($value[1]) $attr .= $value[0].'="'.$value[1].'" ';\r
- }\r
- return $this->highlight( "<$tag $attr/>" );\r
- }\r
- \r
- // template for end tags\r
- function close ($tag) \r
- {\r
- return $this->highlight( "</$tag>" );\r
- }\r
-\r
- function template_end() { return null; }\r
-\r
- \r
- function highlight($string)\r
- {\r
- $string = str_replace("&","&",$string);\r
- return '<span style="background-color:yellow">'.str_replace("<","<",$string).'</span>';\r
- }\r
- \r
-} //END class HTML_output\r
-\r
-?>
\ No newline at end of file
+++ /dev/null
-<?php\r
-/*\r
- * tag|wall | PHP Tag Filter |\r
- * ---------------------------------------------------------------------\r
-\r
- Copyright (C) 2002 Juraj 'HVGE' Durech\r
- Copyright (C) 2002 designia.sk\r
-\r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
- \r
- * ---------------------------------------------------------------------\r
- * HTML_output.php html output module\r
- */\r
-\r
-class HTML_output\r
-{\r
- function HTML_output() { return; }\r
- \r
- // input: string, array()\r
- \r
- function pair ($tag, &$attributes)\r
- {\r
- if($attributes == null)\r
- return "<$tag>";\r
- $attr = null;\r
- foreach ($attributes as $value)\r
- {\r
- if($value[1]) $attr .= ' '.$value[0].'="'.$value[1].'"';\r
- }\r
- return "<$tag$attr>";\r
- }\r
- \r
- function single ($tag, &$attributes)\r
- {\r
- if($attributes == null)\r
- return "<$tag>";\r
- $attr = null;\r
- foreach ($attributes as $value)\r
- {\r
- if($value[1]) $attr .= ' '.$value[0].'="'.$value[1].'"';\r
- }\r
- return "<$tag$attr>";\r
- }\r
- \r
- // template for end tags\r
- function close ($tag) \r
- {\r
- return "</$tag>";\r
- }\r
-\r
- function template_end() { return null; }\r
- \r
-} //END class HTML_output\r
-\r
-?>
\ No newline at end of file
+++ /dev/null
-<?php\r
-/*\r
- * tag|wall | PHP Tag Filter |\r
- * ---------------------------------------------------------------------\r
-\r
- Copyright (C) 2002 Juraj 'HVGE' Durech\r
- Copyright (C) 2002 designia.sk\r
-\r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
- \r
- * ---------------------------------------------------------------------\r
- * XHTML_output.php xhtml output module\r
- */\r
-\r
-class XHTML_output\r
-{\r
- function XHTML_output() { return; }\r
- \r
- // input: string, array()\r
- \r
- function pair ($tag, &$attributes)\r
- {\r
- if($attributes == null)\r
- return "<$tag>";\r
- $attr = null;\r
- foreach ($attributes as $value)\r
- {\r
- if($value[1]) $attr .= ' '.$value[0].'="'.$value[1].'"';\r
- }\r
- return "<$tag$attr>";\r
- }\r
- \r
- function single ($tag, &$attributes)\r
- {\r
- if($attributes == null)\r
- return "<$tag />";\r
- $attr = null;\r
- foreach ($attributes as $value)\r
- {\r
- if($value[1]) $attr .= $value[0].'="'.$value[1].'" ';\r
- }\r
- return "<$tag $attr/>";\r
- }\r
- \r
- // template for end tags\r
- function close ($tag) \r
- {\r
- return "</$tag>";\r
- }\r
-\r
- function template_end() { return null; }\r
- \r
-} //END class XHTML_output\r
-\r
-?>
\ No newline at end of file
+++ /dev/null
-<?php\r
-/*\r
- * tag|wall | PHP Tag Filter|\r
- * ---------------------------------------------------------------------\r
-\r
- Copyright (C) 2002 designia.sk\r
-\r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
- \r
- * ---------------------------------------------------------------------\r
- * tw-config.php\r
- *\r
- */\r
-\r
-// paths\r
-define ('TW_PATH', 'tw/');\r
-define ('TW_LANG', TW_PATH.'lang/');\r
-define ('TW_CACHE', TW_PATH.'tw_cache/');\r
-define ('TW_SETUP', TW_PATH.'filter-setup/');\r
-define ('TW_ERRMODULE', TW_PATH.'error/');\r
-define ('TW_OUTMODULE', TW_PATH.'output/');\r
-\r
-// tag flags\r
-define ('TW_NOP', 0x0001);\r
-define ('TW_OPT', 0x0002);\r
-define ('TW_OVR', 0x0004);\r
-define ('TW_DUP', 0x0008);\r
-\r
-// attr filter commands\r
-define ('TW_ALL', 0);\r
-define ('TW_URL', 1); // value is url\r
-define ('TW_LINK', 2); // value is link\r
-define ('TW_NUM', 3); // value must be between\r
-define ('TW_CASE', 4); // value must be in case of..\r
-define ('TW_REQ', 8); // required attribute\r
-\r
-define ('TW_RQ_ALL', TW_REQ);\r
-define ('TW_RQ_URL', 1 | TW_REQ);\r
-define ('TW_RQ_LINK', 2 | TW_REQ);\r
-define ('TW_RQ_NUM', 3 | TW_REQ);\r
-define ('TW_RQ_CASE', 4 | TW_REQ);\r
-\r
-if(!defined('FSHL_WITH_TW_DEFINED'))\r
-{\r
- define ('FSHL_WITH_TW_DEFINED', 1);\r
-\r
- // debug modes (on - 1, off - 0)\r
- // only shlParser supports DEBUG modes\r
- define ('DEBUG_STATE', 0); // enable debug states\r
- define ('DEBUG_REPORT', 0); // enable parser error reports and infos\r
- \r
- // fshlParser() 'option' flags (not used at this time)\r
- define ('P_DISABLE_RECURSION', 0x0001);\r
- define ('P_DISABLE_NEWLANG', 0x0002);\r
- define ('P_DISABLE_EXECUTE', 0x0004);\r
- define ('P_DISABLE_EXIT', 0x0008);\r
- define ('P_DEFAULT', 0x0000);\r
- \r
- // F/SHL state flags\r
- define ('PF_VOID', 0x0000);\r
- define ('PF_KEYWORD', 0x0001);\r
- define ('PF_RECURSION', 0x0004);\r
- define ('PF_NEWLANG', 0x0008);\r
- define ('PF_EXECUTE', 0x0010); // not used\r
- \r
- // TW state flags\r
- define ('PF_CLEAN', 0x0100);\r
- define ('PF_XIO', 0x0200);\r
- define ('PF_XDONE', 0x0400);\r
- define ('PF_XNEW', 0x0800);\r
- \r
- // state field indexes\r
- define ('XL_DIAGR', 0);\r
- define ('XL_FLAGS', 1);\r
- define ('XL_CLASS', 2);\r
- define ('XL_DATA', 3);\r
- \r
- define ('XL_DSTATE', 0);\r
- define ('XL_DTYPE', 1);\r
- \r
- // internal and special states\r
- define ('P_RET_STATE', '_RET');\r
- define ('P_QUIT_STATE', '_QUIT');\r
- \r
- // group delimiters\r
- $group_delimiters=array(\r
- \r
- "SPACE", "!SPACE",\r
- "NUMBER", "!NUMBER",\r
- "ALPHA", "!ALPHA",\r
- "ALNUM", "!ALNUM",\r
- "HEXNUM", "!HEXNUM",\r
- "_ALL",\r
- \r
- // TODO: Add special language depended groups here.\r
- // See function shlParser::isdelimiter()\r
- // and fshlGenerator::make_isdx(). You must\r
- // implement your new delimiters...\r
- "PHP_DELIM",\r
- );\r
- \r
- $fshl_signatures=array("SHL","TW");\r
-\r
-} //end if(!defined())\r
-?>\r
+++ /dev/null
-<?php\r
-/*\r
- * tag|wall | PHP Tag Filter|\r
- * ---------------------------------------------------------------------\r
-\r
- Copyright (C) 2002 Juraj 'HVGE' Durech\r
- Copyright (C) 2002 www.designia.sk\r
- \r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
- \r
- * ---------------------------------------------------------------------\r
- * tw-errors.php \r
- * \r
- * This file containing basic error definitions and basic error handling class.\r
- *\r
- */\r
- \r
-// comments\r
-define('TWE_OK', 0x0000); // null\r
-define('TWE_VERSION', 0x0001); // param1=parser_version, param2=lang_version\r
-define('TWE_NOTE', 0x0002); // param2=note / tips / etc...\r
-define('TWE_CREDITS', 0x0003); // null\r
-\r
-// warnings\r
-define('TWE_STACK_UNDERFLOW', 0x0010); // param1=tag_name\r
-define('TWE_STACK_NOT_EMPTY', 0x0020); // param1=tags, stack not empty\r
-define('TWE_UNEXPECTED_EOST', 0x0030); // unexpected end of stream (tag completed automatically)\r
-define('TWE_UNEXPECTED_QUOTE', 0x0040); // atr="value>...\r
-\r
-// errors\r
-define('TWE_SYNTAX', 0x0100); // null, HTML syntax error (for future strict bases)\r
-define('TWE_TOO_MANY_ATTRS', 0x0200); // tag_name, too many attrs in tag ..\r
-\r
-// internal errors\r
-define('TWE_FILE_NOT_FOUND', 0x1000); // param1 = file\r
-define('TWE_BAD_SIGNATURE', 0x2000); // param1 = language, param2 = signature\r
-define('TWE_LANG_NOT_FOUND', 0x3000); // param1 = language\r
-\r
-// indexes to ErrorArray\r
-define('TWE_ERRNO', 0); // error value\r
-define('TWE_PARAM1', 1); // parameter 1\r
-define('TWE_PARAM2', 2); // parameter 2\r
-define('TWE_POSIT', 3); // position in source\r
-define('TWE_CODE', 4); // piece of bad code\r
-\r
-class TW_errors\r
-{\r
- var $IsError;\r
- var $ErrorArray;\r
- var $identifier;\r
-\r
- /* class constructor \r
- */\r
- function TW_errors($options = 0)\r
- {\r
- $this->IsError = 0;\r
- $this->ErrorArray = null;\r
- $this->identifier = 0;\r
- }\r
- \r
- function is_error() { return $this->IsError; }\r
- \r
- function get_err_array() { return $this->ErrorArray; }\r
- \r
- function get_comments() { return $this->get_by_mask(0x000f); }\r
-\r
- function get_warnings() { return $this->get_by_mask(0x00f0); }\r
-\r
- function get_errors() { return $this->get_by_mask(0x0f00); }\r
-\r
- function get_internal() { return $this->get_by_mask(0xf000); }\r
- \r
- function get_by_mask($mask)\r
- {\r
- $ErrTemp = null;\r
- foreach($this->ErrorArray as $key => $value)\r
- {\r
- if($value[TWE_ERRNO] & $mask) $ErrTemp[$key] = $value;\r
- }\r
- return $ErrTemp;\r
- }\r
- \r
- /* Input: \r
- * id: error id, \r
- * lang: error_language_array\r
- *\r
- * Outupt:\r
- * error text or null\r
- */\r
- function get_error_text ( $id, &$lang )\r
- {\r
- if( in_array($id, $this->ErrorArray) )\r
- {\r
- $errno = $this->ErrorArray[$id][TWE_ERRNO];\r
- if( in_array($errno,$lang) )\r
- return sprintf( $lang[$errno], \r
- $this->ErrorArray[$id][TWE_PARAM1], \r
- $this->ErrorArray[$id][TWE_PARAM2] );\r
- else\r
- return sprintf( "Please translate errno 0x%x.",$errno );\r
- }\r
- return null;\r
- }\r
-\r
-} // END class TW_errors\r
-?>\r
+++ /dev/null
-<?php\r
-/*\r
- * tag|wall | PHP Tag Filter|\r
- * ---------------------------------------------------------------------\r
-\r
- Copyright (C) 2002 Juraj 'HVGE' Durech\r
- Copyright (C) 2002 www.designia.sk\r
- \r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
- \r
- * ---------------------------------------------------------------------\r
- * tw-tags.php - this file contains common tag definitions and \r
- * relationships\r
- *\r
- * WARNING: This is not filter configuration. Relationships are used\r
- * for correct cross tag fixing.\r
- * ---------------------------------------------------------------------\r
- * Tag flags:\r
- *\r
- * TW_DUP - remove duplicates ( not implemented )\r
- * <i>...<i>:::</i></i> => <i>...:::</i>\r
- *\r
- * TW_NOP - tag without end tag \r
- * <br /><hr /> etc..\r
- *\r
- * TW_OPT - tag have optional end tag ( optional end tag is closed automatically )\r
- * <li>line1<li>line2 => <li>line1</li><li>line2</li>\r
- *\r
- * CONT.OFF - content off ( not implemented )\r
- * <tag>content-off<tag2>content-on</tag1></tag> => <tag><tag2>content-on</tag1></tag>\r
- *\r
- * REQ.TAG - required tag in stack\r
- * <ul><li>... this is correct\r
- * <p><li>... this is not correct, result is <p>...\r
- */\r
-$tw_tag_relations = array(\r
-\r
-// TAG FLAG CONT.OFF REQ. TAG\r
-\r
- "a" => array(0, 0, null),\r
- "b" => array(0, 0, null),\r
- "blockquote"=> array(0, 0, null),\r
- "big" => array(0, 0, null),\r
- "br" => array(TW_NOP, 0, null),\r
- "code" => array(0, 0, null),\r
- "dl" => array(0, 0, null),\r
- "dt" => array(TW_OPT, 0, array("dl")),\r
- "dd" => array(TW_OPT, 0, array("dl")),\r
- "div" => array(0, 0, null),\r
- "em" => array(0, 0, null),\r
- "h1" => array(0, 0, null),\r
- "h2" => array(0, 0, null),\r
- "h3" => array(0, 0, null),\r
- "h4" => array(0, 0, null),\r
- "h5" => array(0, 0, null),\r
- "h6" => array(0, 0, null),\r
- "hr" => array(TW_NOP, 0, null),\r
- "i" => array(0, 0, null),\r
- "img" => array(TW_NOP, 0, null),\r
- "ul" => array(0, 1, null),\r
- "ol" => array(0, 1, null),\r
- "li" => array(TW_OPT, 0, array("ul","ol")),\r
- "object" => array(0, 1, null),\r
- "p" => array(TW_OPT, 0, null),\r
- "pre" => array(0, 0, null),\r
- "small" => array(0, 0, null),\r
- "span" => array(0, 0, null),\r
- "strong" => array(0, 0, null),\r
- "style" => array(0, 1, null),\r
- "sub" => array(0, 0, null),\r
- "sup" => array(0, 0, null),\r
- "table" => array(0, 1, null),\r
- "caption" => array(0, 0, array("table")),\r
- "tbody" => array(0, 0, array("table")),\r
- "tfoot" => array(0, 0, array("table")),\r
- "thead" => array(0, 0, array("table")),\r
- "tr" => array(TW_OPT, 1, array("table","tbody")),\r
- "td" => array(TW_OPT, 0, array("tr")),\r
- "th" => array(TW_OPT, 0, array("tr")),\r
- "u" => array(0, 0, null),\r
-\r
- // TODO: add your specific tags here...\r
-\r
- );\r
-?>\r
+++ /dev/null
-<?php\r
-/*\r
- * tag|wall ver 0.1.4 | PHP Tag Filter |\r
- * ---------------------------------------------------------------------\r
-\r
- Copyright (C) 2002 Juraj 'HVGE' Durech\r
- Copyright (C) 2002 designia.sk\r
-\r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
- \r
- * ---------------------------------------------------------------------\r
- * tw.php \r
- *\r
- * main tag|wall parser core\r
- * ---------------------------------------------------------------------\r
- *\r
- */\r
-define ("TW_PARSER_VERSION", "0.1.4");\r
-\r
-require_once(TW_PATH."tw-tags.php");\r
-require_once(TW_PATH."tw-errors.php");\r
-\r
-class twParser\r
-{\r
- // class variables\r
- var $text, $textlen, $textpos;\r
- var $lang, $options; \r
- var $output, $err, $content_off;\r
-\r
- var $out;\r
- var $_trans, $_flags, $_data, $_delim, $_class, $_keywords;\r
- var $_ret,$_quit;\r
- \r
- var $base, $_names;\r
-\r
-\r
- // -----------------------------------------------------------------------\r
- // USER LEVEL functions\r
- //\r
-\r
- /* twParser CLASS CONSTRUCTOR\r
- * \r
- * input: \r
- * string $language - TW language class name ( see directory tw/lang/ )\r
- * int $options - parser options (not used)\r
- */\r
- function twParser(\r
- $language = "TW", \r
- $options = P_DEFAULT \r
- )\r
- {\r
- $_lang = $language."_lang";\r
- $_base = $language."_base";\r
- require_once (TW_LANG."$_base.php");\r
- require_once (TW_CACHE."$_lang.php");\r
-\r
- $this->lang = new $_lang;\r
- $this->base = $_base;\r
- $this->options = $options;\r
- $this->_trans = &$this->lang->trans;\r
- $this->_flags = &$this->lang->flags;\r
- $this->_delim = &$this->lang->delim;\r
- $this->_ret = &$this->lang->ret;\r
- $this->_quit = &$this->lang->quit;\r
- $this->_names = &$this->lang->names;\r
-\r
- $this->content_off = &$this->lang->content_off;\r
- }\r
-\r
- /* STRIP TAGS\r
- *\r
- * input:\r
- * string $text - input string\r
- * array $configuration - filter configuration array ( see files in directory tw/filter-setup/ )\r
- * string $output_module - output module name ( tw/output )\r
- * string $error_module - error module name ( tw/error )\r
- * int $offset - offset in $text\r
- *\r
- * output:\r
- * parsed string\r
- */\r
- function strip_tags (\r
- $text,\r
- &$configuration,\r
- $output_module = "XHTML",\r
- $error_module = "FOO", \r
- $offset = 0\r
- )\r
- {\r
- // open modules\r
- $_err = $error_module."_error";\r
- require_once (TW_ERRMODULE."$_err.php");\r
- $this->err = new $_err( $this->options );\r
-\r
- $_out = $output_module."_output";\r
- require_once (TW_OUTMODULE."$_out.php");\r
- $this->output = new $_out;\r
-\r
- // parser init\r
- $this->text = &$text;\r
- $this->textlen = strlen($text);\r
- $this->text .= "IMNOTREALLYOPTIMISTIC";\r
- $this->textpos = $offset;\r
- $this->out = null;\r
- \r
- // FSHL pointers init\r
- $this->lang->pt = &$this->text;\r
- $this->lang->pti = &$this->textpos;\r
- $this->lang->out = &$this->out;\r
- $this->lang->err = &$this->err;\r
- $this->lang->output = &$this->output;\r
-\r
- // base init\r
- $base = &$this->base;\r
- $this->lang->$base();\r
- $this->lang->config_tags = array_keys($configuration);\r
- // load initial configuration\r
- foreach($configuration as $tag => $attributes)\r
- {\r
- $this->lang->config_req_attr[$tag] = null;\r
- if(is_array($attributes))\r
- {\r
- $this->lang->config_attr[$tag] = array_keys($configuration[$tag]);\r
- foreach($attributes as $attr => $command)\r
- {\r
- if( $command )\r
- if( $command[0] & TW_REQ ) $this->lang->config_req_attr[$tag][] = $attr;\r
- }\r
- }\r
- else\r
- {\r
- $this->lang->config_attr[$tag] = $attributes;\r
- }\r
- }\r
- $this->lang->config = &$configuration;\r
- \r
- // start parser\r
- $this->parse_string ( $this->lang->initial_state );\r
- \r
- $this->out .= $this->lang->base_end();\r
- $this->out .= $this->output->template_end();\r
-\r
- return $this->out;\r
- }\r
-\r
- function get_position() { return $this->textpos; }\r
-\r
- function get_out() { return $this->out; }\r
- \r
- // error wrapper\r
- \r
- function is_error() { return $this->err->is_error(); }\r
- function get_err_array() { return $this->err->get_err_array(); }\r
- function get_comments() { return $this->err->get_by_mask(0x000f); }\r
- function get_warnings() { return $this->err->get_by_mask(0x00f0); }\r
- function get_errors() { return $this->err->get_by_mask(0x0f00); }\r
- function get_internal() { return $this->err->get_by_mask(0xf000); }\r
- function get_by_mask($mask) { return $this->err->get_by_mask($mask); }\r
- function get_error_text ( $id, &$lang ) { return $this->err->get_error_text ( $id, $lang ); }\r
- \r
-// ---------------------------------------------------------------------------------\r
-// LOW LEVEL functions\r
-//\r
-\r
-// main parser function\r
-//\r
-function parse_string ($state)\r
-{\r
- $flags = $this->_flags[$state];\r
- $statename_n = $this->_names[$state]."_new";\r
- // perform IN function if required\r
- if( $flags & PF_XIO )\r
- { \r
- $statename_i = $this->_names[$state]."_in";\r
- $statename_o = $this->_names[$state]."_out";\r
- $this->lang->$statename_i();\r
- }\r
- $stateword = null;\r
- \r
- while( ($word = $this->getword("isd$state")) != null )\r
- {\r
- if(is_array($word))\r
- {\r
- // word is delimiter\r
- $newstate = $this->_trans[$state][$word[0]][XL_DSTATE];\r
-\r
- // char back to stream (CB2S) if required\r
- if( $this->_trans[$state][$word[0]][XL_DTYPE] )\r
- {\r
- if( $newstate == $state )\r
- {\r
- // If it is the same state, CB2S flag have different significance\r
- // re-initialize state (call IN function)\r
- $stateword = null;\r
- if( $flags & PF_XIO ) $this->lang->$statename_i();\r
- continue;\r
- }\r
- $this->textpos -= strlen($word[1]);\r
- }\r
- else\r
- {\r
- $stateword .= $word[1]; // add new parsed word to stateword\r
- }\r
- if( $newstate == $this->_ret ) // newstate is _RET from recursion\r
- {\r
- // perform NEW function if required\r
- if( $flags & PF_XNEW ) $this->lang->$statename_n($stateword);\r
- // perform OUT function if required\r
- if( $flags & PF_XIO ) $this->lang->$statename_o($stateword);\r
- // return from recursion\r
- return;\r
- }\r
- \r
- if( $state != $newstate ) // recursion - only if it is really new state\r
- {\r
- // perform NEW function if required\r
- if( $flags & PF_XNEW ) $this->lang->$statename_n($stateword);\r
- // recursion\r
- $this->parse_string($newstate);\r
- // perform OUT function if required and return.\r
- if( $flags & PF_XDONE )\r
- {\r
- if( $flags & PF_XIO ) $this->lang->$statename_o(null);\r
- return;\r
- }\r
- continue;\r
- } \r
- }\r
- else\r
- {\r
- // word is not delimiter\r
- if( $flags & PF_CLEAN )\r
- {\r
- if(!$this->content_off)\r
- $this->out .= str_replace("<",">",$word);\r
- }\r
- else\r
- {\r
- $stateword .= $word;\r
- }\r
- }\r
- } //END while()\r
-\r
- // TODO: check this OUT\r
- \r
- // perform NEW function if required\r
- if( $flags & PF_XNEW ) $this->lang->$statename_n($stateword);\r
- // perform OUT function if required and return.\r
- if( $flags & PF_XIO ) $this->lang->$statename_o($stateword);\r
-}\r
-\r
-// get word from stream\r
-//\r
-function getword ($state)\r
-{\r
- $result = null;\r
- if($this->textpos < $this->textlen)\r
- {\r
- $del = $this->lang->$state(); // call "is delimiter" isdX function\r
- if($del != false)\r
- {\r
- // actual char (or sub-string) is delimiter\r
- $this->textpos += strlen($del[1]);\r
- return $del;\r
- }\r
- else\r
- {\r
- // Actual char/string is not delimiter.\r
- // Result word is between current position and first delimiter in stream\r
- $result = $this->text[$this->textpos++];\r
- while(($this->textpos < $this->textlen) && !$this->lang->$state())\r
- $result .= $this->text[$this->textpos++];\r
- }\r
- }\r
- return $result;\r
-}\r
-\r
-} // END class twParser\r
-?>\r
+++ /dev/null
-<?php
-/* --------------------------------------------------------------- *
- * WARNING: ALL CHANGES IN THIS FILE WILL BE LOST
- *
- * Source language file: tw/lang/TW_lang.php
- * Language version: 1.0 (Sign:TW)
- *
- * Target file: tw/tw_cache/TW_lang.php
- * Build date: Wed 20.11.2002 00:29:40
- *
- * Generator version: 0.4.1
- * --------------------------------------------------------------- */
-class TW_lang extends TW_base
-{
-var $trans,$flags,$data,$delim,$class,$keywords;
-var $version,$signature,$initial_state,$ret,$quit;
-var $pt,$pti,$generator_version;
-var $names;
-
-function TW_lang ()
-{
- $this->version="1.0";
- $this->signature="TW";
- $this->generator_version="0.4.1";
- $this->initial_state=0;
- $this->trans=array(0=>array("<"=>array(0=>1,1=>0,),),1=>array("ALPHA"=>array(0=>3,1=>1,),"/"=>array(0=>2,1=>0,),"<"=>array(0=>1,1=>1,),"!--"=>array(0=>11,1=>0,),"_ALL"=>array(0=>12,1=>0,),),2=>array("ALPHA"=>array(0=>4,1=>1,),"_ALL"=>array(0=>12,1=>0,),),3=>array("ALPHA"=>array(0=>4,1=>1,),"_ALL"=>array(0=>12,1=>0,),),4=>array("!ALNUM"=>array(0=>5,1=>1,),),5=>array("ALPHA"=>array(0=>6,1=>1,),">"=>array(0=>12,1=>0,),"/>"=>array(0=>12,1=>0,),),6=>array("!ALPHA"=>array(0=>7,1=>1,),">"=>array(0=>12,1=>1,),"/>"=>array(0=>12,1=>1,),),7=>array("\""=>array(0=>8,1=>0,),"'"=>array(0=>9,1=>0,),"ALNUM"=>array(0=>10,1=>1,),">"=>array(0=>12,1=>1,),"/>"=>array(0=>12,1=>1,),),8=>array("\""=>array(0=>12,1=>0,),),9=>array("'"=>array(0=>12,1=>0,),),10=>array("-"=>array(0=>10,1=>0,),"!ALNUM"=>array(0=>12,1=>1,),),11=>array("-->"=>array(0=>12,1=>0,),),);
- $this->flags=array(0=>256,1=>1024,2=>1536,3=>1536,4=>3584,5=>0,6=>3584,7=>1536,8=>512,9=>512,10=>512,11=>0,);
- $this->delim=array(0=>array(0=>"<",),1=>array(0=>"ALPHA",1=>"/",2=>"<",3=>"!--",4=>"_ALL",),2=>array(0=>"ALPHA",1=>"_ALL",),3=>array(0=>"ALPHA",1=>"_ALL",),4=>array(0=>"!ALNUM",),5=>array(0=>"ALPHA",1=>">",2=>"/>",),6=>array(0=>"!ALPHA",1=>">",2=>"/>",),7=>array(0=>"\"",1=>"'",2=>"ALNUM",3=>">",4=>"/>",),8=>array(0=>"\"",),9=>array(0=>"'",),10=>array(0=>"-",1=>"!ALNUM",),11=>array(0=>"-->",),);
- $this->ret=12;
- $this->quit=13;
- $this->names=array(0=>"OUT",1=>"T_tagWall",2=>"T_Cbegin",3=>"T_begin",4=>"T_gettag",5=>"T_in",6=>"A_begin",7=>"V_begin",8=>"VALUE1",9=>"VALUE2",10=>"VALUE3",11=>"HTML_comment",12=>"_RET",13=>"_QUIT",);
-}
-
-/* OUT */
-function isd0 ()
-{
-$c1=$this->pt[$this->pti];
-if($c1=="<")
- return array("<","<");
-return false;
-}
-
-/* T_tagWall */
-function isd1 ()
-{
-$p=$this->pti;
-$c1=$this->pt[$p++];
-$c2=$c1.$this->pt[$p++];
-$c3=$c2.$this->pt[$p];
-if(stristr("eaoinltsrvdukzmcpyhjbfgxwq",$c1))
- return array("ALPHA",$c1);
-if($c1=="/")
- return array("/","/");
-if($c1=="<")
- return array("<","<");
-if($c3=="!--")
- return array("!--","!--");
-return array("_ALL",$c1);
-}
-
-/* T_Cbegin */
-function isd2 ()
-{
-$c1=$this->pt[$this->pti];
-if(stristr("eaoinltsrvdukzmcpyhjbfgxwq",$c1))
- return array("ALPHA",$c1);
-return array("_ALL",$c1);
-}
-
-/* T_begin */
-function isd3 ()
-{
-$c1=$this->pt[$this->pti];
-if(stristr("eaoinltsrvdukzmcpyhjbfgxwq",$c1))
- return array("ALPHA",$c1);
-return array("_ALL",$c1);
-}
-
-/* T_gettag */
-function isd4 ()
-{
-$c1=$this->pt[$this->pti];
-if(!stristr("eaoinltsrvdukzmcpyhjbfgxwq0123456789",$c1))
- return array("!ALNUM",$c1);
-return false;
-}
-
-/* T_in */
-function isd5 ()
-{
-$p=$this->pti;
-$c1=$this->pt[$p++];
-$c2=$c1.$this->pt[$p];
-if(stristr("eaoinltsrvdukzmcpyhjbfgxwq",$c1))
- return array("ALPHA",$c1);
-if($c1==">")
- return array(">",">");
-if($c2=="/>")
- return array("/>","/>");
-return false;
-}
-
-/* A_begin */
-function isd6 ()
-{
-$p=$this->pti;
-$c1=$this->pt[$p++];
-$c2=$c1.$this->pt[$p];
-if(!stristr("eaoinltsrvdukzmcpyhjbfgxwq",$c1))
- return array("!ALPHA",$c1);
-if($c1==">")
- return array(">",">");
-if($c2=="/>")
- return array("/>","/>");
-return false;
-}
-
-/* V_begin */
-function isd7 ()
-{
-$p=$this->pti;
-$c1=$this->pt[$p++];
-$c2=$c1.$this->pt[$p];
-if($c1=="\"")
- return array("\"","\"");
-if($c1=="'")
- return array("'","'");
-if(stristr("eaoinltsrvdukzmcpyhjbfgxwq0123456789",$c1))
- return array("ALNUM",$c1);
-if($c1==">")
- return array(">",">");
-if($c2=="/>")
- return array("/>","/>");
-return false;
-}
-
-/* VALUE1 */
-function isd8 ()
-{
-$c1=$this->pt[$this->pti];
-if($c1=="\"")
- return array("\"","\"");
-return false;
-}
-
-/* VALUE2 */
-function isd9 ()
-{
-$c1=$this->pt[$this->pti];
-if($c1=="'")
- return array("'","'");
-return false;
-}
-
-/* VALUE3 */
-function isd10 ()
-{
-$c1=$this->pt[$this->pti];
-if($c1=="-")
- return array("-","-");
-if(!stristr("eaoinltsrvdukzmcpyhjbfgxwq0123456789",$c1))
- return array("!ALNUM",$c1);
-return false;
-}
-
-/* HTML_comment */
-function isd11 ()
-{
-$p=$this->pti;
-$c3=$this->pt[$p++].$this->pt[$p++].$this->pt[$p];
-if($c3=="-->")
- return array("-->","-->");
-return false;
-}
-
-}
-?>
\ No newline at end of file