<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=1582746</guid>
        <pubDate>Tue, 29 May 2007 09:21:57 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=1582746</link>
        <description><![CDATA[Рысь: <span class='tag-size' data-value='13' style='font-size:13pt;'><span class="tag-color tag-color-named" data-value="green" style="color: green">чтение информации из mp3 файла. </span></span><br>
<br>
<span class="tag-color tag-color-named" data-value="blue" style="color: blue">Автор: <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=7637' target='_blank'>SCINER</a><br>
<strong class='tag-b'>Язык:</strong> PHP</span><br>
<br>
Использование:<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">require_once(&quot;id.php&quot;);</div><div class="code_line">print_r(getTags(&quot;10_-_Ber_Upkennen_Ni_Bula.mp3&quot;));</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
Возвращаемое значение - массив:<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">Array</div><div class="code_line">(</div><div class="code_line">&nbsp;&nbsp; &nbsp;[FILE] =&#62; /home/u51935/market.bars-media.ru/www/mp3/Elephunk - Track 16.mp3</div><div class="code_line">&nbsp;&nbsp; &nbsp;[FILESIZE] =&#62; 2911975</div><div class="code_line">&nbsp;&nbsp; &nbsp;[VBR] =&#62; yes</div><div class="code_line">&nbsp;&nbsp; &nbsp;[FRAMES] =&#62; 6256</div><div class="code_line">&nbsp;&nbsp; &nbsp;[MPEG] =&#62; 1.0</div><div class="code_line">&nbsp;&nbsp; &nbsp;[LAYER] =&#62; 3</div><div class="code_line">&nbsp;&nbsp; &nbsp;[SAMPLERATE] =&#62; 44100</div><div class="code_line">&nbsp;&nbsp; &nbsp;[BPP] =&#62; 142</div><div class="code_line">&nbsp;&nbsp; &nbsp;[LENGTH] =&#62; 163</div><div class="code_line">&nbsp;&nbsp; &nbsp;[CHANELS] =&#62; Joint stereo</div><div class="code_line">&nbsp;&nbsp; &nbsp;[EMPHASIS] =&#62; None</div><div class="code_line">&nbsp;&nbsp; &nbsp;[ORIGINAL] =&#62; Yes</div><div class="code_line">&nbsp;&nbsp; &nbsp;[TITLE] =&#62; Track 16</div><div class="code_line">&nbsp;&nbsp; &nbsp;[ARTIST] =&#62; Black eyed peas</div><div class="code_line">&nbsp;&nbsp; &nbsp;[ALBUM] =&#62; Elephunk</div><div class="code_line">&nbsp;&nbsp; &nbsp;[YEAR] =&#62; 2004</div><div class="code_line">&nbsp;&nbsp; &nbsp;[GENRECODE] =&#62; 32</div><div class="code_line">&nbsp;&nbsp; &nbsp;[GENRE] =&#62; Classical</div><div class="code_line">&nbsp;&nbsp; &nbsp;[TRACK] =&#62; 16</div><div class="code_line">&nbsp;&nbsp; &nbsp;[COMMENT] =&#62; lenar2003@mail.ru</div><div class="code_line">)</div></ol></div></div></div></div><br>
, если файл некорректный, то соответствующие поля не будут присутствовать в массиве&#33;<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#60;?</div><div class="code_line">&nbsp;</div><div class="code_line">//Written by SCINER: MP3-file parser</div><div class="code_line">//30-05-2007 - 14:41</div><div class="code_line">&nbsp;</div><div class="code_line">//Read mp3-header, id3v1.0, id3v1.1</div><div class="code_line">&nbsp;</div><div class="code_line">/*</div><div class="code_line">A &nbsp; 3 &nbsp; (0-2) &nbsp; Tag индитификатор. Должны использоваться символы &#39;TAG&#39; как char символы.</div><div class="code_line">+B &nbsp;30 &nbsp;(3-32) &nbsp;Title</div><div class="code_line">+C &nbsp;30 &nbsp;(33-62) Artist</div><div class="code_line">+D &nbsp;30 &nbsp;(63-92) Album</div><div class="code_line">+E &nbsp;4 &nbsp; (93-96) Year</div><div class="code_line">+F &nbsp;30 &nbsp;(97-126) &nbsp; &nbsp;Comment</div><div class="code_line">+G &nbsp;1 &nbsp; (127) &nbsp; Genre</div><div class="code_line">*/</div><div class="code_line">&nbsp;</div><div class="code_line">Function BinToDec($BinValue)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;$I = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$BinToDec = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;For ($I = 1; $I &#60;= strlen($BinValue); $I++)</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;If (substr($BinValue, $I - 1, 1) == &quot;1&quot;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$BinToDec = $BinToDec + pow(2 ,(strLen($BinValue) - $I));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;return $BinToDec;</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">function ByteToBit($ByteArray)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;$Z =0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$I =0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$cnt =0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$ByteToBit = &quot;&quot;;</div><div class="code_line">&nbsp;&nbsp; &nbsp;//convert 4*1 byte array to 4*8 bits&#39;&#39;&#39;&#39;&#39;</div><div class="code_line">&nbsp;&nbsp; &nbsp;For ($Z = 1; $Z&#60;=4; $Z++)</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$subs = ord(substr($ByteArray, $Z-1, 1));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;For ($I = 7; $I &#62;= 0; $I--)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If(intval($subs / pow(2, $I)) == 1)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$ByteToBit = $ByteToBit.&quot;1&quot;;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$subs = $subs - pow(2 , $I);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ElseIf ($ByteToBit !== &quot;&quot;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$ByteToBit = $ByteToBit.&quot;0&quot;;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;return BinToDec($ByteToBit);</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">function isVBR($sign)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;if($sign == &quot;Xing&quot;)</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return &quot;yes&quot;;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return &quot;no&quot;;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">}</div><div class="code_line">function GetGenre($genre)</div><div class="code_line">{</div><div class="code_line">$_genres = array(</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; =&#62; &#39;Blues&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1 &nbsp; =&#62; &#39;Classic Rock&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;2 &nbsp; =&#62; &#39;Country&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;3 &nbsp; =&#62; &#39;Dance&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;4 &nbsp; =&#62; &#39;Disco&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;5 &nbsp; =&#62; &#39;Funk&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;6 &nbsp; =&#62; &#39;Grunge&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;7 &nbsp; =&#62; &#39;Hip-Hop&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;8 &nbsp; =&#62; &#39;Jazz&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;9 &nbsp; =&#62; &#39;Metal&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;10 &nbsp;=&#62; &#39;New Age&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;11 &nbsp;=&#62; &#39;Oldies&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;12 &nbsp;=&#62; &#39;Other&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;13 &nbsp;=&#62; &#39;Pop&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;14 &nbsp;=&#62; &#39;R&amp;B&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;15 &nbsp;=&#62; &#39;Rap&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;16 &nbsp;=&#62; &#39;Reggae&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;17 &nbsp;=&#62; &#39;Rock&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;18 &nbsp;=&#62; &#39;Techno&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;19 &nbsp;=&#62; &#39;Industrial&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;20 &nbsp;=&#62; &#39;Alternative&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;21 &nbsp;=&#62; &#39;Ska&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;22 &nbsp;=&#62; &#39;Death Metal&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;23 &nbsp;=&#62; &#39;Pranks&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;24 &nbsp;=&#62; &#39;Soundtrack&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;25 &nbsp;=&#62; &#39;Euro-Techno&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;26 &nbsp;=&#62; &#39;Ambient&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;27 &nbsp;=&#62; &#39;Trip-Hop&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;28 &nbsp;=&#62; &#39;Vocal&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;29 &nbsp;=&#62; &#39;Jazz+Funk&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;30 &nbsp;=&#62; &#39;Fusion&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;31 &nbsp;=&#62; &#39;Trance&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;32 &nbsp;=&#62; &#39;Classical&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;33 &nbsp;=&#62; &#39;Instrumental&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;34 &nbsp;=&#62; &#39;Acid&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;35 &nbsp;=&#62; &#39;House&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;36 &nbsp;=&#62; &#39;Game&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;37 &nbsp;=&#62; &#39;Sound Clip&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;38 &nbsp;=&#62; &#39;Gospel&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;39 &nbsp;=&#62; &#39;Noise&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;40 &nbsp;=&#62; &#39;Alternative Rock&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;41 &nbsp;=&#62; &#39;Bass&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;42 &nbsp;=&#62; &#39;Soul&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;43 &nbsp;=&#62; &#39;Punk&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;44 &nbsp;=&#62; &#39;Space&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;45 &nbsp;=&#62; &#39;Meditative&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;46 &nbsp;=&#62; &#39;Instrumental Pop&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;47 &nbsp;=&#62; &#39;Instrumental Rock&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;48 &nbsp;=&#62; &#39;Ethnic&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;49 &nbsp;=&#62; &#39;Gothic&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;50 &nbsp;=&#62; &#39;Darkwave&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;51 &nbsp;=&#62; &#39;Techno-Industrial&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;52 &nbsp;=&#62; &#39;Electronic&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;53 &nbsp;=&#62; &#39;Pop-Folk&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;54 &nbsp;=&#62; &#39;Eurodance&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;55 &nbsp;=&#62; &#39;Dream&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;56 &nbsp;=&#62; &#39;Southern Rock&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;57 &nbsp;=&#62; &#39;Comedy&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;58 &nbsp;=&#62; &#39;Cult&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;59 &nbsp;=&#62; &#39;Gangsta&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;60 &nbsp;=&#62; &#39;Top 40&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;61 &nbsp;=&#62; &#39;Christian Rap&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;62 &nbsp;=&#62; &#39;Pop/Funk&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;63 &nbsp;=&#62; &#39;Jungle&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;64 &nbsp;=&#62; &#39;Native US&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;65 &nbsp;=&#62; &#39;Cabaret&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;66 &nbsp;=&#62; &#39;New Wave&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;67 &nbsp;=&#62; &#39;Psychadelic&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;68 &nbsp;=&#62; &#39;Rave&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;69 &nbsp;=&#62; &#39;Showtunes&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;70 &nbsp;=&#62; &#39;Trailer&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;71 &nbsp;=&#62; &#39;Lo-Fi&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;72 &nbsp;=&#62; &#39;Tribal&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;73 &nbsp;=&#62; &#39;Acid Punk&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;74 &nbsp;=&#62; &#39;Acid Jazz&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;75 &nbsp;=&#62; &#39;Polka&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;76 &nbsp;=&#62; &#39;Retro&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;77 &nbsp;=&#62; &#39;Musical&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;78 &nbsp;=&#62; &#39;Rock &amp; Roll&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;79 &nbsp;=&#62; &#39;Hard Rock&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;80 &nbsp;=&#62; &#39;Folk&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;81 &nbsp;=&#62; &#39;Folk-Rock&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;82 &nbsp;=&#62; &#39;National Folk&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;83 &nbsp;=&#62; &#39;Swing&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;84 &nbsp;=&#62; &#39;Fast Fusion&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;85 &nbsp;=&#62; &#39;Bebob&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;86 &nbsp;=&#62; &#39;Latin&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;87 &nbsp;=&#62; &#39;Revival&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;88 &nbsp;=&#62; &#39;Celtic&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;89 &nbsp;=&#62; &#39;Bluegrass&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;90 &nbsp;=&#62; &#39;Avantgarde&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;91 &nbsp;=&#62; &#39;Gothic Rock&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;92 &nbsp;=&#62; &#39;Progressive Rock&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;93 &nbsp;=&#62; &#39;Psychedelic Rock&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;94 &nbsp;=&#62; &#39;Symphonic Rock&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;95 &nbsp;=&#62; &#39;Slow Rock&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;96 &nbsp;=&#62; &#39;Big Band&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;97 &nbsp;=&#62; &#39;Chorus&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;98 &nbsp;=&#62; &#39;Easy Listening&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;99 &nbsp;=&#62; &#39;Acoustic&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;100 =&#62; &#39;Humour&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;101 =&#62; &#39;Speech&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;102 =&#62; &#39;Chanson&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;103 =&#62; &#39;Opera&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;104 =&#62; &#39;Chamber Music&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;105 =&#62; &#39;Sonata&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;106 =&#62; &#39;Symphony&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;107 =&#62; &#39;Booty Bass&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;108 =&#62; &#39;Primus&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;109 =&#62; &#39;Porn Groove&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;110 =&#62; &#39;Satire&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;111 =&#62; &#39;Slow Jam&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;112 =&#62; &#39;Club&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;113 =&#62; &#39;Tango&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;114 =&#62; &#39;Samba&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;115 =&#62; &#39;Folklore&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;116 =&#62; &#39;Ballad&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;117 =&#62; &#39;Power Ballad&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;118 =&#62; &#39;Rhytmic Soul&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;119 =&#62; &#39;Freestyle&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;120 =&#62; &#39;Duet&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;121 =&#62; &#39;Punk Rock&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;122 =&#62; &#39;Drum Solo&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;123 =&#62; &#39;Acapella&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;124 =&#62; &#39;Euro-House&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;125 =&#62; &#39;Dance Hall&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;126 =&#62; &#39;Goa&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;127 =&#62; &#39;Drum &amp; Bass&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;128 =&#62; &#39;Club-House&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;129 =&#62; &#39;Hardcore&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;130 =&#62; &#39;Terror&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;131 =&#62; &#39;Indie&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;132 =&#62; &#39;BritPop&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;133 =&#62; &#39;Negerpunk&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;134 =&#62; &#39;Polsk Punk&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;135 =&#62; &#39;Beat&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;136 =&#62; &#39;Christian Gangsta Rap&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;137 =&#62; &#39;Heavy Metal&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;138 =&#62; &#39;Black Metal&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;139 =&#62; &#39;Crossover&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;140 =&#62; &#39;Contemporary Christian&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;141 =&#62; &#39;Christian Rock&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;142 =&#62; &#39;Merengue&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;143 =&#62; &#39;Salsa&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;144 =&#62; &#39;Trash Metal&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;145 =&#62; &#39;Anime&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;146 =&#62; &#39;Jpop&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;147 =&#62; &#39;Synthpop&#39;);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if(($genre&#60;148) &amp;&amp; ($genre&#62;-1))</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return $_genres[$genre];</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return &#39;&#39;;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">function GetLayer($byte)</div><div class="code_line">{ &nbsp; $ret = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$layers = Array(0, 3, 2, 1);</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((ord($byte) &amp; 2) == 2) $ret += 1;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((ord($byte) &amp; 4) == 4) $ret += 2;</div><div class="code_line">&nbsp;&nbsp; &nbsp;return $layers[$ret];</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">function isOriginal($byte)</div><div class="code_line">{ &nbsp; $ret = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$originals = Array(&#39;No&#39; ,&#39;Yes&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((ord($byte) &amp; 4) == 4) $ret += 1;</div><div class="code_line">&nbsp;&nbsp; &nbsp;return $originals[$ret];</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">function getEmphasis($byte)</div><div class="code_line">{ &nbsp; $ret = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$emphasis = Array(&#39;None&#39;, &#39;50/15 microseconds&#39;, &#39;Dunno&#39;, &#39;CITT j.17&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((ord($byte) &amp; 1) == 1) $ret += 1;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((ord($byte) &amp; 2) == 2) $ret += 2;</div><div class="code_line">&nbsp;&nbsp; &nbsp;return $emphasis[$ret];</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">function getChanels($byte)</div><div class="code_line">{ &nbsp; $ret = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$chanels = Array(&#39;Stereo&#39;, &#39;Joint stereo&#39;, &#39;Dual channel&#39;, &#39;Mono&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((ord($byte) &amp; 64) == 64) $ret += 1;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((ord($byte) &amp; 128) == 128) $ret += 2;</div><div class="code_line">&nbsp;&nbsp; &nbsp;return $chanels[$ret];</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">function GetMPEG($byte)</div><div class="code_line">{ &nbsp; $ret = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$mpegs = Array(&#39;2.5&#39;,&#39;?&#39;,&#39;2.0&#39;,&#39;1.0&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((ord($byte) &amp; 8) == 8) $ret |= 1;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((ord($byte) &amp; 16) == 16) $ret |= 2;</div><div class="code_line">&nbsp;&nbsp; &nbsp;return $mpegs[$ret];</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">function GetSampleRate($byte, $mpeg)</div><div class="code_line">{ &nbsp; $ret = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$samplerate1 = Array(44100,48000,32000,&#39;?&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;$samplerate2 = Array(22050,24000,16000, &#39;?&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((ord($byte) &amp; 4) == 4) $ret += 1;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((ord($byte) &amp; 8) == 8) $ret += 2;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if($mpeg==&#39;1.0&#39;)</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return $samplerate1[$ret];</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;elseif($mpeg==&#39;2.0&#39;)</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return $samplerate2[$ret];</div><div class="code_line">&nbsp;&nbsp; &nbsp;}else{return &#39;?&#39;;}</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">function GetBitRate($byte, $mpeg, $layer)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp;$ret = 0;</div><div class="code_line">&nbsp;&nbsp;if ((ord($byte) &amp; 16) == 16) {$ret |= 1;}</div><div class="code_line">&nbsp;&nbsp;if ((ord($byte) &amp; 32) == 32) {$ret |= 2;}</div><div class="code_line">&nbsp;&nbsp;if ((ord($byte) &amp; 64) == 64) {$ret |= 4;}</div><div class="code_line">&nbsp;&nbsp;if ((ord($byte) &amp; 128) == 128) {$ret |= 8;}</div><div class="code_line">&nbsp;&nbsp;$bitrates = Array(</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;1.0&#39;=&#62;Array(</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;1&#39;=&#62;Array(0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,&#39;?&#39;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;2&#39;=&#62;Array(0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,&#39;?&#39;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;3&#39;=&#62;Array(0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,&#39;?&#39;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;2.0&#39;=&#62;Array(</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;1&#39;=&#62;Array(0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,&#39;?&#39;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;2&#39;=&#62;Array(0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,&#39;?&#39;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;3&#39;=&#62;Array(0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,&#39;?&#39;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;);</div><div class="code_line">&nbsp;&nbsp;return $bitrates[$mpeg][$layer][$ret];</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">function getTags($mp3file)</div><div class="code_line">{</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$bpp = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$tags = Array();</div><div class="code_line">&nbsp;&nbsp; &nbsp;$tags[&#39;FILE&#39;] = (realpath($mp3file));</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if(file_exists($mp3file))</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if(is_readable($mp3file))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$f = fopen($mp3file,&#39;r&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fseek($f,filesize($mp3file)-128);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$ret = fread($f,128);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$start = -1;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//search mp3-header</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for ($i = 0; $i &#60;= filesize($mp3file); $i++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fseek($f, $i);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$byte = fread($f, 1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(ord($byte)==255)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fseek($f, $i+1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$bits = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$byte = fread($f, 1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ((ord($byte) &amp; 32) == 32) {$bits |= 2;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ((ord($byte) &amp; 64) == 64) {$bits |= 4;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ((ord($byte) &amp; 128) == 128) {$bits |= 8;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ($bits==14)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$start = $i;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;FILESIZE&#39;] = filesize($mp3file);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if($start&#62;=0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fseek($f, $start + 0); $byte0 = fread($f, 1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fseek($f, $start + 1); $byte1 = fread($f, 1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fseek($f, $start + 2); $byte2 = fread($f, 1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fseek($f, $start + 3); $byte3 = fread($f, 1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fseek($f, $start + 36); $xing = fread($f, 4);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;VBR&#39;] = isVBR($xing);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;FRAMES&#39;] = 1;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if($tags[&#39;VBR&#39;]==&quot;yes&quot;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//calculate # of frames</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$Frames = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fseek($f, $start + 44);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$frame = fread($f, 4); //get framelength</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$Frames = ByteToBit($frame);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;FRAMES&#39;] = $Frames;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fclose($f);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;MPEG&#39;] = GetMPEG($byte1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;LAYER&#39;] = GetLayer($byte1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;SAMPLERATE&#39;] = GetSampleRate($byte2, $tags[&#39;MPEG&#39;]);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if($tags[&#39;VBR&#39;]==&quot;yes&quot;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$Temp = Array(0, 12, 144, 144);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;BPP&#39;] = (filesize($mp3file) * $tags[&#39;SAMPLERATE&#39;]) / (intval($tags[&#39;FRAMES&#39;])) / 1000 / $Temp[round($tags[&#39;LAYER&#39;])];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;BPP&#39;] = GetBitRate($byte2, $tags[&#39;MPEG&#39;], $tags[&#39;LAYER&#39;]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;LENGTH&#39;] = intval(($tags[&#39;FILESIZE&#39;] * 8) / $tags[&#39;BPP&#39;] / 1000);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//$Duration = intval($Duration / 60) . &quot;m &quot; . ($Duration - intval($Duration / 60) * 60) . &quot;s&quot;;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// floor( ((8 * filesize($mp3file))/1000) / $tags[&#39;BPP&#39;]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;CHANELS&#39;] = getChanels($byte3);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;EMPHASIS&#39;] = getEmphasis($byte3);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;ORIGINAL&#39;] = isOriginal($byte3);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;BPP&#39;] = intval($tags[&#39;BPP&#39;]);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return false;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//$tags[] = $ret;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(substr($ret,0,3)==&quot;TAG&quot;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;TITLE&#39;] = (chop(substr($ret,3,32-3+1)));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;ARTIST&#39;] = (chop(substr($ret,33,62-33+1)));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;ALBUM&#39;] = (chop(substr($ret,63,92-63+1)));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;YEAR&#39;] = (chop(substr($ret,93,96-93+1)));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;GENRECODE&#39;] = (ord(substr($ret,127,1)));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;GENRE&#39;] = (GetGenre(ord(substr($ret,127,1))));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if((ord(substr($ret,125,1))==0) &amp;&amp; (ord(substr($ret,126,1))!==0))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;TRACK&#39;] = (ord(substr($ret,126,1)));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;COMMENT&#39;] = (chop(substr($ret,97,28)));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tags[&#39;COMMENT&#39;] = (chop(substr($ret,97,30)));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;return $tags;</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">?&#62;</div></ol></div></div></div></div><br>
<br>
Обсуждение и доработки здесь: <a class='tag-url' href='http://forum.sources.ru/index.php?showtopic=188067' target='_blank'>mp3, tags, id3v1</a>]]></description>
        <author>Рысь</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=843148</guid>
        <pubDate>Thu, 01 Sep 2005 05:31:53 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=843148</link>
        <description><![CDATA[Axis: <span class="tag-color tag-color-named" data-value="green" style="color: green"><span class='tag-size' data-value='13' style='font-size:13pt;'>RSTPL - Быстрая библиотека для работы с шаблонами</span><br>
</span><br>
<span class="tag-color tag-color-named" data-value="blue" style="color: blue"><strong class='tag-b'>Автор:</strong> <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=3019' target='_blank'>Axis</a><br>
<strong class='tag-b'>Язык:</strong> PHP4 и выше</span><br>
<br>
Данная библиотека работает с шаблонами со скоростью обработки строк заключенных в &quot;&quot;. Шаблоны могут содержать только те данные, что может содержать текст заключенный в &quot;&quot;, но, с другой стороны, используя средства PHP, нельзя создать что-то быстрее.<br>
Возможности:<ul class="tag-list"><li>Несколько шаблонов в одном файле</li><li>Поддержка глобальных и локальных подставляемых переменных</li><li>Работа с динамическими блоками</li><li>Высокая скорость</li></ul><br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;<a class='tag-url' href='http://forum.sources.ru/index.php?showtopic=68017' target='_blank'>Обсуждение FAQ-ов</a>&quot;</span></span>]]></description>
        <author>Axis</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=746591</guid>
        <pubDate>Sun, 12 Jun 2005 01:00:26 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=746591</link>
        <description><![CDATA[aGR: <span class="tag-color tag-color-named" data-value="green" style="color: green"><span class='tag-size' data-value='14' style='font-size:14pt;'>Класс для упрощения работы с БД MySQL</span></span><br>
<br>
<span class="tag-color tag-color-named" data-value="blue" style="color: blue"><strong class='tag-b'>Язык:</strong> PHP<br>
<strong class='tag-b'>Автор:</strong> <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=23857' target='_blank'>aGR</a></span><br>
<br>
В классе 3 функции:<br>
1) Соединение с сервером и выбор БД<br>
2) SQL запрос к БД с отслеживанием ошибок<br>
3) Демонстрация содержимого результата запроса в виде HTML таблицы<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;<a class='tag-url' href='http://forum.sources.ru/index.php?showtopic=68017' target='_blank'>Обсуждение FAQ-ов</a>&quot;</span></span>]]></description>
        <author>aGR</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=661605</guid>
        <pubDate>Mon, 28 Mar 2005 13:48:53 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=661605</link>
        <description><![CDATA[Tishaishii: Утилита Str2Rex v0.98b - помогает преобразовывать пару строк в<br>
регулярное выражение.<br>
<br>
Мануал:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp;Str2Rex v0.98b util - simply converts two strings to RegExp</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;This util based on the classic LCS algorithm.</div><div class="code_line">&nbsp;</div><div class="code_line">-------------------------------------------------------------------</div><div class="code_line">&nbsp;Usage:</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;perl str2rex.pl -in=in.txt -out=out.txt</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;perl str2rex.pl -in=in.txt -out=out.txt -locale=on</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;perl str2rex.pl in=in.txt out=out.txt locale=off -join=(.+?)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;Arguments:</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -in - Input file path.</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-out - Output file path.</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; -locale - Switches on/off using locale.</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -join - Use this argument to set variable part of</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the resulting RegExp. Default value is (.*?)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;Example:</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;Meaning, input file contains two strings and</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;have following Perl syntax:</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;# file &quot;in.txt&quot;</div><div class="code_line">&nbsp;#-----------------------------------------------------------------</div><div class="code_line">&nbsp;# The beginning of input file</div><div class="code_line">&nbsp;+ [&#60;&#60;&#39;-- DELIMETER 1 --&#39;, &#60;&#60;&#39;-- DELIMETER 2 --&#39;];</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;This!</div><div class="code_line">&nbsp;&nbsp; &nbsp;is the</div><div class="code_line">&nbsp;&nbsp; &nbsp; &quot;first</div><div class="code_line">&nbsp;&nbsp;string!</div><div class="code_line">&nbsp;</div><div class="code_line">-- DELIMETER 1 --</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;This</div><div class="code_line">&nbsp;&nbsp; &nbsp;is&#62;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;the &quot;second string</div><div class="code_line">&nbsp;</div><div class="code_line">-- DELIMETER 2 --</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;# The end of input file</div><div class="code_line">&nbsp;#-----------------------------------------------------------------</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;Then enter at your command line following commands:</div><div class="code_line">&nbsp;perl str2rex.pl -in=in.txt -out=out.txt</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;As result you have something like:</div><div class="code_line">&nbsp;This(.*?)\ is(.*?)\ the\ \&quot;(.*?)s(.*?)\ string</div><div class="code_line">&nbsp;</div><div class="code_line">-------------------------------------------------------------------</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Shatrow Aleksey &#60;cdch@yandex.ru&#62;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Krasnodar, 28.03.2005</div><div class="code_line">-------------------------------------------------------------------</div></ol></div></div></div></div><br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;<a class='tag-url' href='http://forum.sources.ru/index.php?showtopic=68017' target='_blank'>Обсуждение FAQ-ов</a>&quot;</span></span>]]></description>
        <author>Tishaishii</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=659110</guid>
        <pubDate>Sat, 26 Mar 2005 00:46:09 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=659110</link>
        <description><![CDATA[Tishaishii: Универсальный преобразователь текстовых документов RXParser 2.0<br>
<br>
Модуль RXParser создан для преобразования текстовых документов с использованием<br>
шаблонов.<br>
Для использования этого модуля вам потребуется версия Perl 5.6.x. <br>
<br>
Что нового?<br>
<br>
Версия 2.0: <br>
<br>
1. Классы пакета RXParser разложены по файлам с возможностью единообразной загрузки<br>
из любого<br>
класса пакета: <br>
   Filter<br>
   Rules<br>
   Template<br>
   Parser<br>
   Wizard<br>
<br>
2. Добавлен класс RXParser::Wizard, работающий со всеми классами пакета (Rules,<br>
Template,<br>
Parser, Filter). <br>
3. Упрощена работа с модулями. Основной модуль RXParser контролирует загрузку прочих<br>
модулей.<br>
<br>
Версия 1.7125:<br>
<br>
1. Ускорена загрузка правил. Добавлена возможность сохранения отпарсенных правил<br>
разбора и<br>
сборки в отдельный файл с возможностью загрузки. <br>
2. Исправлена ошибка несовместимости версии 1.6001. Теперь RXParser 1.7125 работает<br>
для разных<br>
платформ одинаково.<br>
3. Дополнительно оптимизирован код модуля.<br>
<br>
Версия 1.6001: <br>
<br>
1. Введено пространство префиксов - в будущих версиях возможно появление<br>
дополнительных<br>
возможностей управления выводом, таких как итератор в текущей версии. <br>
2. Дополнительно оптимизирован код модуля.<br>
<br>
Версия 1.6: <br>
<br>
1. Полностью переписан движок для записи шаблонов. Теперь процесс форматирования<br>
выходных<br>
документов происходит много быстрее и стал ещё менее требователен к ресурсам. <br>
2. Включена поддержка кроссплатформенной блокировки файлов.<br>
3. Дополнительно оптимизирован код модуля.<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;<a class='tag-url' href='http://forum.sources.ru/index.php?showtopic=68017' target='_blank'>Обсуждение FAQ-ов</a>&quot;</span></span>]]></description>
        <author>Tishaishii</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=592771</guid>
        <pubDate>Thu, 27 Jan 2005 17:41:56 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=592771</link>
        <description><![CDATA[Tishaishii: <span class="tag-color tag-color-named" data-value="green" style="color: green"><span class='tag-size' data-value='13' style='font-size:13pt;'>Класс &quot;Hash&quot;</span><br>
<br>
Переопределение хэш-массива для работы с нечёткими ключами.<br>
</span><br>
<span class="tag-color tag-color-named" data-value="blue" style="color: blue"><strong class='tag-b'>Автор:</strong> <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=3254' target='_blank'>Tishaishii</a>.<br>
<strong class='tag-b'>Язык:</strong> Perl.<br>
</span><br>
POD-описание внутри.]]></description>
        <author>Tishaishii</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=569457</guid>
        <pubDate>Sat, 08 Jan 2005 23:25:26 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=569457</link>
        <description><![CDATA[Tishaishii: Абстрактный класс &quot;Object&quot; для быстрого создания пакетов с поддержкой методов:<ul class="tag-list"><li>new - создание объекта</li><li>get - получение ссылки на атрибут</li><li>set - установка атрибута</li><li>check - установить атрибут, если атрибут не определён</li><li>del - удаление атрибута</li><li>def - проверка определённости атрибута</li></ul>события:<ul class="tag-list"><li>before, after - вызов пользовательских процедур</li></ul><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">package Object;</div><div class="code_line">use subs qw&#39;before after&#39;;</div><div class="code_line">use overload &#39;&quot;&quot;&#39;=&#62;&#39;___str___&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;~&#39;=&#62;&#39;DESTROY&#39;;</div><div class="code_line">&nbsp;</div><div class="code_line">sub __new__ {</div><div class="code_line">&nbsp;&nbsp; &nbsp;my($class, $self)=(shift, {@_});</div><div class="code_line">&nbsp;&nbsp; &nbsp;bless $self, $class;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$self-&#62;after_new;</div><div class="code_line">&nbsp;&nbsp; &nbsp;+$self</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">sub __check__ {</div><div class="code_line">&nbsp;&nbsp; &nbsp;my$self=shift;</div><div class="code_line">&nbsp;&nbsp; &nbsp;my$val=pop;</div><div class="code_line">&nbsp;&nbsp; &nbsp;my$var=$self-&#62;__get__(@_);</div><div class="code_line">&nbsp;&nbsp; &nbsp;$$var=$val unless defined$$var;</div><div class="code_line">&nbsp;&nbsp; &nbsp;+$var</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">sub __def__ {+defined shift-&#62;Get(@_)}</div><div class="code_line">sub __set__ {</div><div class="code_line">&nbsp;&nbsp; &nbsp;my$self=shift;</div><div class="code_line">&nbsp;&nbsp; &nbsp;my($val, $attr)=(pop, $self-&#62;__get__(@_));</div><div class="code_line">&nbsp;&nbsp; &nbsp;$self-&#62;before_set;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$$attr=$val;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$self-&#62;after_set;</div><div class="code_line">&nbsp;&nbsp; &nbsp;+$attr</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">sub __get__ {</div><div class="code_line">&nbsp;&nbsp; &nbsp;my$self=shift;</div><div class="code_line">&nbsp;&nbsp; &nbsp;my($result, $self_ref, $ref)=($self, ref$self);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$result=do{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$ref=ref$$result;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if($ref eq &#39;HASH&#39; or $ref eq $self_ref)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+$$result-&#62;{$_}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;elsif($ref eq &#39;ARRAY&#39;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+$$result-&#62;[$_]</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return undef</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;} foreach @_;</div><div class="code_line">&nbsp;&nbsp; &nbsp;+$result</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">sub __del__ {</div><div class="code_line">&nbsp;&nbsp; &nbsp;my$self=shift;</div><div class="code_line">&nbsp;&nbsp; &nbsp;my$last=pop;</div><div class="code_line">&nbsp;&nbsp; &nbsp;my($result, $self_ref, $ref, $ret)=($self, ref$self);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$result=do{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$ref=ref$$result;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if($ref eq &#39;HASH&#39; or $ref eq $self_ref)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+$$result-&#62;{$_}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;elsif($ref eq &#39;ARRAY&#39;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+$$result-&#62;[$_]</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return undef</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;} foreach @_;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;+do{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$ref=ref$$result;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if($ref eq &#39;HASH&#39; or $ref eq $self_ref)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+delete$$result-&#62;{$last}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;elsif($ref eq &#39;ARRAY&#39;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$ret=$$result-&#62;[$last];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;@$$result=@$$result[0..$last-1, $last+1..$#$$result];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+$ret</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$ret=$$result;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;undef$$result;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+$ret</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">sub ___str___ {</div><div class="code_line">&nbsp;&nbsp; &nbsp;use Data::Dumper;</div><div class="code_line">&nbsp;&nbsp; &nbsp;+Dumper shift</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">sub __after__ {+@_}</div><div class="code_line">sub __before__ {+@_}</div><div class="code_line">&nbsp;</div><div class="code_line">sub __CORE__::Object::AUTOLOAD {</div><div class="code_line">&nbsp;&nbsp; &nbsp;my$self=shift;</div><div class="code_line">&nbsp;&nbsp; &nbsp;my($package)=$AUTOLOAD=~/^(.+)::(.+)$/o or return undef;</div><div class="code_line">&nbsp;&nbsp; &nbsp;index , &#39;__&#39; or die &#39;:)Can\&#39;t locate method &#39;..&#39; in package &#39;.__PACKAGE__;</div><div class="code_line">&nbsp;&nbsp; &nbsp;my($function, @args)=split &#39;_&#39;, ;</div><div class="code_line">&nbsp;&nbsp; &nbsp;my@result=$self-&#62;${\(&#39;__&#39;.lcfirst($function).&#39;__&#39;)}(@args, @_);</div><div class="code_line">&nbsp;&nbsp; &nbsp;if($function=~/^[A-Z]/o)</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$result[0]=${$result[0]} while ref$result[0] eq &#39;SCALAR&#39; || ref$result[0] eq &#39;REF&#39;;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;+wantarray?@result:$result[0]</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">sub DESTROY {undef $_[0]}</div><div class="code_line">&nbsp;</div><div class="code_line">+1;</div><div class="code_line">&nbsp;</div><div class="code_line">__END__</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">=head1 NAME</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Object - Provides abstract object class</div><div class="code_line">&nbsp;</div><div class="code_line">=head1 VERSION</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;This document describes version 1.0 of Object.pm module,</div><div class="code_line">&nbsp;&nbsp; &nbsp;released Jan 08, 2005.</div><div class="code_line">&nbsp;</div><div class="code_line">=head1 SYNOPSIS</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;package My::Package;</div><div class="code_line">&nbsp;&nbsp; &nbsp;use base &#39;Object&#39;;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;# methods &quot;new&quot;, &quot;set&quot;, &quot;get&quot; and their aliases</div><div class="code_line">&nbsp;&nbsp; &nbsp;# are defined, place here your other methods,</div><div class="code_line">&nbsp;&nbsp; &nbsp;# vars, constants, etc.</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;package main;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$obj=new My::Package(</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;size=&#62;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;b=&#62;&#39;c&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;d=&#62;&#39;e&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;c=&#62;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;t&#39;=&#62;&#39;w&#39;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;},</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;weight=&#62;[</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;12,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;z=&#62;&#39;r&#39;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;]</div><div class="code_line">&nbsp;&nbsp; &nbsp;);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$z=$obj-&#62;set_weight_1_z(&#39;f&#39;); &nbsp; &nbsp; &nbsp; # returns $obj-&#62;{weight}[1]{z}{f}</div><div class="code_line">&nbsp;&nbsp; &nbsp;print $obj-&#62;Set_size_w({</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;t&#39;=&#62;&#39;z&#39;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;y&#39;=&#62;&#39;x&#39;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;})-&#62;{t}; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# prints &#39;z&#39;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$c=$obj-&#62;get_size(&#39;c&#39;); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # returns $obj-&#62;{size}{c}</div><div class="code_line">&nbsp;&nbsp; &nbsp;print $$c-&#62;{t}; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # prints &#39;w&#39;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$$c={11=&#62;12};</div><div class="code_line">&nbsp;&nbsp; &nbsp;print $obj-&#62;Get_size_c_11; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# prints &#39;12&#39;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$c=$obj-&#62;Get_size_c-&#62;{t}; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # returns $obj-&#62;{size}{c}{t}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;print int $obj-&#62;def_color; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# checks if key &#39;color&#39; is defined</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;$obj-&#62;check_color(&#39;red&#39;); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # sets value &#39;red&#39; on key &#39;color&#39;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# if it&#39;s not defined</div><div class="code_line">&nbsp;</div><div class="code_line">=head1 DESCRIPTION</div><div class="code_line">&nbsp;</div><div class="code_line">=head1 METHODS</div><div class="code_line">&nbsp;</div><div class="code_line">=over 4</div><div class="code_line">&nbsp;</div><div class="code_line">=item ___str___</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;Returns a string, which was generated by L&#60;Data::Dumper&#62; from data stored in object</div><div class="code_line">&nbsp;</div><div class="code_line">=back</div><div class="code_line">&nbsp;</div><div class="code_line">=head1 AUTHOR</div><div class="code_line">&nbsp;</div><div class="code_line">Shatrov Alexey mail@yandex.ru</div><div class="code_line">&nbsp;</div><div class="code_line">Copyright (c) 2005 Shatrov Alexey. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</div><div class="code_line">&nbsp;</div><div class="code_line">=cut</div></ol></div></div></div></div>]]></description>
        <author>Tishaishii</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=490713</guid>
        <pubDate>Sat, 23 Oct 2004 14:45:47 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=490713</link>
        <description><![CDATA[Trustmaster: <span class="tag-color tag-color-named" data-value="green" style="color: green"><span class='tag-size' data-value='14' style='font-size:14pt;'>XTPL Template Engine</span><br>
<br>
Компактный и удобный интерпретирующий шаблонный движок.</span><br>
<br>
<span class="tag-color tag-color-named" data-value="blue" style="color: blue"><strong class='tag-b'>Автор:</strong> <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=11428' target='_blank'>Trustmaster.</a><br>
<strong class='tag-b'>Язык:</strong> PHP4.</span><br>
<br>
Никто не оспаривает непревзойденные возможности Smarty - лучшего шаблонного движка для PHP. Но во многих случаях использовать Smarty - как стрелять из пушки по воробьям. Выходит, что 99% скриптов составляет сам шаблонный движок.<br>
<br>
В основе XTPL лежит немного иной принцип. Если Smarty компилирует шаблоны во временные PHP-скрипты, то XTPL - классический интепретатор. Кроме того, XTPL взаимодействует с PHP напрямую. Так, вы можете присвоить значение переменным частного сектора (видимым только из шаблонов) традиционным методом Assign(), а можете не делать этого, а работать напрямую с глобальной областью видимости вашего скрипта. При построении логических выражений и условий циклов используется синтаксис PHP. Вот некоторые ключевые аспекты XTPL:<ul class="tag-list"><li> При работе с переменными XTPL смотрит сначала в список переменных, присвоенных методом Assign(), а затем (если не нашел нужную переменную) обращается к глобальной области видимости. В большинстве случаев это позволяет избавиться от десятков лишних вызовов Assign().</li><li> Модификаторы переменных, как и в Smarty, но с расширенными возможностями. Фактически, любая PHP-функция может выступать в роли модификатора.</li><li> Конструкция {modify}{/modify}, преобразующая HTML внутри нее.</li><li> Ветвление {if}{else}{/if}.</li><li> Циклы for и while, удобные, к примеру, при формировании таблиц.</li><li> Полноценная поддержка вложенных (nested) конструкций, исключая только {modify}{/modify} и {php}{/php}.</li><li> Конструкции {include} и {php}{/php}.</li><li> Набор классов, реализующих XHTML/HTML4 тэги в виде PHP классов. В том числе класс SelectTag для преобразования массивов в выпадающие списки.</li><li> Модульная поддержка функций- и классов-рассширений.</li></ul>Что касается производительности, то XTPL почти не уступает Smarty в скорости выполнения программы, а при использовании на сервере Zend Optimizer выигрывает 5-40%. В качестве теста был использован шаблон, содержащий два десятка переменных для подставновки и пару логических ветвлений. Конфигурация: Athlon XP 2800+, Apache 2.0.49 + PHP 4.3.8 + Zend Optimizer. Сначала был первый запуск скриптов (компиляция шаблонов Smarty и оптимизация промежуточного кода Zend Optimizer&#39;ом), после чего скрипты были перезапущены по 12 раз. Среднее время выполнения составило соответственно:<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Smarty            XTPL<br>
---------------------------<br>
0.04824           0.02907 </div></div><br>
<br>
В комплект поставки входит документация по классам и обучение по конструкциям (Tutorial).<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;Наша лаборатория&quot;</span></span>]]></description>
        <author>Trustmaster</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=488366</guid>
        <pubDate>Wed, 20 Oct 2004 17:56:53 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=488366</link>
        <description><![CDATA[Trustmaster: <span class="tag-color tag-color-named" data-value="green" style="color: green"><span class='tag-size' data-value='14' style='font-size:14pt;'>FTP Class</span><br>
<br>
<span class='tag-size' data-value='10' style='font-size:10pt;'>Расширенный драйвер FTP для PHP</span></span><br>
<br>
<span class="tag-color tag-color-named" data-value="blue" style="color: blue"><strong class='tag-b'>Автор:</strong> <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=11428' target='_blank'>Trustmaster</a><br>
<strong class='tag-b'>Язык:</strong> PHP4</span><br>
<br>
Этот класс предоставляет удобную объектно-ориентированную оболочку для стандартных FTP-функций PHP. Кроме того, он содержит методы, позволяющие производить более сложные операции (к примеру, закачка целой папки рекурсивно) и работать с файлами удаленно (чтение/запись). Некоторые методы позволяют вам не вникать в тонкости протокола FTP, другие наоборот, позволяют работать с FTP сервером напрямую.<br>
<br>
В комплект поставки входит документация по классу.<br>
<br>
Ждем с нетерпением стабильного PHP5, который несет с собой новые возможности работы с FTP.<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;Наша лаборатория&quot;</span></span>]]></description>
        <author>Trustmaster</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=479483</guid>
        <pubDate>Sat, 09 Oct 2004 19:40:12 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=479483</link>
        <description><![CDATA[Trustmaster: <span class="tag-color tag-color-named" data-value="green" style="color: green"><span class='tag-size' data-value='13' style='font-size:13pt;'>SQLDB Class Library v.1.3.11</span><br>
<br>
Объектно ориентированный подход к работе с базами данных.<br>
</span><br>
<span class="tag-color tag-color-named" data-value="blue" style="color: blue"><strong class='tag-b'>Автор:</strong> <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=11428' target='_blank'>Trustmaster</a><br>
<strong class='tag-b'>Язык:</strong> PHP4<br>
</span><br>
Вам может показаться громоздким и нелогичным такой подход, но как показывает реальность, большинство серьезных проектов на PHP придерживаются именно объектно ориентированной методологии, в том числе и при работе с базами данных. Основная направленность таких классов - оградить разработчика от технических деталей. Полиморфизм позволяет использовать один и тот же код для разных баз данных. Данная библиотека предоставляет полиморфные классы для баз данных:<ul class="tag-list"><li>FrontBase</li><li>Informix</li><li>Interbase</li><li>MiniSQL</li><li>Microsoft SQL Server</li><li>MySQL</li><li>PostgreSQL</li><li>SQLite</li><li>Sybase</li></ul>В комплект поставки входит документация.<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;Наша лаборатория&quot;</span></span>]]></description>
        <author>Trustmaster</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=468852</guid>
        <pubDate>Mon, 27 Sep 2004 19:20:15 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=468852</link>
        <description><![CDATA[Tishaishii: <span class="tag-color tag-color-named" data-value="green" style="color: green"><span class='tag-size' data-value='13' style='font-size:13pt;'>Программа кружка про создание www-приложений. Тема: &quot;Базовые конструкции языка программирования Perl&quot;.</span></span><br>
<br>
<span class="tag-color tag-color-named" data-value="blue" style="color: blue"><strong class='tag-b'>Автор:</strong> <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=3254' target='_blank'>Tishaishii</a></span><br>
<br>
Решил в институте открыть кружок &quot;Золотая, смелая и умелая клавиатура, да гибкие пальчики&quot; или &quot;Бодрая мышка с нарушкой&quot; про www-мастерство. Декан одобрил и деньги предложил. Идея хорошая.<br>
Вот здесь (в пакетике) материалы по нему самому (по кружку &quot;Золотая, смелая и умелая клавиатура, да гибкие пальчики&quot;).<br>
Краткое описание 13 лекционных занятий и 13 практических. Курс только по возможностям самого языка. Про модули пока ничего не придумал. В целях курса не было обучение системных администраторов, но предъявить возможности и тонкости языка.<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;Наша лаборатория&quot;</span></span>]]></description>
        <author>Tishaishii</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=446587</guid>
        <pubDate>Tue, 31 Aug 2004 12:12:20 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=446587</link>
        <description><![CDATA[Tishaishii: <span class="tag-color tag-color-named" data-value="green" style="color: green"><span class='tag-size' data-value='13' style='font-size:13pt;'>Коллектор ТВ-программ</span></span><br>
<br>
<span class="tag-color tag-color-named" data-value="blue" style="color: blue"><strong class='tag-b'>Автор:</strong> <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=3254' target='_blank'>Tishaishii</a></span><br>
<br>
А это затравка для разработки менеджмента телепрограммами.<br>
Подворовываются с www.rambler.ru. Жаль, только ресурсы кушает много (зато один раз на всю неделю), но без этого никак.<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;Наша лаборатория&quot;</span></span>]]></description>
        <author>Tishaishii</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=434932</guid>
        <pubDate>Thu, 19 Aug 2004 11:50:06 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=434932</link>
        <description><![CDATA[Trustmaster: <span class="tag-color tag-color-named" data-value="green" style="color: green"><span class='tag-size' data-value='13' style='font-size:13pt;'>Безопасные Сессии</span><br>
<br>
<span class='tag-size' data-value='10' style='font-size:10pt;'>Замещенный механизм, хранящий данные сессии в БД.</span></span><br>
<span class="tag-color tag-color-named" data-value="blue" style="color: blue"><br>
<strong class='tag-b'>Язык:</strong> PHP<br>
<strong class='tag-b'>Автор:</strong> <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=11428' target='_blank'>Trustmaster</a></span><br>
<br>
Слабость стандартного механизма сессий PHP заключается в том, что сами данные сессии хранятся в виде файлов, доступных для чтения и записи любому желающему. Скрипт session_thief.php наглядно показывает, как эти данные можно извлечь.<br>
<br>
PHP позволяет замещать многие из его механизмов. Данный вариант замещенного механизма сессий PHP использует базы данных. Таким образом, вы можете создать единую таблицу для всех сессий в системе, но лучше, чтобы каждый сайт имел собственную таблицу сессий, что обеспечит большую конфиденциальность и даст вам дополнительные возможности. Например, вы сможете с легкостью узнать, сколько пользователей находятся в режиме OnLine, просто подсчитав количество валидных записей в таблице. Кроме того, вы сами можете модифицировать этот механизм под свои нужды, добавив, например, промежуточное шифрование данных (что не есть обязательно, если вы не раздаете свой пароль от mySQL каждому встречному-поперечному).<br>
<br>
Кроме того, этот вариант использует библиотеку SQLDB, поэтому он будет работать на MySQL, MSSQL и PostgreSQL.<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;Наша лаборатория&quot;</span></span>]]></description>
        <author>Trustmaster</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=433272</guid>
        <pubDate>Wed, 18 Aug 2004 06:56:23 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=433272</link>
        <description><![CDATA[Rom@nych: <span class="tag-color tag-color-named" data-value="green" style="color: green"><span class='tag-size' data-value='13' style='font-size:13pt;'>Плагин для системы Smarty</span></span><br>
<span class="tag-color tag-color-named" data-value="blue" style="color: blue"><br>
<strong class='tag-b'>Язык</strong>: РНР<br>
<strong class='tag-b'>Автор</strong>: <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=729' target='_blank'>Rom@nych</a><br>
<strong class='tag-b'>Тип:</strong> modifier</span><br>
<br>
Этот модификатор позволяет подсвечивать ссылки в тексте. Возможности: поиск всех ссылок в тексте на сайты и e-mail&#39;ы. если в ссылке указан хост сайта, то он будет открыт в новом окне, иначе - в том же. Также принимает аттрибут extras, который позволяет вставлять в ссылку доп. аттрибуты.<br>
Использование: <div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">{$var|hrefs:&#39;class=&quot;link&quot;&#39;}</div></ol></div></div></div></div><br>
Установка: скопировать файл в каталог plugins системы Smarty<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;Наша лаборатория&quot;</span></span>]]></description>
        <author>Rom@nych</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=425483</guid>
        <pubDate>Tue, 10 Aug 2004 09:37:59 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=425483</link>
        <description><![CDATA[Kheor: <span class='tag-size' data-value='13' style='font-size:13pt;'><span class="tag-color tag-color-named" data-value="green" style="color: green">Функция создания Pages Bar</span></span><br>
<span class="tag-color tag-color-named" data-value="blue" style="color: blue"><br>
<strong class='tag-b'>Язык:</strong> PHP<br>
<strong class='tag-b'>Автор:</strong> <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=7014' target='_blank'>Kheor</a> aka DUKe</span><br>
<br>
<span class="tag-color tag-color-named" data-value="purple" style="color: purple">исправлены ошибки: 24/10/2007. Отдельное и больше спасибо <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=19968' target='_blank'>Лёхе</a></span><br>
<br>
Функция создает что-то типа оглавления когда нужен постраничный вывод, например, у нас есть 23 страницы и выбрана 11ая страница (номер страницы передается методом get, параметром page). Тогда, чтобы создать оглавление вызываем:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">echo generatePagesBar(11, 23, &quot;&#60;a href=&#39;%PARAM_PAGE%&#39;&#62;%PARAM_PAGE%&#60;/a&#62; &quot;);</div></ol></div></div></div></div><br>
<br>
В результате имеем:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#60;a href = &#39;http://www.someplace.ru/somepage.php?page=1&#39;&#62;1&#60;/a&#62;,</div><div class="code_line">&#60;a href = &#39;http://www.someplace.ru/somepage.php?page=2&#39;&#62;2&#60;/a&#62;,</div><div class="code_line">&#60;a href = &#39;http://www.someplace.ru/somepage.php?page=3&#39;&#62;3&#60;/a&#62; ...</div><div class="code_line">&#60;a href = &#39;http://www.someplace.ru/somepage.php?page=10&#39;&#62;10&#60;/a&#62;,</div><div class="code_line">&#60;a href = &#39;http://www.someplace.ru/somepage.php?page=11&#39;&#62;11&#60;/a&#62;,</div><div class="code_line">&#60;a href = &#39;http://www.someplace.ru/somepage.php?page=12&#39;&#62;12&#60;/a&#62; ...</div><div class="code_line">&#60;a href = &#39;http://www.someplace.ru/somepage.php?page=21&#39;&#62;21&#60;/a&#62;,</div><div class="code_line">&#60;a href = &#39;http://www.someplace.ru/somepage.php?page=22&#39;&#62;22&#60;/a&#62;,</div><div class="code_line">&#60;a href = &#39;http://www.someplace.ru/somepage.php?page=23&#39;&#62;23&#60;/a&#62;</div></ol></div></div></div></div><br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;Наша лаборатория&quot;</span></span>]]></description>
        <author>Kheor</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=425291</guid>
        <pubDate>Tue, 10 Aug 2004 07:27:28 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=425291</link>
        <description><![CDATA[Trustmaster: <span class="tag-color tag-color-named" data-value="green" style="color: green"><span class='tag-size' data-value='13' style='font-size:13pt;'>Mailpost Server</span><br>
<br>
<span class='tag-size' data-value='10' style='font-size:10pt;'>Скрипт для отправки файлов по почте непосредственно из интернета.</span></span><br>
<span class="tag-color tag-color-named" data-value="blue" style="color: blue"><br>
<strong class='tag-b'>Язык:</strong> PHP (серверная часть), Free Pascal (клиентская)<br>
<strong class='tag-b'>Автор:</strong> <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=11428' target='_blank'>Trustmaster</a> &amp; <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=8274' target='_blank'>Argentum</a></span><br>
<br>
Скрипт полезен в том случае, если вы имеете почтовый ящик с неограниченным трафиком. Серверный скрипт располагается на вашем хостинге и предоставляет форму, в которой вы вводите URL нужного файла. После этого файл будет отправлен на ваш e-mail. Если размер файла превышает определенный лимит (по умолчанию 4МБ), он будет отправлен по частям, соединить которые можно при помощи клиентской программы. Подробную инструкцию читайте в README.<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;Наша лаборатория&quot;</span></span>]]></description>
        <author>Trustmaster</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=424700</guid>
        <pubDate>Mon, 09 Aug 2004 15:54:09 +0000</pubDate>
        <title>Наша Лаборатория</title>
        <link>https://forum.sources.ru/index.php?showtopic=78729&amp;view=findpost&amp;p=424700</link>
        <description><![CDATA[Rom@nych: <span class="tag-color tag-color-named" data-value="gray" style="color: gray">Если Вы хотите что-либо добавить или Вам что-либо не нравится - пишите <a class='tag-url' href='http://forum.sources.ru/index.php?showtopic=68017' target='_blank'>сюда</a></span><br>
<br>
<span class="tag-color tag-color-named" data-value="green" style="color: green"><span class='tag-size' data-value='13' style='font-size:13pt;'>Функция инициализирования переменной</span></span><br>
<span class="tag-color tag-color-named" data-value="blue" style="color: blue"><br>
<strong class='tag-b'>Язык</strong>: РНР<br>
<strong class='tag-b'>Автор</strong>: <a class='tag-url' href='http://forum.sources.ru/index.php?showuser=729' target='_blank'>Rom@nych</a></span><br>
<br>
Функция инициализирует переменную из данных GET, POST запроса или берёт её из сессионных данных. Принимает два параметра. Первый - строка - имя переменной, второй - значение, которое передастся переменной в случае, если она не может быть найдена. По умолчанию пустая строка.<br>
Пример вызова:<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">ini(&#39;action&#39;, &#39;none&#39;)</div></ol></div></div></div></div>В результате выполнения этого кода будет проинициализирована переменная &#036;action в случае, если она не содержится в массивах &#036;_POST, &#036;_GET, &#036;_SESSION она будет равна &#39;none&#39;<br>
При выборе массива идёт проверка в следующем порядке &#036;_POST, &#036;_GET, &#036;_SESSION<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;Наша лаборатория&quot;</span></span>]]></description>
        <author>Rom@nych</author>
        <category>HTTP сервера</category>
      </item>
	
      </channel>
      </rss>
	