From: <var...@us...> - 2008-08-29 13:52:00
|
Revision: 6222 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6222&view=rev Author: vargenau Date: 2008-08-29 13:52:09 +0000 (Fri, 29 Aug 2008) Log Message: ----------- extractSection understands Wikicreole Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2008-08-29 13:30:14 UTC (rev 6221) +++ trunk/lib/stdlib.php 2008-08-29 13:52:09 UTC (rev 6222) @@ -2074,7 +2074,7 @@ function extractSection ($section, $content, $page, $quiet = false, $sectionhead = false) { $qsection = preg_replace('/\s+/', '\s+', preg_quote($section, '/')); - if (preg_match("/ ^(!{1,})\\s*$qsection" // section header + if (preg_match("/ ^(!{1,}|={2,})\\s*$qsection" // section header . " \\s*$\\n?" // possible blank lines . " ( (?: ^.*\\n? )*? )" // some lines . " (?= ^\\1 | \\Z)/xm", // sec header (same or higher level) (or EOF) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-01-01 19:47:36
|
Revision: 6358 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6358&view=rev Author: vargenau Date: 2009-01-01 19:47:30 +0000 (Thu, 01 Jan 2009) Log Message: ----------- New function: parse_attributes (from RichTable and MediawikiTable plugins) Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-01-01 19:37:23 UTC (rev 6357) +++ trunk/lib/stdlib.php 2009-01-01 19:47:30 UTC (rev 6358) @@ -1,6 +1,7 @@ <?php //rcs_id('$Id$'); /* Copyright 1999-2008 $ThePhpWikiProgrammingTeam + Copyright 2008 Marc-Etienne Vargenau, Alcatel-Lucent This file is part of PhpWiki. @@ -2301,6 +2302,31 @@ return (!empty($s) and (strlen($s) > 3) and (substr($s,1,1) == ':')); } +/** + * Take a string and return an array of pairs (attribute name, attribute value) + * + * We allow attributes with or without double quotes (") + * Attribute-value pairs may be separated by space or comma + * border=1, cellpadding="5" + * border=1 cellpadding="5" + * style="font-family: sans-serif; border-top:1px solid #dddddd;" + * What will not work is style with comma inside, e. g. + / style="font-family: Verdana, Arial, Helvetica, sans-serif" + */ +function parse_attributes($line) { + $line = strtolower($line); + $line = str_replace(",", "", $line); + $attr_chunks = preg_split("/\s* \s*/", $line); + $options = array(); + foreach ($attr_chunks as $attr_pair) { + if (empty($attr_pair)) continue; + $key_val = preg_split("/\s*=\s*/", $attr_pair); + if (!empty($key_val[1])) + $options[trim($key_val[0])] = trim(str_replace("\"", "", $key_val[1])); + } + return $options; +} + // (c-file-style: "gnu") // Local Variables: // mode: php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-01-09 18:03:51
|
Revision: 6390 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6390&view=rev Author: vargenau Date: 2009-01-09 18:03:39 +0000 (Fri, 09 Jan 2009) Log Message: ----------- More spreadsheet functions Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-01-09 13:42:12 UTC (rev 6389) +++ trunk/lib/stdlib.php 2009-01-09 18:03:39 UTC (rev 6390) @@ -2361,21 +2361,132 @@ function compute_tablecell ($table, $i, $j, $imax, $jmax) { // What is implemented: - // @@SUM(R)@@ : sum of cells in current row - // @@SUM(C)@@ : sum of cells in current column + // @@=SUM(R)@@ : sum of cells in current row + // @@=SUM(C)@@ : sum of cells in current column + // @@=AVERAGE(R)@@ : average of cells in current row + // @@=AVERAGE(C)@@ : average of cells in current column + // @@=MAX(R)@@ : maximum value of cells in current row + // @@=MAX(C)@@ : maximum value of cells in current column + // @@=MIN(R)@@ : minimum value of cells in current row + // @@=MIN(C)@@ : minimum value of cells in current column + // @@=COUNT(R)@@ : number of cells in current row + // (numeric or not, excluding headers and current cell) + // @@=COUNT(C)@@ : number of cells in current column + // (numeric or not, excluding headers and current cell) $result=0; - if (trim($table[$i][$j]) == "@@SUM(C)@@") { + $counter=0; + $found=false; + if (trim($table[$i][$j]) == "@@=SUM(C)@@") { for ($index=0; $index<$imax; $index++) { - $result += $table[$index][$j]; + if (is_numeric($table[$index][$j])) { + $result += $table[$index][$j]; + } } - } - if (trim($table[$i][$j]) == "@@SUM(R)@@") { + return $result; + } else if (trim($table[$i][$j]) == "@@=SUM(R)@@") { for ($index=0; $index<$jmax; $index++) { - $result += $table[$i][$index]; + if (is_numeric($table[$i][$index])) { + $result += $table[$i][$index]; + } } + return $result; + } else if (trim($table[$i][$j]) == "@@=AVERAGE(C)@@") { + for ($index=0; $index<$imax; $index++) { + if (is_numeric($table[$index][$j])) { + $result += $table[$index][$j]; + $counter++; + } + } + return $result/$counter; + } else if (trim($table[$i][$j]) == "@@=AVERAGE(R)@@") { + for ($index=0; $index<$jmax; $index++) { + if (is_numeric($table[$i][$index])) { + $result += $table[$i][$index]; + $counter++; + } + } + return $result/$counter; + } else if (trim($table[$i][$j]) == "@@=MAX(C)@@") { + for ($index=0; $index<$imax; $index++) { + if (is_numeric($table[$index][$j])) { + if (!$found) { + $found=true; + $result=$table[$index][$j]; + } else { + $result = max($result, $table[$index][$j]); + } + } + } + if ($found) { + return $result; + } else { + return ""; + } + } else if (trim($table[$i][$j]) == "@@=MAX(R)@@") { + for ($index=0; $index<$jmax; $index++) { + if (is_numeric($table[$i][$index])) { + if (!$found) { + $found=true; + $result=$table[$i][$index]; + } else { + $result = max($result, $table[$i][$index]); + } + } + } + if ($found) { + return $result; + } else { + return ""; + } + } else if (trim($table[$i][$j]) == "@@=MIN(C)@@") { + for ($index=0; $index<$imax; $index++) { + if (is_numeric($table[$index][$j])) { + if (!$found) { + $found=true; + $result=$table[$index][$j]; + } else { + $result = min($result, $table[$index][$j]); + } + } + } + if ($found) { + return $result; + } else { + return ""; + } + } else if (trim($table[$i][$j]) == "@@=MIN(R)@@") { + for ($index=0; $index<$jmax; $index++) { + if (is_numeric($table[$i][$index])) { + if (!$found) { + $found=true; + $result=$table[$i][$index]; + } else { + $result = min($result, $table[$i][$index]); + } + } + } + if ($found) { + return $result; + } else { + return ""; + } + } else if (trim($table[$i][$j]) == "@@=COUNT(C)@@") { + for ($index=0; $index<$imax; $index++) { + if (!string_starts_with($table[$index][$j], "=")) { // exclude header + $counter++; + } + } + return $counter-1; // exclude self + } else if (trim($table[$i][$j]) == "@@=COUNT(R)@@") { + for ($index=0; $index<$jmax; $index++) { + if (!string_starts_with($table[$i][$index], "=")) { // exclude header + $counter++; + } + } + return $counter-1; // exclude self } - return $result; + return ""; } // (c-file-style: "gnu") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-01-10 10:30:44
|
Revision: 6391 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6391&view=rev Author: vargenau Date: 2009-01-10 10:30:39 +0000 (Sat, 10 Jan 2009) Log Message: ----------- More flexibility: the formula does not need to be alone in the cell Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-01-09 18:03:39 UTC (rev 6390) +++ trunk/lib/stdlib.php 2009-01-10 10:30:39 UTC (rev 6391) @@ -2377,37 +2377,44 @@ $result=0; $counter=0; $found=false; - if (trim($table[$i][$j]) == "@@=SUM(C)@@") { + + if (strpos($table[$i][$j], "@@=SUM(C)@@") !== false) { for ($index=0; $index<$imax; $index++) { if (is_numeric($table[$index][$j])) { $result += $table[$index][$j]; } } - return $result; - } else if (trim($table[$i][$j]) == "@@=SUM(R)@@") { + return str_replace("@@=SUM(C)@@", $result, $table[$i][$j]); + + } else if (strpos($table[$i][$j], "@@=SUM(R)@@") !== false) { for ($index=0; $index<$jmax; $index++) { if (is_numeric($table[$i][$index])) { $result += $table[$i][$index]; } } - return $result; - } else if (trim($table[$i][$j]) == "@@=AVERAGE(C)@@") { + return str_replace("@@=SUM(R)@@", $result, $table[$i][$j]); + + } else if (strpos($table[$i][$j], "@@=AVERAGE(C)@@") !== false) { for ($index=0; $index<$imax; $index++) { if (is_numeric($table[$index][$j])) { $result += $table[$index][$j]; $counter++; } } - return $result/$counter; - } else if (trim($table[$i][$j]) == "@@=AVERAGE(R)@@") { + $result=$result/$counter; + return str_replace("@@=AVERAGE(C)@@", $result, $table[$i][$j]); + + } else if (strpos($table[$i][$j], "@@=AVERAGE(R)@@") !== false) { for ($index=0; $index<$jmax; $index++) { if (is_numeric($table[$i][$index])) { $result += $table[$i][$index]; $counter++; } } - return $result/$counter; - } else if (trim($table[$i][$j]) == "@@=MAX(C)@@") { + $result=$result/$counter; + return str_replace("@@=AVERAGE(R)@@", $result, $table[$i][$j]); + + } else if (strpos($table[$i][$j], "@@=MAX(C)@@") !== false) { for ($index=0; $index<$imax; $index++) { if (is_numeric($table[$index][$j])) { if (!$found) { @@ -2418,12 +2425,12 @@ } } } - if ($found) { - return $result; - } else { - return ""; + if (!$found) { + $result=""; } - } else if (trim($table[$i][$j]) == "@@=MAX(R)@@") { + return str_replace("@@=MAX(C)@@", $result, $table[$i][$j]); + + } else if (strpos($table[$i][$j], "@@=MAX(R)@@") !== false) { for ($index=0; $index<$jmax; $index++) { if (is_numeric($table[$i][$index])) { if (!$found) { @@ -2434,12 +2441,12 @@ } } } - if ($found) { - return $result; - } else { - return ""; + if (!$found) { + $result=""; } - } else if (trim($table[$i][$j]) == "@@=MIN(C)@@") { + return str_replace("@@=MAX(R)@@", $result, $table[$i][$j]); + + } else if (strpos($table[$i][$j], "@@=MIN(C)@@") !== false) { for ($index=0; $index<$imax; $index++) { if (is_numeric($table[$index][$j])) { if (!$found) { @@ -2450,12 +2457,12 @@ } } } - if ($found) { - return $result; - } else { - return ""; + if (!$found) { + $result=""; } - } else if (trim($table[$i][$j]) == "@@=MIN(R)@@") { + return str_replace("@@=MIN(C)@@", $result, $table[$i][$j]); + + } else if (strpos($table[$i][$j], "@@=MIN(R)@@") !== false) { for ($index=0; $index<$jmax; $index++) { if (is_numeric($table[$i][$index])) { if (!$found) { @@ -2466,27 +2473,31 @@ } } } - if ($found) { - return $result; - } else { - return ""; + if (!$found) { + $result=""; } - } else if (trim($table[$i][$j]) == "@@=COUNT(C)@@") { + return str_replace("@@=MIN(R)@@", $result, $table[$i][$j]); + + } else if (strpos($table[$i][$j], "@@=COUNT(C)@@") !== false) { for ($index=0; $index<$imax; $index++) { - if (!string_starts_with($table[$index][$j], "=")) { // exclude header + if (!string_starts_with(trim($table[$index][$j]), "=")) { // exclude header $counter++; } } - return $counter-1; // exclude self - } else if (trim($table[$i][$j]) == "@@=COUNT(R)@@") { + $result = $counter-1; // exclude self + return str_replace("@@=COUNT(C)@@", $result, $table[$i][$j]); + + } else if (strpos($table[$i][$j], "@@=COUNT(R)@@") !== false) { for ($index=0; $index<$jmax; $index++) { - if (!string_starts_with($table[$i][$index], "=")) { // exclude header + if (!string_starts_with(trim($table[$i][$index]), "=")) { // exclude header $counter++; } } - return $counter-1; // exclude self + $result = $counter-1; // exclude self + return str_replace("@@=COUNT(R)@@", $result, $table[$i][$j]); } - return ""; + + return $table[$i][$j]; } // (c-file-style: "gnu") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ru...@us...> - 2009-01-28 09:39:43
|
Revision: 6459 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6459&view=rev Author: rurban Date: 2009-01-28 09:39:38 +0000 (Wed, 28 Jan 2009) Log Message: ----------- Fix splitting image url's from image attributes e.g. [Upload:image.jpg size=80% align=right] Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-01-28 09:07:53 UTC (rev 6458) +++ trunk/lib/stdlib.php 2009-01-28 09:39:38 UTC (rev 6459) @@ -416,6 +416,7 @@ //if (!preg_match("/\.(".$force_img.")/i", $url)) if (empty($alt)) $alt = ""; $arr = split(' ',$url); + if (!empty($arr)) $url = $arr[0]; if ($alt == "") { $link = HTML::img(array('src' => $url, 'alt' => $alt)); } else { @@ -2319,6 +2320,7 @@ / style="font-family: Verdana, Arial, Helvetica, sans-serif" */ function parse_attributes($line) { + if (empty($line)) return array(); $line = strtolower($line); $line = str_replace(",", "", $line); $attr_chunks = preg_split("/\s* \s*/", $line); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ru...@us...> - 2009-01-28 09:44:47
|
Revision: 6460 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6460&view=rev Author: rurban Date: 2009-01-28 09:44:44 +0000 (Wed, 28 Jan 2009) Log Message: ----------- Document the new functions in the header Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-01-28 09:39:38 UTC (rev 6459) +++ trunk/lib/stdlib.php 2009-01-28 09:44:44 UTC (rev 6460) @@ -86,6 +86,19 @@ isExternalReferrer() charset_convert($from, $to, $data) + string_starts_with($string, $prefix) + string_ends_with($string, $suffix) + array_remove($arr,$value) + longer_timeout($secs=30) + printSimpleTrace($bt) + getMemoryUsage() + binary_search($needle, $haystack) + is_localhost($url) + javascript_quote_string($s) + isSerialized($s) + parse_attributes($line) + is_image ($filename) + compute_tablecell ($table, $i, $j, $imax, $jmax) function: LinkInterWikiLink($link, $linktext) moved to: lib/interwiki.php @@ -414,7 +427,7 @@ } else { // support new syntax: [prefix/image.jpg size=50% border=n] //if (!preg_match("/\.(".$force_img.")/i", $url)) - if (empty($alt)) $alt = ""; + if (empty($alt)) $alt = basename($url); $arr = split(' ',$url); if (!empty($arr)) $url = $arr[0]; if ($alt == "") { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-02-17 11:26:24
|
Revision: 6508 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6508&view=rev Author: vargenau Date: 2009-02-17 11:26:21 +0000 (Tue, 17 Feb 2009) Log Message: ----------- Hand-coded parse_attributes function Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-02-16 15:58:24 UTC (rev 6507) +++ trunk/lib/stdlib.php 2009-02-17 11:26:21 UTC (rev 6508) @@ -2326,25 +2326,69 @@ * * We allow attributes with or without double quotes (") * Attribute-value pairs may be separated by space or comma + * Space is normal HTML attributes, comma is for RichTable compatibility * border=1, cellpadding="5" * border=1 cellpadding="5" * style="font-family: sans-serif; border-top:1px solid #dddddd;" - * What will not work is style with comma inside, e. g. - / style="font-family: Verdana, Arial, Helvetica, sans-serif" + * style="font-family: Verdana, Arial, Helvetica, sans-serif" */ function parse_attributes($line) { - if (empty($line)) return array(); - $line = strtolower($line); - $line = str_replace(",", "", $line); - $attr_chunks = preg_split("/\s* \s*/", $line); + $options = array(); - foreach ($attr_chunks as $attr_pair) { - if (empty($attr_pair)) continue; - $key_val = preg_split("/\s*=\s*/", $attr_pair); - if (!empty($key_val[1])) - $options[trim($key_val[0])] = trim(str_replace("\"", "", $key_val[1])); + + if (empty($line)) return $options; + $line = trim($line); + if (empty($line)) return $options; + $line = trim($line, ","); + if (empty($line)) return $options; + + // First we have an attribute name. + $attribute = ""; + $value = ""; + + $i = 0; + while (($i < strlen($line)) && ($line[$i] != '=')) { + $i++; } - return $options; + $attribute = substr($line, 0, $i); + $attribute = strtolower($attribute); + + $line = substr($line, $i+1); + $line = trim ($line); + $line = trim ($line, "="); + $line = trim ($line); + + // Then we have the attribute value. + + $i = 0; + // Attribute value might be between double quotes + // In that case we have to find the closing double quote + if ($line[0] == '"') { + $i++; // skip first '"' + while (($i < strlen($line)) && ($line[$i] != '"')) { + $i++; + } + $value = substr($line, 0, $i); + $value = trim ($value, '"'); + $value = trim ($value); + + // If there are no double quotes, we have to find the next space or comma + } else { + while (($i < strlen($line)) && (($line[$i] != ' ') && ($line[$i] != ','))) { + $i++; + } + $value = substr($line, 0, $i); + $value = trim ($value); + $value = trim ($value, ","); + $value = trim ($value); + } + + $options[$attribute] = $value; + + $line = substr($line, $i+1); + $line = trim ($line); + + return $options + parse_attributes($line); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-02-18 17:13:16
|
Revision: 6510 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6510&view=rev Author: vargenau Date: 2009-02-18 17:13:09 +0000 (Wed, 18 Feb 2009) Log Message: ----------- Better handle comma in parse_attributes Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-02-17 14:47:05 UTC (rev 6509) +++ trunk/lib/stdlib.php 2009-02-18 17:13:09 UTC (rev 6510) @@ -2387,6 +2387,8 @@ $line = substr($line, $i+1); $line = trim ($line); + $line = trim ($line, ","); + $line = trim ($line); return $options + parse_attributes($line); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-02-26 13:34:54
|
Revision: 6577 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6577&view=rev Author: vargenau Date: 2009-02-26 13:34:44 +0000 (Thu, 26 Feb 2009) Log Message: ----------- Allow uppercase extension for images Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-02-26 13:15:45 UTC (rev 6576) +++ trunk/lib/stdlib.php 2009-02-26 13:34:44 UTC (rev 6577) @@ -1,7 +1,7 @@ <?php //rcs_id('$Id$'); /* Copyright 1999-2008 $ThePhpWikiProgrammingTeam - Copyright 2008 Marc-Etienne Vargenau, Alcatel-Lucent + Copyright 2008-2009 Marc-Etienne Vargenau, Alcatel-Lucent This file is part of PhpWiki. @@ -2406,7 +2406,7 @@ } foreach (explode("|", $inline_images) as $suffix) { - if (string_ends_with($filename, "." . $suffix)) { + if (string_ends_with(strtolower($filename), "." . $suffix)) { return true; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-03-09 19:33:22
|
Revision: 6673 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6673&view=rev Author: vargenau Date: 2009-03-09 19:33:04 +0000 (Mon, 09 Mar 2009) Log Message: ----------- Test EXTERNAL_LINK_TARGET is not empty Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-03-09 18:49:40 UTC (rev 6672) +++ trunk/lib/stdlib.php 2009-03-09 19:33:04 UTC (rev 6673) @@ -398,7 +398,7 @@ $linktext = preg_replace("/mailto:/A", "", $url); $args = array('href' => $url); if ( defined('EXTERNAL_LINK_TARGET') ) // can also be set in the css - $args['target'] = is_string(EXTERNAL_LINK_TARGET) ? EXTERNAL_LINK_TARGET : "_blank"; + $args['target'] = (is_string(EXTERNAL_LINK_TARGET) and (EXTERNAL_LINK_TARGET != "")) ? EXTERNAL_LINK_TARGET : "_blank"; $link = HTML::a($args, PossiblyGlueIconToText($url, $linktext)); } $link->setAttr('class', $linktext ? 'namedurl' : 'rawurl'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-06-02 15:57:12
|
Revision: 6843 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6843&view=rev Author: vargenau Date: 2009-06-02 15:57:11 +0000 (Tue, 02 Jun 2009) Log Message: ----------- Test if empty after trim Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-06-02 15:21:49 UTC (rev 6842) +++ trunk/lib/stdlib.php 2009-06-02 15:57:11 UTC (rev 6843) @@ -2358,6 +2358,8 @@ $line = trim ($line, "="); $line = trim ($line); + if (empty($line)) return $options; + // Then we have the attribute value. $i = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-06-02 16:06:24
|
Revision: 6844 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6844&view=rev Author: vargenau Date: 2009-06-02 16:05:45 +0000 (Tue, 02 Jun 2009) Log Message: ----------- Split at underscore Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-06-02 15:57:11 UTC (rev 6843) +++ trunk/lib/stdlib.php 2009-06-02 16:05:45 UTC (rev 6844) @@ -1207,6 +1207,9 @@ $RE[] = "/(?<= |${sep}|^)([À])([[:upper:]][[:lower:]])/"; break; } + // Split at underscore + $RE[] = '/(_)([[:alpha:]])/'; + $RE[] = '/([[:alpha:]])(_)/'; // Split numerals from following letters. $RE[] = '/(\d)([[:alpha:]])/'; // Split at subpage seperators. TBD in WikiTheme.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-06-02 16:15:02
|
Revision: 6845 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6845&view=rev Author: vargenau Date: 2009-06-02 16:14:56 +0000 (Tue, 02 Jun 2009) Log Message: ----------- Allow more attributes for images (title); parse using parse_attributes Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-06-02 16:05:45 UTC (rev 6844) +++ trunk/lib/stdlib.php 2009-06-02 16:14:56 UTC (rev 6845) @@ -420,110 +420,114 @@ // FIXME: Is this needed (or sufficient?) // FIXED: This was broken for moniker:TP30 test/image.png => url="moniker:TP30" attr="test/image.png" $ori_url = $url; - if(! IsSafeURL($url)) { + // support new syntax: [prefix/image.jpg size=50% border=n] + if (empty($alt)) $alt = ""; + + // Extract URL + $arr = split(' ',$url); + if (!empty($arr)) $url = $arr[0]; + if (! IsSafeURL($url)) { $link = HTML::strong(HTML::u(array('class' => 'baduri'), _("BAD URL -- remove all of <, >, \""))); return $link; - } else { - // support new syntax: [prefix/image.jpg size=50% border=n] - //if (!preg_match("/\.(".$force_img.")/i", $url)) - if (empty($alt)) $alt = basename($url); - $arr = split(' ',$url); - if (!empty($arr)) $url = $arr[0]; - if ($alt == "") { - $link = HTML::img(array('src' => $url, 'alt' => $alt)); - } else { - $link = HTML::img(array('src' => $url, - 'alt' => $alt, 'title' => $alt)); + } + $link = HTML::img(array('src' => $url)); + + // Extract attributes + $arr = parse_attributes(strstr($ori_url, " ")); + foreach ($arr as $attr => $value) { + // These attributes take strings: lang, id, title, alt + if (($attr == "lang") + || ($attr == "id") + || ($attr == "title") + || ($attr == "alt")) { + $link->setAttr($attr, $value); } - if (count($arr) > 1) { - $url = $arr[0]; - array_shift($arr); - foreach ($arr as $attr) { - if (preg_match('/^size=(\d+%)$/',$attr,$m)) { - $link->setAttr('width',$m[1]); - $link->setAttr('height',$m[1]); - } - elseif (preg_match('/^size=(\d+)x(\d+)$/',$attr,$m)) { - $link->setAttr('width',$m[1]); - $link->setAttr('height',$m[2]); - } - elseif (preg_match('/^width=(\d+[%p]?x?)$/',$attr,$m)) - $link->setAttr('width',$m[1]); - elseif (preg_match('/^height=(\d+[%p]?x?)$/',$attr,$m)) - $link->setAttr('height',$m[1]); - elseif (preg_match('/^border=(\d+)$/',$attr,$m)) - $link->setAttr('border',$m[1]); - elseif (preg_match('/^align=(\w+)$/',$attr,$m)) - $link->setAttr('align',$m[1]); - elseif (preg_match('/^hspace=(\d+)$/',$attr,$m)) - $link->setAttr('hspace',$m[1]); - elseif (preg_match('/^vspace=(\d+)$/',$attr,$m)) - $link->setAttr('vspace',$m[1]); - else { - $url .= ' '.$attr; - if(! IsSafeURL($url)) { - $link = HTML::strong(HTML::u(array('class' => 'baduri'), - _("BAD URL -- remove all of <, >, \""))); - return $link; - } else { - $link->setAttr('src', $url); - } - } + // align = bottom|middle|top|left|right + if (($attr == "align") + && (($value == "bottom") + || ($value == "middle") + || ($value == "top") + || ($value == "left") + || ($value == "right"))) { + $link->setAttr($attr, $value); + } + // These attributes take a number (pixels): border, hspace, vspace + if ((($attr == "border") || ($attr == "hspace") || ($attr == "vspace")) + && (is_int($value))) { + $link->setAttr($attr, $value); + } + // These attributes take a number (pixels) or a percentage: height, width + if ((($attr == "border") || ($attr == "hspace") || ($attr == "vspace")) + && (preg_match('/\d+[%p]?x?/', $value))) { + $link->setAttr($attr, $value); + } + // We allow size=50% and size=20x30 + // We replace this with "width" and "height" HTML attributes + if ($attr == "size") { + if (preg_match('/(\d+)%/', $value, $m)) { + $link->setAttr('width',$m[1]); + $link->setAttr('height',$m[1]); + } elseif (preg_match('/(\d+)x(\d+)/', $value, $m)) { + $link->setAttr('width',$m[1]); + $link->setAttr('height',$m[2]); } } - // Check width and height as spam countermeasure - if (($width = $link->getAttr('width')) and ($height = $link->getAttr('height'))) { - //$width = (int) $width; // px or % or other suffix - //$height = (int) $height; - if (($width < 3 and $height < 10) or - ($height < 3 and $width < 20) or - ($height < 7 and $width < 7)) + } + if (!$link->getAttr('alt')) { + $link->setAttr('alt', $alt); + } + // Check width and height as spam countermeasure + if (($width = $link->getAttr('width')) and ($height = $link->getAttr('height'))) { + //$width = (int) $width; // px or % or other suffix + //$height = (int) $height; + if (($width < 3 and $height < 10) or + ($height < 3 and $width < 20) or + ($height < 7 and $width < 7)) + { + trigger_error(_("Invalid image size"), E_USER_WARNING); + return ''; + } + } else { + $size = 0; + // Prepare for getimagesize($url) + // $url only valid for external urls, otherwise local path + // Older php versions crash here with certain png's: + // confirmed for 4.1.2, 4.1.3, 4.2.3; 4.3.2 and 4.3.7 are ok + // http://phpwiki.sourceforge.net/demo/themes/default/images/http.png + // See http://bugs.php.net/search.php?cmd=display&search_for=getimagesize + if (DISABLE_GETIMAGESIZE) + ; + elseif (! preg_match("/\.$force_img$/i", $url)) + ; // only valid image extensions or scripts assumed to generate images + elseif (!check_php_version(4,3) and preg_match("/^http.+\.png$/i",$url)) + ; // it's safe to assume that this will fail. + elseif (preg_match("/^http/",$url)) { // external url + $size = @getimagesize($url); + } else { // local file + if (file_exists($file = NormalizeLocalFileName($url))) { // here + $size = @getimagesize($file); + } elseif (file_exists(NormalizeLocalFileName(urldecode($url)))) { + $size = @getimagesize($file); + $link->setAttr('src', rawurldecode($url)); + } elseif (string_starts_with($url, getUploadDataPath())) { // there + $file = substr($file, strlen(getUploadDataPath())); + $size = @getimagesize(getUploadFilePath().rawurldecode($file)); + $link->setAttr('src', getUploadDataPath() . rawurldecode($file)); + } else { // elsewhere + $size = @getimagesize($request->get('DOCUMENT_ROOT').urldecode($url)); + } + } + if ($size) { + $width = $size[0]; + $height = $size[1]; + if (($width < 3 and $height < 10) + or ($height < 3 and $width < 20) + or ($height < 7 and $width < 7)) { trigger_error(_("Invalid image size"), E_USER_WARNING); return ''; } - } else { - $size = 0; - // Prepare for getimagesize($url) - // $url only valid for external urls, otherwise local path - // Older php versions crash here with certain png's: - // confirmed for 4.1.2, 4.1.3, 4.2.3; 4.3.2 and 4.3.7 are ok - // http://phpwiki.sourceforge.net/demo/themes/default/images/http.png - // See http://bugs.php.net/search.php?cmd=display&search_for=getimagesize - if (DISABLE_GETIMAGESIZE) - ; - elseif (! preg_match("/\.$force_img$/i", $url)) - ; // only valid image extensions or scripts assumed to generate images - elseif (!check_php_version(4,3) and preg_match("/^http.+\.png$/i",$url)) - ; // it's safe to assume that this will fail. - elseif (preg_match("/^http/",$url)) { // external url - $size = @getimagesize($url); - } else { // local file - if (file_exists($file = NormalizeLocalFileName($url))) { // here - $size = @getimagesize($file); - } elseif (file_exists(NormalizeLocalFileName(urldecode($url)))) { - $size = @getimagesize($file); - $link->setAttr('src', rawurldecode($url)); - } elseif (string_starts_with($url, getUploadDataPath())) { // there - $file = substr($file, strlen(getUploadDataPath())); - $size = @getimagesize(getUploadFilePath().rawurldecode($file)); - $link->setAttr('src', getUploadDataPath() . rawurldecode($file)); - } else { // elsewhere - $size = @getimagesize($request->get('DOCUMENT_ROOT').urldecode($url)); - } - } - if ($size) { - $width = $size[0]; - $height = $size[1]; - if (($width < 3 and $height < 10) - or ($height < 3 and $width < 20) - or ($height < 7 and $width < 7)) - { - trigger_error(_("Invalid image size"), E_USER_WARNING); - return ''; - } - } } } $link->setAttr('class', 'inlineimage'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ru...@us...> - 2009-06-04 11:40:07
|
Revision: 6871 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6871&view=rev Author: rurban Date: 2009-06-04 11:39:12 +0000 (Thu, 04 Jun 2009) Log Message: ----------- whitespace only Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-06-04 11:35:04 UTC (rev 6870) +++ trunk/lib/stdlib.php 2009-06-04 11:39:12 UTC (rev 6871) @@ -2580,6 +2580,7 @@ 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY'); return utf8_encode($res); } + // (c-file-style: "gnu") // Local Variables: // mode: php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ru...@us...> - 2009-07-14 07:24:12
|
Revision: 7027 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7027&view=rev Author: rurban Date: 2009-07-14 07:24:04 +0000 (Tue, 14 Jul 2009) Log Message: ----------- Convenience: Silently allow spaces in inlines images, if: * there's no other image attribute * the path with space is found locally Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-07-14 07:14:18 UTC (rev 7026) +++ trunk/lib/stdlib.php 2009-07-14 07:24:04 UTC (rev 7027) @@ -431,6 +431,7 @@ _("BAD URL -- remove all of <, >, \""))); return $link; } + // spaces in inline images must be %20 encoded! $link = HTML::img(array('src' => $url)); // Extract attributes @@ -444,7 +445,7 @@ $link->setAttr($attr, $value); } // align = bottom|middle|top|left|right - if (($attr == "align") + elseif (($attr == "align") && (($value == "bottom") || ($value == "middle") || ($value == "top") @@ -453,18 +454,18 @@ $link->setAttr($attr, $value); } // These attributes take a number (pixels): border, hspace, vspace - if ((($attr == "border") || ($attr == "hspace") || ($attr == "vspace")) + elseif ((($attr == "border") || ($attr == "hspace") || ($attr == "vspace")) && (is_int($value))) { $link->setAttr($attr, $value); } // These attributes take a number (pixels) or a percentage: height, width - if ((($attr == "border") || ($attr == "hspace") || ($attr == "vspace")) + elseif ((($attr == "border") || ($attr == "hspace") || ($attr == "vspace")) && (preg_match('/\d+[%p]?x?/', $value))) { $link->setAttr($attr, $value); } // We allow size=50% and size=20x30 // We replace this with "width" and "height" HTML attributes - if ($attr == "size") { + elseif ($attr == "size") { if (preg_match('/(\d+)%/', $value, $m)) { $link->setAttr('width',$m[1]); $link->setAttr('height',$m[1]); @@ -472,8 +473,27 @@ $link->setAttr('width',$m[1]); $link->setAttr('height',$m[2]); } + } + else { + trigger_error(sprintf(_("Invalid image attribute %s %s=%s"), + $url, $attr, $value), E_USER_WARNING); } } + // Correct silently the most common error + if ($url != $ori_url and empty($arr) and !preg_match("/^http/",$url)) { + // space belongs to the path + $file = NormalizeLocalFileName($ori_url); + if (file_exists($file)) { + $link = HTML::img(array('src' => $ori_url)); + } elseif (string_starts_with($ori_url, getUploadDataPath())) { + $file = substr($file, strlen(getUploadDataPath())); + $path = getUploadFilePath().$file; + if (file_exists($path)) { + $link->setAttr('src', getUploadDataPath() . $file); + $url = $ori_url; + } + } + } if (!$link->getAttr('alt')) { $link->setAttr('alt', $alt); } @@ -512,7 +532,8 @@ $link->setAttr('src', rawurldecode($url)); } elseif (string_starts_with($url, getUploadDataPath())) { // there $file = substr($file, strlen(getUploadDataPath())); - $size = @getimagesize(getUploadFilePath().rawurldecode($file)); + $path = getUploadFilePath().rawurldecode($file); + $size = @getimagesize($path); $link->setAttr('src', getUploadDataPath() . rawurldecode($file)); } else { // elsewhere $size = @getimagesize($request->get('DOCUMENT_ROOT').urldecode($url)); @@ -2576,8 +2597,8 @@ function strip_accents($text) { $res = utf8_decode($text); $res = strtr($res, - utf8_decode('àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ'), - 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY'); + utf8_decode('àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ'), + 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY'); return utf8_encode($res); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ru...@us...> - 2009-08-31 11:28:15
|
Revision: 7094 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7094&view=rev Author: rurban Date: 2009-08-31 11:28:08 +0000 (Mon, 31 Aug 2009) Log Message: ----------- Warn about fixed invalid image links Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-08-31 11:21:07 UTC (rev 7093) +++ trunk/lib/stdlib.php 2009-08-31 11:28:08 UTC (rev 7094) @@ -475,7 +475,7 @@ } } else { - trigger_error(sprintf(_("Invalid image attribute %s %s=%s"), + trigger_error(sprintf(_("Invalid image attribute \"%s\" %s=%s"), $url, $attr, $value), E_USER_WARNING); } } @@ -485,10 +485,15 @@ $file = NormalizeLocalFileName($ori_url); if (file_exists($file)) { $link = HTML::img(array('src' => $ori_url)); + trigger_error( + sprintf(_("Invalid image link fixed %s => %s. Spaces must be quoted with %%20."), + $url, $ori_url), E_USER_WARNING); } elseif (string_starts_with($ori_url, getUploadDataPath())) { $file = substr($file, strlen(getUploadDataPath())); $path = getUploadFilePath().$file; if (file_exists($path)) { + trigger_error(sprintf(_("Invalid image link fixed \"%s\" => \"%s\".\n Spaces must be quoted with %%20."), + $url, $ori_url), E_USER_WARNING); $link->setAttr('src', getUploadDataPath() . $file); $url = $ori_url; } @@ -554,7 +559,7 @@ $link->setAttr('class', 'inlineimage'); /* Check for inlined objects. Everything allowed in INLINE_IMAGES besides - * png|jpg|gif|jpeg|bmp|pl|cgi + * png|jpg|gif|jpeg|bmp|pl|cgi. If no image it is an object to embed. * Note: Allow cgi's (pl,cgi) returning images. */ if (!preg_match("/\.(".$force_img.")/i", $url)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-10-13 08:32:24
|
Revision: 7210 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7210&view=rev Author: vargenau Date: 2009-10-13 08:32:12 +0000 (Tue, 13 Oct 2009) Log Message: ----------- Repair UTF-8 characters that were broken by r7208 Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-10-13 07:46:22 UTC (rev 7209) +++ trunk/lib/stdlib.php 2009-10-13 08:32:12 UTC (rev 7210) @@ -1265,7 +1265,7 @@ $RE[] = "/(?<= |${sep}|^)([AI])([[:upper:]][[:lower:]])/"; break; case 'fr': - $RE[] = "/(?<= |${sep}|^)([\xC3])([[:upper:]][[:lower:]])/"; + $RE[] = "/(?<= |${sep}|^)([À])([[:upper:]][[:lower:]])/"; break; } // Split at underscore @@ -2652,7 +2652,7 @@ function strip_accents($text) { $res = utf8_decode($text); $res = strtr($res, - utf8_decode('\xC3áâãäçèéêëìíîïñòóôõöùúûüýÿ\xC3\xC3?ÂÃÄÇÈÉÊËÌ\xC3?Î\xC3?ÑÒÓÔÕÖÙÚÛÜ\xC3?'), + utf8_decode('àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ'), 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY'); return utf8_encode($res); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-10-28 09:49:00
|
Revision: 7238 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7238&view=rev Author: vargenau Date: 2009-10-28 09:48:52 +0000 (Wed, 28 Oct 2009) Log Message: ----------- Allow "height" and "width" attributes for images Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-10-25 19:05:17 UTC (rev 7237) +++ trunk/lib/stdlib.php 2009-10-28 09:48:52 UTC (rev 7238) @@ -460,7 +460,7 @@ $link->setAttr($attr, $value); } // These attributes take a number (pixels) or a percentage: height, width - elseif ((($attr == "border") || ($attr == "hspace") || ($attr == "vspace")) + elseif ((($attr == "height") || ($attr == "width")) && (preg_match('/\d+[%p]?x?/', $value))) { $link->setAttr($attr, $value); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-10-29 08:59:37
|
Revision: 7242 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7242&view=rev Author: vargenau Date: 2009-10-29 08:59:30 +0000 (Thu, 29 Oct 2009) Log Message: ----------- Include "%" in width and height when size=xx% Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-10-28 17:22:54 UTC (rev 7241) +++ trunk/lib/stdlib.php 2009-10-29 08:59:30 UTC (rev 7242) @@ -467,7 +467,7 @@ // We allow size=50% and size=20x30 // We replace this with "width" and "height" HTML attributes elseif ($attr == "size") { - if (preg_match('/(\d+)%/', $value, $m)) { + if (preg_match('/(\d+%)/', $value, $m)) { $link->setAttr('width',$m[1]); $link->setAttr('height',$m[1]); } elseif (preg_match('/(\d+)x(\d+)/', $value, $m)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-10-29 09:29:12
|
Revision: 7243 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7243&view=rev Author: vargenau Date: 2009-10-29 09:28:58 +0000 (Thu, 29 Oct 2009) Log Message: ----------- Use "error" class, "baduri" class does not exist Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-10-29 08:59:30 UTC (rev 7242) +++ trunk/lib/stdlib.php 2009-10-29 09:28:58 UTC (rev 7243) @@ -391,8 +391,8 @@ function LinkURL($url, $linktext = '') { // FIXME: Is this needed (or sufficient?) if(! IsSafeURL($url)) { - $link = HTML::strong(HTML::u(array('class' => 'baduri'), - _("BAD URL -- remove all of <, >, \""))); + $link = HTML::span(array('class' => 'error'), _("BAD URL -- remove all of <, >, \"")); + return $link; } else { if (!$linktext) @@ -428,8 +428,7 @@ $arr = split(' ',$url); if (!empty($arr)) $url = $arr[0]; if (! IsSafeURL($url)) { - $link = HTML::strong(HTML::u(array('class' => 'baduri'), - _("BAD URL -- remove all of <, >, \""))); + $link = HTML::span(array('class' => 'error'), _("BAD URL -- remove all of <, >, \"")); return $link; } // spaces in inline images must be %20 encoded! @@ -725,9 +724,7 @@ $args = array(); if (!preg_match('/^ phpwiki: ([^?]*) [?]? (.*) $/x', $url, $m)) { - return HTML::strong(array('class' => 'rawurl'), - HTML::u(array('class' => 'baduri'), - _("BAD phpwiki: URL"))); + return HTML::span(array('class' => 'error'), _("BAD phpwiki: URL")); } if ($m[1]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-10-29 09:34:00
|
Revision: 7244 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7244&view=rev Author: vargenau Date: 2009-10-29 09:33:54 +0000 (Thu, 29 Oct 2009) Log Message: ----------- return '' causes 'Call to a member function on a non-object' InlineParser.php on line 511; return error message instead of trigger_error Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-10-29 09:28:58 UTC (rev 7243) +++ trunk/lib/stdlib.php 2009-10-29 09:33:54 UTC (rev 7244) @@ -475,8 +475,10 @@ } } else { - trigger_error(sprintf(_("Invalid image attribute \"%s\" %s=%s"), - $url, $attr, $value), E_USER_WARNING); + $link = HTML::span(array('class' => 'error'), + sprintf(_("Invalid image attribute \"%s\" %s=%s"), + $url, $attr, $value)); + return $link; } } // Correct silently the most common error @@ -510,8 +512,9 @@ ($height < 3 and $width < 20) or ($height < 7 and $width < 7)) { - trigger_error(_("Invalid image size"), E_USER_WARNING); - return ''; + $link = HTML::span(array('class' => 'error'), + _("Invalid image size")); + return $link; } } else { $size = 0; @@ -551,8 +554,9 @@ or ($height < 3 and $width < 20) or ($height < 7 and $width < 7)) { - trigger_error(_("Invalid image size"), E_USER_WARNING); - return ''; + $link = HTML::span(array('class' => 'error'), + _("Invalid image size")); + return $link; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-11-20 17:09:36
|
Revision: 7271 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7271&view=rev Author: vargenau Date: 2009-11-20 17:09:23 +0000 (Fri, 20 Nov 2009) Log Message: ----------- Make extractSection work with Mediawiki syntax (trailing ='s) Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-11-20 16:58:11 UTC (rev 7270) +++ trunk/lib/stdlib.php 2009-11-20 17:09:23 UTC (rev 7271) @@ -2167,7 +2167,7 @@ function extractSection ($section, $content, $page, $quiet = false, $sectionhead = false) { $qsection = preg_replace('/\s+/', '\s+', preg_quote($section, '/')); - if (preg_match("/ ^(!{1,}|={2,})\\s*$qsection" // section header + if (preg_match("/ ^(!{1,}|={2,})\\s*$qsection\s*=*" // section header . " \\s*$\\n?" // possible blank lines . " ( (?: ^.*\\n? )*? )" // some lines . " (?= ^\\1 | \\Z)/xm", // sec header (same or higher level) (or EOF) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2009-11-20 17:51:07
|
Revision: 7274 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7274&view=rev Author: vargenau Date: 2009-11-20 17:50:59 +0000 (Fri, 20 Nov 2009) Log Message: ----------- Add Wikicreole syntax for extractSections Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2009-11-20 17:34:19 UTC (rev 7273) +++ trunk/lib/stdlib.php 2009-11-20 17:50:59 UTC (rev 7274) @@ -2194,7 +2194,7 @@ while ($sections > 0) { - if (preg_match("/ ^(!{1,})\\s*(.*)\\n" // section header + if (preg_match("/ ^(!{1,}|={2,})\\s*(.*)\\n" // section header . " \\s*$\\n?" // possible blank lines . " ( (?: ^.*\\n? )*? )" // some lines . " ( ^\\1 (.|\\n)* | \\Z)/xm", // sec header (same or higher level) (or EOF) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2010-03-31 09:25:58
|
Revision: 7311 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7311&view=rev Author: vargenau Date: 2010-03-31 09:25:47 +0000 (Wed, 31 Mar 2010) Log Message: ----------- Fix border, hspace, vspace attributes handling Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2010-03-31 09:00:27 UTC (rev 7310) +++ trunk/lib/stdlib.php 2010-03-31 09:25:47 UTC (rev 7311) @@ -455,8 +455,8 @@ } // These attributes take a number (pixels): border, hspace, vspace elseif ((($attr == "border") || ($attr == "hspace") || ($attr == "vspace")) - && (is_int($value))) { - $link->setAttr($attr, $value); + && (is_numeric($value))) { + $link->setAttr($attr, (int)$value); } // These attributes take a number (pixels) or a percentage: height, width elseif ((($attr == "height") || ($attr == "width")) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2010-05-18 13:23:31
|
Revision: 7402 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7402&view=rev Author: vargenau Date: 2010-05-18 13:23:25 +0000 (Tue, 18 May 2010) Log Message: ----------- Update comment: "Currently only FLV and OGG" Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2010-05-17 13:54:53 UTC (rev 7401) +++ trunk/lib/stdlib.php 2010-05-18 13:23:25 UTC (rev 7402) @@ -2490,7 +2490,7 @@ /** * Returns true if the filename ends with an video suffix. - * Currently only FLV + * Currently only FLV and OGG */ function is_video ($filename) { @@ -2498,7 +2498,6 @@ or string_ends_with(strtolower($filename), ".ogg"); } - /** * Compute cell in spreadsheet table * $table: two-dimensional table This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |