source: branches/ray/plugins/InsertSnippet/snippets.php @ 761

Last change on this file since 761 was 761, checked in by ray, 13 years ago

updated branch

  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 508 bytes
RevLine 
[439]1<?php
[761]2$snippets_file = 'snippets.html';
[439]3
[761]4include_once('../../contrib/php-xinha.php');
5
6if($passed_data = xinha_read_passed_data())
[439]7{
[761]8        extract($passed_data);     
9}
10$snippets = file_get_contents($snippets_file);
11preg_match_all('/<!--(.*?)-->(.*?)<!--\/.*?-->/s',$snippets,$matches);
[439]12       
[761]13$array=array();
14for ($i=0;$i<count($matches[1]);$i++)
[439]15{
[761]16        $id = $matches[1][$i];
17        $html = $matches[2][$i];
18        $array[] = array('id'=>$id,'HTML'=>$html);
[439]19}
[761]20print "var snippets = " . xinha_to_js($array);
[439]21
22?>
Note: See TracBrowser for help on using the repository browser.