PHP Classes

File: SQL

Recommend this page to a friend!
  Classes of Dmitry Basileff   Apriori   SQL   Download  
File: SQL
Role: Auxiliary data
Content type: text/plain
Description: Example parslets in SQl Format for import
Class: Apriori
Process text based on rules stored in MySQL table
Author: By
Last change: Updated for 0.3.000 version
Date: 16 years ago
Size: 15,450 bytes
 

Contents

Class file image Download
CREATE TABLE `Parslets` ( `Name` varchar(224) NOT NULL default '', `Matcher` varchar(224) NOT NULL default '', `Replacer` longtext NOT NULL, `Type` varchar(32) NOT NULL default 'PosixEx', `Mode` varchar(224) NOT NULL default '', `isDynamic` enum('True','False') NOT NULL default 'True', PRIMARY KEY (`Name`) ) ENGINE=MyISAM DEFAULT CHARSET=cp1251; -- -- &#1044;&#1072;&#1084;&#1087; &#1076;&#1072;&#1085;&#1085;&#1099;&#1093; &#1090;&#1072;&#1073;&#1083;&#1080;&#1094;&#1099; `Parslets` -- INSERT INTO `Parslets` VALUES ('Now', '~:Now~', '$Output=time();', 'PosixEx', 'xGUI', 'True'); INSERT INTO `Parslets` VALUES ('FullDateTime', 'FullDateTime=([[:digit:]]*)', '$Output=date("Y.m.d H:i:s", $Inputs[1]);', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('ShortTime', 'ShortTime=([[:digit:]]*)', '$Output=date("H:i", $Inputs[1]);', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('FullTime', 'FullTime=([[:digit:]]*)', '$Output=date("H:i:s", $Inputs[1]);', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('FullTimeWithDay', 'FullTimeWithDay=([[:digit:]]*)', '$Output=strftime("%a, %H:%M:%S", $Inputs[1]);', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('ShortTimeWithDay', 'ShortTimeWithDay=([[:digit:]]*)', '$Output=strftime("%a, %H:%M", $Inputs[1]);', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('ShortDate', 'ShortDate=([[:digit:]]*)', '$Output=strftime("%d %b", $Inputs[1]);', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('FullDate', 'FullDate=([[:digit:]]*)', '$Output=date("d.m.Y", $Inputs[1]);', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('CoolDate', 'CoolDate=([[:digit:]]*)', '$Output=strftime("%A, %d, %B %Y", $Inputs[1]);', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('Strong', '\\[b\\](.+)\\[\\/b\\]', '$Output=''<strong>''.$Inputs[1].''</strong>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Emphasis', '\\[i\\](.+)\\[\\/i\\]', '$Output=''<em>''.$Inputs[1].''</em>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Underline', '\\[u\\](.+)\\[\\/u\\]', '$Output=''<span class="underline">''.$Inputs[1].''</span>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Strike', '\\[s\\](.+)\\[\\/s\\]', '$Output=''<span class="underline">''.$Inputs[1].''</span>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Deleted', '\\[del\\](.+)\\[\\/del\\]', '$Output=''<span class="deleted">''.$Inputs[1].''</span>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Modified', '\\[mod\\](.+)\\[\\/mod\\]', '$Output=''<span class="modified">''.$Inputs[1].''</span>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Inserted', '\\[ins\\](.+)\\[\\/ins\\]', '$Output=''<span class="inserted">''.$Inputs[1].''</span>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Quote', '\\[q\\](.+)\\[\\/q\\]', '$Output=''<div class="iQuote"><span style="text-align:center">''.$Inputs[2].''</span>\r\n<p style="text-align:right">''.$Inputs[1].''</p>\r\n</div>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Digression', '\\[dig\\](.+)\\[\\/dig\\]', '$Output=''<span class="digression">''.$Inputs[1].''</span>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Code', '\\[code\\](.+)\\[\\/code\\]', '$Output=''<span class="code">''.$Inputs[1].''</span>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Large', '\\[large\\](.+)\\[\\/large\\]', '$Output=''<span class="large">''.$Inputs[1].''</span>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Medium', '\\[medium\\](.+)\\[\\/medium\\]', '$Output=''<span class="medium">''.$Inputs[1].''</span>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Small', '\\[small\\](.+)\\[\\/small\\]', '$Output=''<span class="small">''.$Inputs[1].''</span>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Sup', '\\[sup\\](.+)\\[\\/sup\\]', '$Output=''<sup>''.$Inputs[1].''</sup>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Sub', '\\[sub\\](.+)\\[\\/sub\\]', '$Output=''<sub>''.$Inputs[1].''</sub>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Abbreviation', '\\[abbr\\](.+)\\[\\/abbr\\]', '$Output=''<abbr>''.$Inputs[1].''</abbr>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Acronym', '\\[acronym\\](.+)\\[\\/acronym\\]', '$Output=''<acronym>''.$Inputs[1].''</acronym>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Address', '\\[address\\](.+)\\[\\/address\\]', '$Output=''<address>''.$Inputs[1].''</address>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Left', '\\[left\\](.+)\\[\\/left\\]', '$Output=''<div style="text-align: left;">''.$Inputs[1].''</div>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Right', '\\[right\\](.+)\\[\\/right\\]', '$Output=''<div style="text-align: right;">''.$Inputs[1].''</div>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Center', '\\[center\\](.+)\\[\\/center\\]', '$Output=''<div style="text-align: center;">''.$Inputs[1].''</div>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Justify', '\\[justify\\](.+)\\[\\/justify\\]', '$Output=''<span style="text-align: justify;">''.$Inputs[1].''</span>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Header 1', '\\[h1\\](.+)\\[\\/h1\\]', '$Output=''<h1>''.$Inputs[1].''</h1>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Header 2', '\\[h2\\](.+)\\[\\/h2\\]', '$Output=''<h2>''.$Inputs[1].''</h2>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Header 3', '\\[h3\\](.+)\\[\\/h3\\]', '$Output=''<h3>''.$Inputs[1].''</h3>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Header 4', '\\[h4\\](.+)\\[\\/h3\\]', '$Output=''<h4>''.$Inputs[1].''</h4>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Header 5', '\\[h5\\](.+)\\[\\/h5\\]', '$Output=''<h5>''.$Inputs[1].''</h5>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Header 6', '\\[h6\\](.+)\\[\\/h6\\]', '$Output=''<h6>''.$Inputs[1].''</h6>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Color', '\\[color=([[:alnum:]]+)\\](.+)\\[\\/color\\]', '$Output=''<span style="color: ''.$Inputs[1].''">''.$Inputs[2].''</span>'';', 'PosixEx', 'BBCode', 'True'); INSERT INTO `Parslets` VALUES ('Sex', 'Sex=([MF])', 'if ($Inputs[1]=="F") $Output=''<img src="female.icon" align="absmiddle" border="0" title="Sex: Femal" />'';\r\n\r\nif ($Inputs[1]=="M") $Output=''<img src="male.icon" align="absmiddle" border="0" title="Sex: Male" />'';\r\n\r\nif ($Inputs[1]=="NA") $Output="Sex not specified";', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('Skype', 'Skype=([[:alnum:]]*)', '$Output=''<img src="http://technoserv.no-ip.org:8080/skype/''.$Inputs[1].''" \r\nalign="middle" border="0" title="Skype Status" />''.$Inputs[1];', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('YIM', 'YIM=([[:alnum:]]*)', '$Output=''<img src="http://technoserv.no-ip.org:8080/yahoo/''.$Inputs[1].''" \r\nalign="middle" border="0" title="Yahoo Status" />''.$Inputs[1];', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('AIM', 'AIM=([[:alnum:]]*)', '$Output=''<img src="http://technoserv.no-ip.org:8080/aim/''.$Inputs[1].''" align="middle" border="0" title="AOL Messenger Status" />'';', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('ICQ', 'ICQ=([[:digit:]]*)', '$Output=''<a href="http://www.icq.com/people/full_details_show.php?uin=''.$Inputs[1].''>\r\n<img src="http://technoserv.no-ip.org:8080/icq/''.$Inputs[1].''" \r\nalign="middle" border="0"/></a>''. $Inputs[1];', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('Jabber', 'Jabber=([[:alnum:]]*)', '$Output=''<img src="http://technoserv.no-ip.org:8080/jabber/''.$Inputs[1].''" \r\nalign="middle" border="0" title="Jabber Status" />''. $Inputs[1].''</a>'';', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('MRA', 'MRA=([[:alnum:][:punct:]]*)', '$Output=''<a href="http://www.mail.ru/agent?message&to=''.$Inputs[1].''"><img src="http://status.mail.ru/?''.$Inputs[1].''" width="13" height="13" title="Mail.Ru Agent Status" border="0" align="absmiddle" > ''.$Inputs[1].''</a>'';', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('MSN', 'MSN=([[:alnum:]]*)', '$Output=''<img src="http://technoserv.no-ip.org:8080/msn/''.$Inputs[1].''" \r\nalign="middle" border="0" title="MSN Messenger Status" />''.$Inputs[1];', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('PhotofileRu', 'PhotofileRu=([[:alnum:]]*)', '$Output=''<a href="http://www.photofile.ru/user/''.$Inputs[1].''"><img src="http://www.photofile.ru/favicon.ico" align="absmiddle" border="0" title="PhotofileRu Profile" ></a>&nbsp; ''.$Inputs[1];', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('LastFM', 'LastFM=([[:alnum:]]*)', '$Output=''<a href="http://www.last.fm/user/''.$Inputs[1].''"><img src="http://www.last.fm/favicon.ico" align="absmiddle" border="0" title="Last.FM Profile" ></a>&nbsp; ''.$Inputs[1];', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('Google', 'Google=([[:alnum:]]*)', '$Output=''<a href="http://www.google.ru/search?hl=ru&q=''.$Inputs[1].''"><img src="http://www.google.ru/favicon.ico" align="absmiddle" border="0" title="Search at Google" ></a>&nbsp; '';', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('Wikipedia', 'Wikipedia=([[:alnum:]]*)', '$Output=''<a href="http://wikipedia.org/wiki/''.$Inputs[1].''"><img src="http://wikipedia.org/favicon.ico" align="absmiddle" border="0" title="Search at Wikipedia" ></a>&nbsp;'';', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('LJ', 'LJ=([[:alnum:]]*)', '$Output=''<a href="http://''.$Inputs[1].''.livejournal.com"> <img src="http://moikrug.ru/images/ljuserinfo.gif" align="middle" border="0" /> ''.$Inputs[1].''</a>'';', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('SmileExample', '\\:\\-\\)', '$Output=''<img src="SmileURL" border=0 align="absmiddle" title="SmileName" />'';', 'PosixEx', 'Smiles', 'True'); INSERT INTO `Parslets` VALUES ('MoonPhase', 'MoonPhase=([[:digit:]]*)', '$last_new_moon=mktime(7,14,0,6,15,2007);\r\n$t=abs($Inputs[1]-$last_new_moon);\r\n$tt=floor(abs($t/(29.5285*24*60*60)));\r\n$t=$t-$tt*29.5285*24*60*60;\r\n$t=$t/(24*60*60);\r\n$r=ceil($t*8/29.5285);\r\n\r\n$Output="$r/8";', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('IMDB', 'IMDB=\\"([[:alnum:][:space:]]*)\\"', '$Output="<a href=''http://imdb.com/find?s=tt&q=".$Inputs[1]."''>\r\n<img src=''http://imdb.com/favicon.ico'' align=''absmiddle'' border=''0'' title=''Search at Internet Movie Database''/></a>&nbsp;".$Inputs[1];', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('Zodiac', 'Zodiac=([[:digit:]]*)', '$day = date("d",$Inputs[1]);\r\n$month = date("m",$Inputs[1]);\r\n switch ($month) {\r\n case 1:\r\n $zodiac = ($day <=20) ? "capricorn" : "aquarius";\r\n break;\r\n case 2:\r\n $zodiac = ($day <=18) ? "aquarius" : "pisces";\r\n break;\r\n case 3:\r\n $zodiac = ($day <=20) ? "pisces" : "aries";\r\n break;\r\n case 4:\r\n $zodiac = ($day <=20) ? "aries" : "taurus";\r\n break;\r\n case 5:\r\n $zodiac = ($day <=21) ? "taurus" : "gemini";\r\n break;\r\n case 6:\r\n $zodiac = ($day <=22) ? "gemini" : "cancer";\r\n break;\r\n case 7:\r\n $zodiac = ($day <=22) ? "cancer" : "leo";\r\n break;\r\n case 8:\r\n $zodiac = ($day <=21) ? "leo" : "virgo";\r\n break;\r\n case 9:\r\n $zodiac = ($day <=23) ? "virgo" : "libra";\r\n break;\r\n case 10:\r\n $zodiac = ($day <=23) ? "libra" : "scorpio";\r\n break;\r\n case 11:\r\n $zodiac = ($day <=21) ? "scorpio" : "saggitarius";\r\n break;\r\n case 12:\r\n $zodiac = ($day <=222) ? "saggitarius" : "capricorn";\r\n break;\r\n };\r\n $Output="<img src=''ZodiacSignsFolder/".$zodiac.".gif'' align=''absmiddle'' border=''0'' title=''$zodiac'' />";', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('Temperature', 'Temperature=([[:digit:]]*)([CFK])', 'if ($Inputs[2] == "C")\r\n{\r\n $Title="Kelvin: ".($Inputs[1]-273)."";\r\n};\r\n\r\nif ($Inputs[2] == "K")\r\n{\r\n $Title="Celsius: ".($Inputs[1]+273)."";\r\n};\r\n\r\n$Output="<a title=''Temperature:\r\n$Title''>$Inputs[1]°$Inputs[2]</a>";', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('Inch2Cm', 'Inch=([[:digit:]\\.]*)', '$Title="Centimetres: ".($Inputs[1]*2.54)."<br />";\r\n$Output="<a title=''Metric system:\r\n$Title''>$Inputs[1] in.</a>";', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('Speed', 'Speed=([[:digit:]]*)([[:alpha:]]*)', '$Speed=$Inputs[1];\r\n\r\nif ($Inputs[2]=="mph")\r\n{\r\n $SpeedMPS=round(($Speed*1609.34)/3600,2);\r\n $SpeedKPH=round(($Speed*1.60934),2);\r\n $SpeedNPH=round(($Speed*1.60934)/1.85318,2);\r\n $SpeedQM=round(402/$SpeedMPS,2);\r\n$Title=" $SpeedMPS metres per second\r\n$SpeedKPH kilometer per hour\r\n$SpeedNPH knots\r\nQuarter mile for $SpeedQM seconds\r\n";\r\n};\r\n\r\n\r\nif ($Inputs[2]=="kph")\r\n{\r\n $SpeedMPS=round((($Speed*1000)/3600),2);\r\n $SpeedMPH=round(($Speed/1.60934),2);\r\n $SpeedNPH=round(($Speed*1.60934)/1.85318,2);\r\n $SpeedQM=round(402/$SpeedMPS,2);\r\n$Title=" $SpeedMPS metres per second\r\n$SpeedMPH miles per hour\r\n$SpeedNPH knots\r\nQuarter mile for $SpeedQM seconds\r\n";\r\n};\r\n\r\n\r\nif ($Inputs[2]=="mps")\r\n{\r\n $SpeedMPH=round(($Speed/1609.34)*3600,2);\r\n $SpeedKPH=round(($Speed/1000)*3600);\r\n $SpeedNPH=round(($SpeedKPH*1.85318),2);\r\n $SpeedQM=round(402/$Speed,2);\r\n$Title=" $SpeedMPH miles per hour\r\n$SpeedKPH kilometres per hour\r\n$SpeedNPH knots\r\nQuarter mile for $SpeedQM seconds\r\n";\r\n};\r\n\r\n$Output="<a title=''Speed: $Title''>$Inputs[1] $Inputs[2]</a>";', 'PosixEx', 'Formatters', 'True'); INSERT INTO `Parslets` VALUES ('AdaptiveDate', 'AdaptiveDate=([[:digit:]]*)', '$Now=time();\r\n\r\n$Date=$Inputs[1];\r\n$DateY=date("Y",$Date);\r\n$DateM=date("F",$Date);\r\n$DateD=date("d",$Date);\r\n\r\n$NowY=date("Y",$Now);\r\n$NowM=date("F",$Now);\r\n$NowD=date("d",$Now);\r\n\r\n$Output.=$DateD." ".$DateM;\r\n\r\nif ($NowY!=$DateY) $Output.=" ".$DateY;\r\nif (($NowY==$DateY) and ($NowM==$DateM))\r\n{\r\n $DDiff=$NowD-$DateD;\r\n if ($DDiff==7) $Output="One week ago";\r\n if ($DDiff==6) $Output="Six days ago";\r\n if ($DDiff==5) $Output="Five days ago";\r\n if ($DDiff==4) $Output="Four days ago";\r\n if ($DDiff==3) $Output="Three days ago";\r\n if ($DDiff==2) $Output="Two days ago";\r\n if ($DDiff==1) $Output="Yesterday";\r\n if ($DDiff==0) $Output="Today";\r\n};', 'PosixEx', 'Formatters', 'True');