phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: wiki/parse html.php,1.1.1.1,1.2 macros.php,1.1.


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: wiki/parse html.php,1.1.1.1,1.2 macros.php,1.1.1.1,1.2 main.php,1.1.1.1,1.2 save.php,1.1.1.1,1.2transforms.php,1.1.1.1,1.2
Date: Mon, 03 Mar 2003 08:37:08 -0500

Update of /cvsroot/phpgroupware/wiki/parse
In directory subversions:/tmp/cvs-serv23134/parse

Modified Files:
        html.php macros.php main.php save.php transforms.php 
Log Message:
make Axis-0.44 the new head-version

Index: html.php
===================================================================
RCS file: /cvsroot/phpgroupware/wiki/parse/html.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** html.php    3 Mar 2003 13:00:39 -0000       1.1.1.1
--- html.php    3 Mar 2003 13:37:05 -0000       1.2
***************
*** 44,48 ****
    { return '</dt>'; }
  function html_hr()
!   { return "<hr />\n"; }
  function html_newline()
    { return "<br />\n"; }
--- 44,48 ----
    { return '</dt>'; }
  function html_hr()
!   { return "<hr align=left width=99% />\n"; }
  function html_newline()
    { return "<br />\n"; }
***************
*** 197,203 ****
  {
    global $HomePage, $PrefsScript;
!   return html_ref($HomePage, $HomePage) . ' | ' .
           html_ref('RecentChanges', 'RecentChanges') . ' | ' .
!          '<a href="' . $PrefsScript . '">Preferences</a>';
  }
  function html_history_entry($page, $version, $time, $host, $user, $c1, $c2,
--- 197,210 ----
  {
    global $HomePage, $PrefsScript;
!   if ($GLOBALS['phpgw_info']['user']['apps']['admin']) {
!     return html_ref($HomePage, $HomePage) . ' | ' .
           html_ref('RecentChanges', 'RecentChanges') . ' | ' .
!          '<a href="' . $PrefsScript . '">Preferences</a> | '.
!          '<a 
href="'.$GLOBALS['phpgw']->link("/axiswiki/admin/index.php").'">Administration</a><br>';
!   } else {
!     return html_ref($HomePage, $HomePage) . ' | ' .
!          html_ref('RecentChanges', 'RecentChanges') . ' | ' .
!          '<a href="' . $PrefsScript . '">Preferences</a><br>';
!   }     
  }
  function html_history_entry($page, $version, $time, $host, $user, $c1, $c2,

Index: macros.php
===================================================================
RCS file: /cvsroot/phpgroupware/wiki/parse/macros.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** macros.php  3 Mar 2003 13:00:39 -0000       1.1.1.1
--- macros.php  3 Mar 2003 13:37:05 -0000       1.2
***************
*** 1,286 ****
! <?php
! // $Id$
! 
! // Prepare a category list.
! function view_macro_category($args)
! {
!   global $pagestore, $MinEntries, $DayLimit, $full, $page, $Entity;
!   global $FlgChr;
! 
!   $text = '';
!   if(strstr($args, '*'))                // Category containing all pages.
!   {
!     $list = $pagestore->allpages();
!   }
!   else if(strstr($args, '?'))           // New pages.
!   {
!     $list = $pagestore->newpages();
!   }
!   else if(strstr($args, '~'))           // Zero-length (deleted) pages.
!   {
!     $list = $pagestore->emptypages();
!   }
!   else                                  // Ordinary list of pages.
!   {
!     $parsed = parseText($args, array('parse_wikiname', 'parse_freelink'), '');
!     $pagenames = array();
!     preg_replace('/' . $FlgChr . '(\\d+)' . $FlgChr . '/e', 
'$pagenames[]=$Entity[\\1][1]', $parsed);
!     $list = $pagestore->givenpages($pagenames);
!   }
! 
!   if(count($list) == 0)
!     { return ''; }
! 
!   usort($list, 'catSort');
! 
!   $now = time();
!  
!   for($i = 0; $i < count($list); $i++)
!   {
!     $editTime = mktime(substr($list[$i][0], 8, 2),  substr($list[$i][0], 10, 
2),
!                        substr($list[$i][0], 12, 2), substr($list[$i][0], 4, 
2),
!                        substr($list[$i][0], 6, 2),  substr($list[$i][0], 0, 
4));
!     if($DayLimit && $i >= $MinEntries
!        && !$full && ($now - $editTime) > $DayLimit * 24 * 60 * 60)
!       { break; }
! 
!     $text = $text . html_category($list[$i][0], $list[$i][1],
!                                   $list[$i][2], $list[$i][3],
!                                   $list[$i][5]);
!     if($i < count($list) - 1)           // Don't put a newline on the last 
one.
!       { $text = $text . html_newline(); }
!   }
! 
!   if($i < count($list))
!     { $text = $text . html_fulllist($page, count($list)); }
! 
!   return $text;
! }
! 
! function catSort($p1, $p2)
!   { return strcmp($p2[0], $p1[0]); }
! 
! function sizeSort($p1, $p2)
!   { return $p2[4] - $p1[4]; }
! 
! function nameSort($p1, $p2)
!   { return strcmp($p1[1], $p2[1]); }
! 
! // Prepare a list of pages sorted by size.
! function view_macro_pagesize()
! {
!   global $pagestore;
! 
!   $first = 1;
!   $list = $pagestore->allpages();
! 
!   usort($list, 'sizeSort');
! 
!   $text = '';
! 
!   foreach($list as $page)
!   {
!     if(!$first)                         // Don't prepend newline to first one.
!       { $text = $text . "\n"; }
!     else
!       { $first = 0; }
! 
!     $text = $text .
!             $page[4] . ' ' . html_ref($page[1], $page[1]);
!   }
! 
!   return html_code($text);
! }
! 
! // Prepare a list of pages and those pages they link to.
! function view_macro_linktab()
! {
!   global $pagestore, $LkTbl;
! 
!   $lastpage = '';
!   $text = '';
! 
!   $q1 = $pagestore->dbh->query("SELECT page, link FROM $LkTbl ORDER BY page");
!   while(($result = $pagestore->dbh->result($q1)))
!   {
!     if($lastpage != $result[0])
!     {
!       if($lastpage != '')
!         { $text = $text . "\n"; }
! 
!       $text = $text . html_ref($result[0], $result[0]) . ' |';
!       $lastpage = $result[0];
!     }
! 
!     $text = $text . ' ' . html_ref($result[1], $result[1]);
!   }
! 
!   return html_code($text);
! }
! 
! // Prepare a list of pages with no incoming links.
! function view_macro_orphans()
! {
!   global $pagestore, $LkTbl;
! 
!   $text = '';
!   $first = 1;
! 
!   $pages = $pagestore->allpages();
!   usort($pages, 'nameSort');
! 
!   foreach($pages as $page)
!   {
!     $esc_page = addslashes($page[1]);
!     $q2 = $pagestore->dbh->query("SELECT page FROM $LkTbl " .
!                                  "WHERE link='$esc_page' AND 
page!='$esc_page'");
!     if(!($r2 = $pagestore->dbh->result($q2)) || empty($r2[0]))
!     {
!       if(!$first)                       // Don't prepend newline to first one.
!         { $text = $text . "\n"; }
!       else
!         { $first = 0; }
! 
!       $text = $text . html_ref($page[1], $page[1]);
!     }
!   }
! 
!   return html_code($text);
! }
! 
! // Prepare a list of pages linked to that do not exist.
! function view_macro_wanted()
! {
!   global $pagestore, $LkTbl, $PgTbl;
! 
!   $text = '';
!   $first = 1;
! 
!   $q1 = $pagestore->dbh->query("SELECT l.link, SUM(l.count) AS ct, p.title " .
!                                "FROM $LkTbl AS l LEFT JOIN $PgTbl AS p " .
!                                "ON l.link = p.title " .
!                                "GROUP BY l.link " .
!                                "HAVING p.title IS NULL " .
!                                "ORDER BY ct DESC, l.link");
! 
!   while(($result = $pagestore->dbh->result($q1)))
!   {
!     if(!$first)                         // Don't prepend newline to first one.
!       { $text = $text . "\n"; }
!     else
!       { $first = 0; }
! 
!     $text = $text . '(' .
!             html_url(findURL($result[0]), $result[1]) .
!             ') ' . html_ref($result[0], $result[0]);
!   }
! 
!   return html_code($text);
! }
! 
! // Prepare a list of pages sorted by how many links they contain.
! function view_macro_outlinks()
! {
!   global $pagestore, $LkTbl;
! 
!   $text = '';
!   $first = 1;
! 
!   $q1 = $pagestore->dbh->query("SELECT page, SUM(count) AS ct FROM $LkTbl " .
!                                "GROUP BY page ORDER BY ct DESC, page");
!   while(($result = $pagestore->dbh->result($q1)))
!   {
!     if(!$first)                         // Don't prepend newline to first one.
!       { $text = $text . "\n"; }
!     else
!       { $first = 0; }
! 
!     $text = $text .
!             '(' . $result[1] . ') ' . html_ref($result[0], $result[0]);
!   }
! 
!   return html_code($text);
! }
! 
! // Prepare a list of pages sorted by how many links to them exist.
! function view_macro_refs()
! {
!   global $pagestore, $LkTbl, $PgTbl;
! 
!   $text = '';
!   $first = 1;
! 
! // It's not quite as straightforward as one would imagine to turn the
! // following code into a JOIN, since we want to avoid multiplying the
! // number of links to a page by the number of versions of that page that
! // exist.  If anyone has some efficient suggestions, I'd be welcome to
! // entertain them.  -- ScottMoonen
! 
!   $q1 = $pagestore->dbh->query("SELECT link, SUM(count) AS ct FROM $LkTbl " .
!                                "GROUP BY link ORDER BY ct DESC, link");
!   while(($result = $pagestore->dbh->result($q1)))
!   {
!     $esc_page = addslashes($result[0]);
!     $q2 = $pagestore->dbh->query("SELECT MAX(version) FROM $PgTbl " .
!                                  "WHERE title='$esc_page'");
!     if(($r2 = $pagestore->dbh->result($q2)) && !empty($r2[0]))
!     {
!       if(!$first)                       // Don't prepend newline to first one.
!         { $text = $text . "\n"; }
!       else
!         { $first = 0; }
! 
!       $text = $text . '(' .
!               html_url(findURL($result[0]), $result[1]) . ') ' .
!               html_ref($result[0], $result[0]);
!     }
!   }
! 
!   return html_code($text);
! }
! 
! // This macro inserts an HTML anchor into the text.
! function view_macro_anchor($args)
! {
!   preg_match('/^([A-Za-z][-A-Za-z0-9_:.]*)$/', $args, $result);
! 
!   if($result[1] != '')
!     { return html_anchor($result[1]); }
!   else
!     { return ''; }
! }
! 
! // This macro transcludes another page into a wiki page.
! function view_macro_transclude($args)
! {
!   global $pagestore, $ParseEngine, $ParseObject;
!   static $visited_array = array();
!   static $visited_count = 0;
! 
!   if(!validate_page($args))
!     { return '[[Transclude ' . $args . ']]'; }
! 
!   $visited_array[$visited_count++] = $ParseObject;
!   for($i = 0; $i < $visited_count; $i++)
!   {
!     if($visited_array[$i] == $args)
!     {
!       $visited_count--;
!       return '[[Transclude ' . $args . ']]';
!     }
!   }
! 
!   $pg = $pagestore->page($args);
!   $pg->read();
!   if(!$pg->exists)
!   {
!     $visited_count--;
!     return '[[Transclude ' . $args . ']]';
!   }
! 
!   $result = parseText($pg->text, $ParseEngine, $args);
!   $visited_count--;
!   return $result;
! }
! 
! ?>
--- 1,286 ----
! <?php
! // $Id$
! 
! // Prepare a category list.
! function view_macro_category($args)
! {
!   global $pagestore, $MinEntries, $DayLimit, $full, $page, $Entity;
!   global $FlgChr;
! 
!   $text = '';
!   if(strstr($args, '*'))                // Category containing all pages.
!   {
!     $list = $pagestore->allpages();
!   }
!   else if(strstr($args, '?'))           // New pages.
!   {
!     $list = $pagestore->newpages();
!   }
!   else if(strstr($args, '~'))           // Zero-length (deleted) pages.
!   {
!     $list = $pagestore->emptypages();
!   }
!   else                                  // Ordinary list of pages.
!   {
!     $parsed = parseText($args, array('parse_wikiname', 'parse_freelink'), '');
!     $pagenames = array();
!     preg_replace('/' . $FlgChr . '(\\d+)' . $FlgChr . '/e', 
'$pagenames[]=$Entity[\\1][1]', $parsed);
!     $list = $pagestore->givenpages($pagenames);
!   }
! 
!   if(count($list) == 0)
!     { return ''; }
! 
!   usort($list, 'catSort');
! 
!   $now = time();
!  
!   for($i = 0; $i < count($list); $i++)
!   {
!     $editTime = mktime(substr($list[$i][0], 8, 2),  substr($list[$i][0], 10, 
2),
!                        substr($list[$i][0], 12, 2), substr($list[$i][0], 4, 
2),
!                        substr($list[$i][0], 6, 2),  substr($list[$i][0], 0, 
4));
!     if($DayLimit && $i >= $MinEntries
!        && !$full && ($now - $editTime) > $DayLimit * 24 * 60 * 60)
!       { break; }
! 
!     $text = $text . html_category($list[$i][0], $list[$i][1],
!                                   $list[$i][2], $list[$i][3],
!                                   $list[$i][5]);
!     if($i < count($list) - 1)           // Don't put a newline on the last 
one.
!       { $text = $text . html_newline(); }
!   }
! 
!   if($i < count($list))
!     { $text = $text . html_fulllist($page, count($list)); }
! 
!   return $text;
! }
! 
! function catSort($p1, $p2)
!   { return strcmp($p2[0], $p1[0]); }
! 
! function sizeSort($p1, $p2)
!   { return $p2[4] - $p1[4]; }
! 
! function nameSort($p1, $p2)
!   { return strcmp($p1[1], $p2[1]); }
! 
! // Prepare a list of pages sorted by size.
! function view_macro_pagesize()
! {
!   global $pagestore;
! 
!   $first = 1;
!   $list = $pagestore->allpages();
! 
!   usort($list, 'sizeSort');
! 
!   $text = '';
! 
!   foreach($list as $page)
!   {
!     if(!$first)                         // Don't prepend newline to first one.
!       { $text = $text . "\n"; }
!     else
!       { $first = 0; }
! 
!     $text = $text .
!             $page[4] . ' ' . html_ref($page[1], $page[1]);
!   }
! 
!   return html_code($text);
! }
! 
! // Prepare a list of pages and those pages they link to.
! function view_macro_linktab()
! {
!   global $pagestore, $LkTbl;
! 
!   $lastpage = '';
!   $text = '';
! 
!   $q1 = $pagestore->dbh->query("SELECT page, link FROM $LkTbl ORDER BY page");
!   while(($result = $pagestore->dbh->result($q1)))
!   {
!     if($lastpage != $result[0])
!     {
!       if($lastpage != '')
!         { $text = $text . "\n"; }
! 
!       $text = $text . html_ref($result[0], $result[0]) . ' |';
!       $lastpage = $result[0];
!     }
! 
!     $text = $text . ' ' . html_ref($result[1], $result[1]);
!   }
! 
!   return html_code($text);
! }
! 
! // Prepare a list of pages with no incoming links.
! function view_macro_orphans()
! {
!   global $pagestore, $LkTbl;
! 
!   $text = '';
!   $first = 1;
! 
!   $pages = $pagestore->allpages();
!   usort($pages, 'nameSort');
! 
!   foreach($pages as $page)
!   {
!     $esc_page = addslashes($page[1]);
!     $q2 = $pagestore->dbh->query("SELECT page FROM $LkTbl " .
!                                  "WHERE link='$esc_page' AND 
page!='$esc_page'");
!     if(!($r2 = $pagestore->dbh->result($q2)) || empty($r2[0]))
!     {
!       if(!$first)                       // Don't prepend newline to first one.
!         { $text = $text . "\n"; }
!       else
!         { $first = 0; }
! 
!       $text = $text . html_ref($page[1], $page[1]);
!     }
!   }
! 
!   return html_code($text);
! }
! 
! // Prepare a list of pages linked to that do not exist.
! function view_macro_wanted()
! {
!   global $pagestore, $LkTbl, $PgTbl;
! 
!   $text = '';
!   $first = 1;
! 
!   $q1 = $pagestore->dbh->query("SELECT l.link, SUM(l.count) AS ct, p.title " .
!                                "FROM $LkTbl AS l LEFT JOIN $PgTbl AS p " .
!                                "ON l.link = p.title " .
!                                "GROUP BY l.link " .
!                                "HAVING p.title IS NULL " .
!                                "ORDER BY ct DESC, l.link");
! 
!   while(($result = $pagestore->dbh->result($q1)))
!   {
!     if(!$first)                         // Don't prepend newline to first one.
!       { $text = $text . "\n"; }
!     else
!       { $first = 0; }
! 
!     $text = $text . '(' .
!             html_url(findURL($result[0]), $result[1]) .
!             ') ' . html_ref($result[0], $result[0]);
!   }
! 
!   return html_code($text);
! }
! 
! // Prepare a list of pages sorted by how many links they contain.
! function view_macro_outlinks()
! {
!   global $pagestore, $LkTbl;
! 
!   $text = '';
!   $first = 1;
! 
!   $q1 = $pagestore->dbh->query("SELECT page, SUM(count) AS ct FROM $LkTbl " .
!                                "GROUP BY page ORDER BY ct DESC, page");
!   while(($result = $pagestore->dbh->result($q1)))
!   {
!     if(!$first)                         // Don't prepend newline to first one.
!       { $text = $text . "\n"; }
!     else
!       { $first = 0; }
! 
!     $text = $text .
!             '(' . $result[1] . ') ' . html_ref($result[0], $result[0]);
!   }
! 
!   return html_code($text);
! }
! 
! // Prepare a list of pages sorted by how many links to them exist.
! function view_macro_refs()
! {
!   global $pagestore, $LkTbl, $PgTbl;
! 
!   $text = '';
!   $first = 1;
! 
! // It's not quite as straightforward as one would imagine to turn the
! // following code into a JOIN, since we want to avoid multiplying the
! // number of links to a page by the number of versions of that page that
! // exist.  If anyone has some efficient suggestions, I'd be welcome to
! // entertain them.  -- ScottMoonen
! 
!   $q1 = $pagestore->dbh->query("SELECT link, SUM(count) AS ct FROM $LkTbl " .
!                                "GROUP BY link ORDER BY ct DESC, link");
!   while(($result = $pagestore->dbh->result($q1)))
!   {
!     $esc_page = addslashes($result[0]);
!     $q2 = $pagestore->dbh->query("SELECT MAX(version) FROM $PgTbl " .
!                                  "WHERE title='$esc_page'");
!     if(($r2 = $pagestore->dbh->result($q2)) && !empty($r2[0]))
!     {
!       if(!$first)                       // Don't prepend newline to first one.
!         { $text = $text . "\n"; }
!       else
!         { $first = 0; }
! 
!       $text = $text . '(' .
!               html_url(findURL($result[0]), $result[1]) . ') ' .
!               html_ref($result[0], $result[0]);
!     }
!   }
! 
!   return html_code($text);
! }
! 
! // This macro inserts an HTML anchor into the text.
! function view_macro_anchor($args)
! {
!   preg_match('/^([A-Za-z][-A-Za-z0-9_:.]*)$/', $args, $result);
! 
!   if($result[1] != '')
!     { return html_anchor($result[1]); }
!   else
!     { return ''; }
! }
! 
! // This macro transcludes another page into a wiki page.
! function view_macro_transclude($args)
! {
!   global $pagestore, $ParseEngine, $ParseObject;
!   static $visited_array = array();
!   static $visited_count = 0;
! 
!   if(!validate_page($args))
!     { return '[[Transclude ' . $args . ']]'; }
! 
!   $visited_array[$visited_count++] = $ParseObject;
!   for($i = 0; $i < $visited_count; $i++)
!   {
!     if($visited_array[$i] == $args)
!     {
!       $visited_count--;
!       return '[[Transclude ' . $args . ']]';
!     }
!   }
! 
!   $pg = $pagestore->page($args);
!   $pg->read();
!   if(!$pg->exists)
!   {
!     $visited_count--;
!     return '[[Transclude ' . $args . ']]';
!   }
! 
!   $result = parseText($pg->text, $ParseEngine, $args);
!   $visited_count--;
!   return $result;
! }
! 
! ?>

Index: main.php
===================================================================
RCS file: /cvsroot/phpgroupware/wiki/parse/main.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** main.php    3 Mar 2003 13:00:39 -0000       1.1.1.1
--- main.php    3 Mar 2003 13:37:05 -0000       1.2
***************
*** 1,37 ****
! <?php
! // $Id$
! 
! // Master parser for 'Tavi.
! function parseText($text, $parsers, $object_name)
! {
!   global $Entity, $ParseObject;
! 
!   $old_parse_object = $ParseObject;
!   $ParseObject = $object_name;          // So parsers know what they're 
parsing.
! 
!   $count  = count($parsers);
!   $result = '';
! 
!   // Run each parse element in turn on each line of text.
! 
!   foreach(explode("\n", $text) as $line)
!   {
!     $line = $line . "\n";
!     for($i = 0; $i < $count; $i++)
!       { $line = $parsers[$i]($line); }
! 
!     $result = $result . $line;
!   }
! 
!   // Some stateful parsers need to perform final processing.
! 
!   $line = '';
!   for($i = 0; $i < $count; $i++)
!     { $line = $parsers[$i]($line); }
! 
!   $ParseObject = $old_parse_object;
! 
!   return $result . $line;
! }
! 
! ?>
--- 1,37 ----
! <?php
! // $Id$
! 
! // Master parser for 'Tavi.
! function parseText($text, $parsers, $object_name)
! {
!   global $Entity, $ParseObject;
! 
!   $old_parse_object = $ParseObject;
!   $ParseObject = $object_name;          // So parsers know what they're 
parsing.
! 
!   $count  = count($parsers);
!   $result = '';
! 
!   // Run each parse element in turn on each line of text.
! 
!   foreach(explode("\n", $text) as $line)
!   {
!     $line = $line . "\n";
!     for($i = 0; $i < $count; $i++)
!       { $line = $parsers[$i]($line); }
! 
!     $result = $result . $line;
!   }
! 
!   // Some stateful parsers need to perform final processing.
! 
!   $line = '';
!   for($i = 0; $i < $count; $i++)
!     { $line = $parsers[$i]($line); }
! 
!   $ParseObject = $old_parse_object;
! 
!   return $result . $line;
! }
! 
! ?>

Index: save.php
===================================================================
RCS file: /cvsroot/phpgroupware/wiki/parse/save.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** save.php    3 Mar 2003 13:00:39 -0000       1.1.1.1
--- save.php    3 Mar 2003 13:37:05 -0000       1.2
***************
*** 1,102 ****
! <?php
! // $Id$
! 
! // Macros for on-save features.
! 
! require('parse/html.php');
! require('parse/macros.php');
! 
! // Define the link table.
! function parse_define_links($text)
! {
!   global $pagestore, $page, $ParseEngine, $Entity, $ParseObject;
!   static $called = 0;
! 
!   $macros_index = -1;
!   $transclude_index = -1;
!   $elements_index = -1;
!   for($i = 0; $i < count($ParseEngine); $i++)
!   {
!     if($ParseEngine[$i] == 'parse_macros')
!       { $macros_index = $i; }
!     if($ParseEngine[$i] == 'parse_transclude')
!       { $transclude_index = $i; }
!     if($ParseEngine[$i] == 'parse_elements')
!       { $elements_index = $i; }
!   }
!   if($macros_index != -1)
!     { $ParseEngine[$macros_index] = 'parse_noop'; }
!   if($transclude_index != -1)
!     { $ParseEngine[$transclude_index] = 'parse_noop'; }
!   if($elements_index != -1)
!     { $ParseEngine[$elements_index] = 'parse_noop'; }
! 
!   if(!$called)
!   {
!     $pagestore->clear_link($page);
!     $called = 1;
!   }
! 
!   $j = count($Entity);
!   parseText($text, $ParseEngine, $ParseObject);
! 
!   for(; $j < count($Entity); $j++)
!   {
!     if($Entity[$j][0] == 'ref')
!       { $pagestore->new_link($page, $Entity[$j][1]); }
!   }
! 
!   if($macros_index != -1)
!     { $ParseEngine[$macros_index] = 'parse_macros'; }
!   if($transclude_index != -1)
!     { $ParseEngine[$transclude_index] = 'parse_transclude'; }
!   if($elements_index != -1)
!     { $ParseEngine[$elements_index] = 'parse_elements'; }
! 
!   return $text;
! }
! 
! // Define interwiki links.
! function parse_define_interwiki($text)
! {
!   global $pagestore, $page;
!   static $called = 0;
! 
!   if(!$called)
!   {
!     $pagestore->clear_interwiki($page);
!     $called = 1;
!   }
! 
!   if(preg_match('/^\\*InterWiki:\\s+([A-Z][A-Za-z]+)\s+(http:[^\\s]+)/',
!                 $text, $result))
!   {
!     $pagestore->new_interwiki($page, $result[1], $result[2]);
!   }
! 
!   return $text;
! }
! 
! // Define sisterwiki links.
! function parse_define_sisterwiki($text)
! {
!   global $pagestore, $page;
!   static $called = 0;
! 
!   if(!$called)
!   {
!     $pagestore->clear_sisterwiki($page);
!     $called = 1;
!   }
! 
!   if(preg_match('/^\\*SisterWiki:\\s+([A-Z][A-Za-z]+)\s+(http:[^\\s]+)/',
!                 $text, $result))
!   {
!     $pagestore->new_sisterwiki($page, $result[1], $result[2]);
!   }
! 
! 
!   return $text;
! }
! 
! ?>
--- 1,102 ----
! <?php
! // $Id$
! 
! // Macros for on-save features.
! 
! require('parse/html.php');
! require('parse/macros.php');
! 
! // Define the link table.
! function parse_define_links($text)
! {
!   global $pagestore, $page, $ParseEngine, $Entity, $ParseObject;
!   static $called = 0;
! 
!   $macros_index = -1;
!   $transclude_index = -1;
!   $elements_index = -1;
!   for($i = 0; $i < count($ParseEngine); $i++)
!   {
!     if($ParseEngine[$i] == 'parse_macros')
!       { $macros_index = $i; }
!     if($ParseEngine[$i] == 'parse_transclude')
!       { $transclude_index = $i; }
!     if($ParseEngine[$i] == 'parse_elements')
!       { $elements_index = $i; }
!   }
!   if($macros_index != -1)
!     { $ParseEngine[$macros_index] = 'parse_noop'; }
!   if($transclude_index != -1)
!     { $ParseEngine[$transclude_index] = 'parse_noop'; }
!   if($elements_index != -1)
!     { $ParseEngine[$elements_index] = 'parse_noop'; }
! 
!   if(!$called)
!   {
!     $pagestore->clear_link($page);
!     $called = 1;
!   }
! 
!   $j = count($Entity);
!   parseText($text, $ParseEngine, $ParseObject);
! 
!   for(; $j < count($Entity); $j++)
!   {
!     if($Entity[$j][0] == 'ref')
!       { $pagestore->new_link($page, $Entity[$j][1]); }
!   }
! 
!   if($macros_index != -1)
!     { $ParseEngine[$macros_index] = 'parse_macros'; }
!   if($transclude_index != -1)
!     { $ParseEngine[$transclude_index] = 'parse_transclude'; }
!   if($elements_index != -1)
!     { $ParseEngine[$elements_index] = 'parse_elements'; }
! 
!   return $text;
! }
! 
! // Define interwiki links.
! function parse_define_interwiki($text)
! {
!   global $pagestore, $page;
!   static $called = 0;
! 
!   if(!$called)
!   {
!     $pagestore->clear_interwiki($page);
!     $called = 1;
!   }
! 
!   if(preg_match('/^\\*InterWiki:\\s+([A-Z][A-Za-z]+)\s+(http:[^\\s]+)/',
!                 $text, $result))
!   {
!     $pagestore->new_interwiki($page, $result[1], $result[2]);
!   }
! 
!   return $text;
! }
! 
! // Define sisterwiki links.
! function parse_define_sisterwiki($text)
! {
!   global $pagestore, $page;
!   static $called = 0;
! 
!   if(!$called)
!   {
!     $pagestore->clear_sisterwiki($page);
!     $called = 1;
!   }
! 
!   if(preg_match('/^\\*SisterWiki:\\s+([A-Z][A-Za-z]+)\s+(http:[^\\s]+)/',
!                 $text, $result))
!   {
!     $pagestore->new_sisterwiki($page, $result[1], $result[2]);
!   }
! 
! 
!   return $text;
! }
! 
! ?>

Index: transforms.php
===================================================================
RCS file: /cvsroot/phpgroupware/wiki/parse/transforms.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** transforms.php      3 Mar 2003 13:00:42 -0000       1.1.1.1
--- transforms.php      3 Mar 2003 13:37:05 -0000       1.2
***************
*** 1,624 ****
! <?php
! // $Id$
! 
! // The main parser components.  Each of these takes a line of text and scans 
it
! //   for particular wiki markup.  It converts markup elements to
! //   $FlgChr . x . $FlgChr, where x is an index into the global array $Entity,
! //   which contains descriptions of each markup entity.  Later, these will be
! //   converted back into HTML  (or, in the future, perhaps some other
! //   representation such as XML).
! 
[...1219 lines suppressed...]
!                          $text, -1);
!     $text = preg_replace('/((\|\|)+)/e',
!                          
"new_entity(array('raw',html_table_cell_end().html_table_cell_start(strlen('\\1')/2)))",
!                          $text, -1);
!   }
!   else if($in_table)                    // Have exited table.
!   {
!     $in_table = 0;
!     $pre = html_table_end();
!   }
! 
!   if($pre != '')
!     { $text = new_entity(array('raw', $pre)) . $text; }
!   if($post != '')
!     { $text = $text . new_entity(array('raw', $post)); }
! 
!   return $text;
! }
! 
! ?>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]