source: trunk/plugins/InsertSnippet/snippets.php @ 501

Last change on this file since 501 was 439, checked in by gocher, 14 years ago

new plugin InsertSnippet?

from Ticket #622 (only the img/ed_snippet.gif changed)

File size: 616 bytes
Line 
1var snippets = new Array();
2var i = 0;
3<?php
4
5function get_all_parts($string)
6{
7        preg_match_all('#<!--(.*?)-->(.*?)<!--/.*?-->#s',$string,$matches);
8       
9        $array=array();
10        for ($i=0;$i<count($matches[1]);$i++)
11        {
12                $array[$matches[1][$i]] = $matches[2][$i];
13        }
14        return $array;
15}
16$snippets = file_get_contents('snippets.html');
17
18$matches = get_all_parts($snippets);
19foreach ($matches as $name =>$html)
20{
21        print "snippets[i] = new Object();\n";
22        print "snippets[i]['id'] = '$name';\n";
23        print "snippets[i]['HTML'] = '".str_replace("\n",'\n',addcslashes($html,"'"))."';\n";
24        print "i++;\n";
25}
26
27?>
Note: See TracBrowser for help on using the repository browser.