From: <var...@us...> - 2009-03-03 08:51:41
|
Revision: 6617 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6617&view=rev Author: vargenau Date: 2009-03-03 08:51:29 +0000 (Tue, 03 Mar 2009) Log Message: ----------- Valid XHTML code Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2009-03-01 19:19:41 UTC (rev 6616) +++ trunk/lib/plugin/PhotoAlbum.php 2009-03-03 08:51:29 UTC (rev 6617) @@ -2,6 +2,7 @@ rcs_id('$Id$'); /* Copyright 2003,2004,2005,2007 $ThePhpWikiProgrammingTeam + Copyright 2009 Marc-Etienne Vargenau, Alcatel-Lucent This file is part of PhpWiki. @@ -340,24 +341,27 @@ if ($mode == 'normal' || $mode == 'slide') { if(!@empty($params['location'])) $params['src'] = $params['location']; unset ($params['location'],$params['src_tile']); - $url_image = $link ? HTML::a(array("id" => basename($value["name"])), - HTML::a(array("href" => "$url"), HTML::img($params))) : HTML::img($params); + $url_image = $link ? HTML::a(array("id" => basename($value["name"]), + "href" => "$url"), HTML::img($params)) + : HTML::img($params); } else { $keep = $params; if (!@empty ($params['src_tile'])) $params['src'] = $params['src_tile'] ; unset ($params['location'],$params['src_tile']); - $url_image = $link ? HTML::a(array("id" => basename($value["name"])), - HTML::a(array("href" => "$url"), - ImageTile::image_tile($params))) : HTML::img($params); + $url_image = $link ? HTML::a(array("id" => basename($value["name"]), + "href" => "$url"), + ImageTile::image_tile($params)) + : HTML::img($params); $params = $keep; unset ($keep); } } else { if(!@empty($params['location'])) $params['src'] = $params['location']; unset ($params['location'],$params['src_tile']); - $url_image = $link ? HTML::a(array("id" => basename($value["name"])), - HTML::a(array("href" => "$b_url"), HTML::img($params))) : HTML::img($params); + $url_image = $link ? HTML::a(array("id" => basename($value["name"]), + "href" => "$b_url"), HTML::img($params)) + : HTML::img($params); } if ($mode == 'list') $url_text = HTML::a(array("id" => basename($value["name"])), @@ -368,10 +372,10 @@ HTML::td($cell, HTML::div(array('valign' => 'top'), $url_image), HTML::div(array('valign' => 'bottom'), - HTML::span(array('class'=>'boldsmall'), + HTML::div(array('class'=>'boldsmall'), ($url_text)), HTML::br(), - HTML::span(array('class'=>'gensmall'), + HTML::div(array('class'=>'gensmall'), ($size[0]. " x ". $size[1]. @@ -383,12 +387,12 @@ HTML::td(array("valign" => "top", "nowrap" => 0, "bgcolor" => $color), - HTML::span(array('class'=>'boldsmall'),($url_text)))); + HTML::div(array('class'=>'boldsmall'),($url_text)))); $row->pushContent( HTML::td(array("valign" => "top", "nowrap" => 0, "bgcolor" => $color), - HTML::span(array('class'=>'gensmall'), + HTML::div(array('class'=>'gensmall'), ($size[0]. " x ". $size[1]. @@ -399,7 +403,7 @@ HTML::td(array("valign" => "top", "nowrap" => 0, "bgcolor" => $color), - HTML::span(array('class'=>'gensmall'),$desc))); + HTML::div(array('class'=>'gensmall'),$desc))); } elseif ($mode == 'thumbs') { $desc = ($showdesc != 'none') ? @@ -411,7 +415,7 @@ // FIXME: no HtmlElement for fontsizes? // rurban: use ->setAttr("style","font-size:small;") // but better use a css class - HTML::span(array('class'=>'gensmall'),$desc) + HTML::div(array('class'=>'gensmall'),$desc) ))); } elseif ($mode == 'normal') { $desc = ($showdesc != 'none') ? HTML::p($value["desc"]) : ''; @@ -419,7 +423,7 @@ (HTML::td($cell, $url_image, // FIXME: no HtmlElement for fontsizes? - HTML::span(array('class'=>'gensmall'),$desc) + HTML::div(array('class'=>'gensmall'),$desc) ))); } elseif ($mode == 'slide') { if ($newwidth == 'auto' || !$newwidth) @@ -461,7 +465,7 @@ $row->pushContent( (HTML::td($cell, $url_image, - HTML::span(array('class'=>'gensmall'), $desc) + HTML::div(array('class'=>'gensmall'), $desc) ))); $count ++; } elseif ($mode == 'row') { @@ -484,7 +488,7 @@ ($key + 1) == count($photos) || $p) { if ($mode == 'row') - $html->pushcontent(HTML::span($row)); + $html->pushcontent(HTML::div($row)); else $html->pushcontent(HTML::tr($row)); $row->setContent(''); @@ -659,81 +663,6 @@ } }; -// $Log: not supported by cvs2svn $ -// Revision 1.14 2005/10/12 06:19:07 rurban -// protect unsafe calls -// -// Revision 1.13 2005/09/26 06:39:55 rurban -// re-add lost mode=column|row. by Thomas Harding -// -// Revision 1.12 2005/09/20 19:34:51 rurban -// slide and thumbs mode by Thomas Harding -// -// -// Revision 1.14 2005/09/19 23:49:00 tharding -// added slide mode, correct url retrieving with url_get_contents -// -// Revision 1.13 2005/09/17 18:17:00 tharding -// add resized thumbnails (see ImageTile.php at top-level) -// comment url_get_contents (fopen can open a web location) -// -// Revision 1.11 2004/12/06 19:50:05 rurban -// enable action=remove which is undoable and seeable in RecentChanges: ADODB ony for now. -// renamed delete_page to purge_page. -// enable action=edit&version=-1 to force creation of a new version. -// added BABYCART_PATH config -// fixed magiqc in adodb.inc.php -// and some more docs -// -// Revision 1.10 2004/12/01 19:34:13 rurban -// Cleanup of CONSTANT pollution. -// renamed weblocation to url. -// allow any url. -// use fixed ";" CSV seperator -// fix substr_replace usage bug. -// -// Revision 1.9 2004/07/08 20:30:07 rurban -// plugin->run consistency: request as reference, added basepage. -// encountered strange bug in AllPages (and the test) which destroys ->_dbi -// -// Revision 1.8 2004/06/01 15:28:01 rurban -// AdminUser only ADMIN_USER not member of Administrators -// some RateIt improvements by dfrankow -// edit_toolbar buttons -// -// Revision 1.7 2004/05/03 20:44:55 rurban -// fixed gettext strings -// new SqlResult plugin -// _WikiTranslation: fixed init_locale -// -// Revision 1.6 2004/04/18 00:19:30 rurban -// better default example with local src, don't require weblocation for -// the default setup, better docs, fixed ini_get => get_cfg_var("allow_url_fopen"), -// no HttpClient lib yet. -// -// Revision 1.5 2004/03/09 12:10:23 rurban -// fixed getimagesize problem with local dir. -// -// Revision 1.4 2004/02/28 21:14:08 rurban -// generally more PHPDOC docs -// see http://xarch.tu-graz.ac.at/home/rurban/phpwiki/xref/ -// fxied WikiUserNew pref handling: empty theme not stored, save only -// changed prefs, sql prefs improved, fixed password update, -// removed REPLACE sql (dangerous) -// moved gettext init after the locale was guessed -// + some minor changes -// -// Revision 1.3 2004/02/27 08:03:35 rurban -// Update from version 1.2 by Ted Vinke -// implemented the localdir support -// -// Revision 1.2 2004/02/17 12:11:36 rurban -// added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...) -// -// Revision 1.1 2003/01/05 04:21:06 carstenklapp -// New plugin by Ted Vinke (sf tracker patch #661189) -// - // For emacs users // 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...> - 2014-10-29 20:43:52
|
Revision: 9278 http://sourceforge.net/p/phpwiki/code/9278 Author: vargenau Date: 2014-10-29 20:43:42 +0000 (Wed, 29 Oct 2014) Log Message: ----------- Remove duplcates Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2014-10-25 15:25:42 UTC (rev 9277) +++ trunk/lib/plugin/PhotoAlbum.php 2014-10-29 20:43:42 UTC (rev 9278) @@ -618,7 +618,6 @@ $photos[] = array("src" => $src, "name" => $src, "name_tile" => $src, - "src" => $src, "desc" => ""); return ''; } @@ -627,7 +626,6 @@ $photos[] = array("src" => $src, "name" => "../" . $src, "name_tile" => $src, - "src" => $src, "desc" => ""); return ''; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2016-07-07 14:56:02
|
Revision: 9860 http://sourceforge.net/p/phpwiki/code/9860 Author: vargenau Date: 2016-07-07 14:55:58 +0000 (Thu, 07 Jul 2016) Log Message: ----------- Use CSS Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2016-07-07 13:59:29 UTC (rev 9859) +++ trunk/lib/plugin/PhotoAlbum.php 2016-07-07 14:55:58 UTC (rev 9860) @@ -501,7 +501,7 @@ //create main table $table_attributes = array( "class" => "photoalbum", - "width" => $tablewidth ? $tablewidth : "100%"); + "style" => $tablewidth ? "width: ".$tablewidth : "width: 100%"); if (!empty($tableheight)) $table_attributes = array_merge($table_attributes, @@ -509,7 +509,7 @@ if ($mode != 'row') $html = HTML::table($table_attributes, $html); // align all - return HTML::div(array("align" => $align), $html); + return HTML::div(array("class" => "align-".$align), $html); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2016-07-10 16:57:37
|
Revision: 9871 http://sourceforge.net/p/phpwiki/code/9871 Author: vargenau Date: 2016-07-10 16:57:34 +0000 (Sun, 10 Jul 2016) Log Message: ----------- Use CSS Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2016-07-09 17:26:31 UTC (rev 9870) +++ trunk/lib/plugin/PhotoAlbum.php 2016-07-10 16:57:34 UTC (rev 9871) @@ -321,7 +321,7 @@ } else { $newcellwidth = $cellwidth; } - $cell = array_merge($cell, array("width" => $newcellwidth)); + $cell = array_merge($cell, array("style" => 'width: '.$newcellwidth)); } if (in_array("nowrap", $attributes)) { $cell = array_merge($cell, array("nowrap" => "nowrap")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2016-07-12 08:17:28
|
Revision: 9877 http://sourceforge.net/p/phpwiki/code/9877 Author: vargenau Date: 2016-07-12 08:17:25 +0000 (Tue, 12 Jul 2016) Log Message: ----------- array_merge needs an array Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2016-07-12 07:20:17 UTC (rev 9876) +++ trunk/lib/plugin/PhotoAlbum.php 2016-07-12 08:17:25 UTC (rev 9877) @@ -205,8 +205,8 @@ // set some fixed properties for each $mode if ($mode == 'thumbs' || $mode == 'tiles') { - $attributes = array_merge($attributes, "alt"); - $attributes = array_merge($attributes, "nowrap"); + $attributes = array_merge($attributes, array('alt' => '')); + $attributes = array_merge($attributes, array('nowrap' => 'nowrap')); $cellwidth = 'auto'; // else cell won't nowrap if ($width == 'auto') $width = 70; } elseif ($mode == 'list') { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-12-06 14:34:33
|
Revision: 10734 http://sourceforge.net/p/phpwiki/code/10734 Author: vargenau Date: 2021-12-06 14:34:32 +0000 (Mon, 06 Dec 2021) Log Message: ----------- PhotoAlbum plugin: fix getimagesize Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-12-06 13:34:26 UTC (rev 10733) +++ trunk/lib/plugin/PhotoAlbum.php 2021-12-06 14:34:32 UTC (rev 10734) @@ -283,15 +283,7 @@ break; } - // FIXME: get getimagesize to work with names with spaces in it. - // convert $value["name"] from webpath to local path - $size = @getimagesize($value["name"]); // try " " => "\\ " - if (!$size and !empty($value["src"])) { - $size = @getimagesize($value["src"]); - if (!$size) { - trigger_error("Unable to getimagesize(" . $value["name"] . ")"); - } - } + $size = getimagesize($value["src"]); // try " " => "\\ " $newwidth = $this->newSize($size[0], $width); if ($width != 'auto' && $newwidth > 0) { $params = array_merge($params, array("width" => $newwidth)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-12-10 10:02:17
|
Revision: 10771 http://sourceforge.net/p/phpwiki/code/10771 Author: vargenau Date: 2021-12-10 10:02:15 +0000 (Fri, 10 Dec 2021) Log Message: ----------- PhotoAlbum plugin: fix width with px Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-12-10 09:59:39 UTC (rev 10770) +++ trunk/lib/plugin/PhotoAlbum.php 2021-12-10 10:02:15 UTC (rev 10771) @@ -256,9 +256,11 @@ $newwidth = $this->newSize($size[0], $width); if ($width != 'auto' && $newwidth > 0) { if (is_numeric($newwidth)) { - $newwidth = $newwidth.'px'; + $newwidthpx = $newwidth.'px'; + } else { + $newwidthpx = $newwidth; } - $params = array_merge($params, array("style" => 'width: '.$newwidth)); + $params = array_merge($params, array("style" => 'width: '.$newwidthpx)); } if (($mode == 'thumbs' || $mode == 'tiles' || $mode == 'list')) { if (!empty($size[0])) { @@ -642,9 +644,13 @@ } else { $src = '/'.$params['src']; } + $width = $params['width']; + if (is_numeric($width)) { + $width = $width.'px'; + } if (array_key_exists('width', $params)) { return HTML::img(array('src' => $src, - 'style' => 'width: '.$params['width'], + 'style' => 'width: '.$width, 'alt' => $params['alt'])); } else { return HTML::img(array('src' => $src, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-12-16 15:24:32
|
Revision: 10788 http://sourceforge.net/p/phpwiki/code/10788 Author: vargenau Date: 2021-12-16 15:24:29 +0000 (Thu, 16 Dec 2021) Log Message: ----------- PhotoAlbum plugin: usage is in Help page Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-12-15 17:49:09 UTC (rev 10787) +++ trunk/lib/plugin/PhotoAlbum.php 2021-12-16 15:24:29 UTC (rev 10788) @@ -29,33 +29,6 @@ * @author: Ted Vinke <te...@jo...> * Reini Urban (local fs) * Thomas Harding (slides mode, real thumbnails) - * - * Usage: - * <<PhotoAlbum - * src="http://server/textfile" or localfile or localdir - * mode=[normal|column|row|thumbs|tiles|list|slide] - * desc=true - * numcols=3 - * height=50% - * width=50% - * thumbswidth=80 - * align=[center|left|right] - * duration=6 - * >> - * - * "src": textfile of images or directory of images or a single image (local or remote) - * Local or remote e.g. http://myserver/images/MyPhotos.txt or http://myserver/images/ - * or /images/ or Upload:photos/ - * Possible content of a valid textfile: - * photo-01.jpg; Me and my girlfriend - * photo-02.jpg - * christmas.gif; Merry Christmas! - * - * Inside textfile, filenames and optional descriptions are separated by - * semi-colon on each line. Listed files must be in same directory as textfile - * itself, so don't use relative paths inside textfile. - * - * "url": defines the webpath to the srcdir directory */ /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-11-24 10:49:32
|
Revision: 10680 http://sourceforge.net/p/phpwiki/code/10680 Author: vargenau Date: 2021-11-24 10:49:30 +0000 (Wed, 24 Nov 2021) Log Message: ----------- Use CSS for bgcolor Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-11-23 16:02:42 UTC (rev 10679) +++ trunk/lib/plugin/PhotoAlbum.php 2021-11-24 10:49:30 UTC (rev 10680) @@ -313,7 +313,7 @@ // cell operations $cell = array( 'class' => 'photoalbum cell align-center top', - 'bgcolor' => "$color"); + 'style' => "background-color: $color"); if ($cellwidth != 'auto') { if ($cellwidth == 'equal') { $newcellwidth = round(100 / $numcols) . "%"; @@ -389,12 +389,12 @@ $row->pushContent( HTML::td(array("class" => "top", "nowrap" => 0, - "bgcolor" => $color), + 'style' => "background-color: $color"), HTML::div(array('class' => 'boldsmall'), ($url_text)))); $row->pushContent( HTML::td(array("class" => "top", "nowrap" => 0, - "bgcolor" => $color), + 'style' => "background-color: $color"), HTML::div(array('class' => 'gensmall'), ($size[0] . " x " . @@ -405,7 +405,7 @@ $row->pushContent( HTML::td(array("class" => "top", "nowrap" => 0, - "bgcolor" => $color), + 'style' => "background-color: $color"), HTML::div(array('class' => 'gensmall'), $desc))); } elseif ($mode == 'thumbs') { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-11-25 14:38:28
|
Revision: 10688 http://sourceforge.net/p/phpwiki/code/10688 Author: vargenau Date: 2021-11-25 14:38:26 +0000 (Thu, 25 Nov 2021) Log Message: ----------- Check PHPWIKI_DIR is defined Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-11-25 14:29:08 UTC (rev 10687) +++ trunk/lib/plugin/PhotoAlbum.php 2021-11-25 14:38:26 UTC (rev 10688) @@ -583,7 +583,9 @@ if (string_ends_with($src, "/")) $src = substr($src, 0, -1); } - if (!file_exists($src) and @file_exists(PHPWIKI_DIR . "/$src")) { + if (!file_exists($src) + && defined('PHPWIKI_DIR') + && file_exists(PHPWIKI_DIR . "/$src")) { $src = PHPWIKI_DIR . "/$src"; } // check if src is a directory @@ -613,8 +615,11 @@ // check if $src is an image foreach (array('jpeg', 'jpg', 'png', 'gif') as $ext) { if (preg_match("/\.$ext$/", $src)) { - if (!file_exists($src) and @file_exists(PHPWIKI_DIR . "/$src")) + if (!file_exists($src) + && defined('PHPWIKI_DIR') + && file_exists(PHPWIKI_DIR . "/$src")) { $src = PHPWIKI_DIR . "/$src"; + } if ($web_location == 1 and !empty($contents)) { $photos[] = array("src" => $src, "name" => $src, @@ -622,8 +627,9 @@ "desc" => ""); return ''; } - if (!file_exists($src)) + if (!file_exists($src)) { return $this->error(fmt("Unable to find src=“%s”", $src)); + } $photos[] = array("src" => $src, "name" => "../" . $src, "name_tile" => $src, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-12-06 14:50:48
|
Revision: 10735 http://sourceforge.net/p/phpwiki/code/10735 Author: vargenau Date: 2021-12-06 14:50:45 +0000 (Mon, 06 Dec 2021) Log Message: ----------- PhotoAlbum plugin: avoid nested <a> in list mode Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-12-06 14:34:32 UTC (rev 10734) +++ trunk/lib/plugin/PhotoAlbum.php 2021-12-06 14:50:45 UTC (rev 10735) @@ -358,9 +358,6 @@ "href" => "$b_url"), HTML::img($params)) : HTML::img($params); } - if ($mode == 'list') - $url_text = HTML::a(array("id" => basename($value["name"])), - $url_text); // here we use different modes if ($mode == 'tiles') { $row->pushContent( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-12-06 15:33:25
|
Revision: 10736 http://sourceforge.net/p/phpwiki/code/10736 Author: vargenau Date: 2021-12-06 15:33:23 +0000 (Mon, 06 Dec 2021) Log Message: ----------- PhotoAlbum plugin: remove duplicate array key, add braces, remove old comments Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-12-06 14:50:45 UTC (rev 10735) +++ trunk/lib/plugin/PhotoAlbum.php 2021-12-06 15:33:23 UTC (rev 10736) @@ -102,12 +102,6 @@ return _("Display a set of photos listed in a text file with optional descriptions."); } -// Avoid nameclash, so it's disabled. We allow any url. -// define('allow_album_location', true); -// define('album_location', 'http://kw.jouwfeestje.com/foto/redactie'); -// define('album_default_extension', '.jpg'); -// define('desc_separator', ';'); - function getDefaultArguments() { return array('src' => '', // textfile of image list, or local dir. @@ -165,7 +159,6 @@ */ function run($dbi, $argstr, &$request, $basepage) { - extract($this->getArgs($argstr, $request)); $attributes = $attrib ? explode(",", $attrib) : array(); @@ -210,11 +203,15 @@ $attributes = array_merge($attributes, array('alt' => '')); $attributes = array_merge($attributes, array('nowrap' => 'nowrap')); $cellwidth = 'auto'; // else cell won't nowrap - if ($width == 'auto') $width = 70; + if ($width == 'auto') { + $width = 70; + } } elseif ($mode == 'list') { $numcols = 1; $cellwidth = "auto"; - if ($width == 'auto') $width = 50; + if ($width == 'auto') { + $width = 50; + } } elseif ($mode == 'slide') { $tableheight = 0; $cell_width = 0; @@ -293,8 +290,12 @@ $newheight = round($newwidth * $size[1] / $size[0]); $params['width'] = $newwidth; $params['height'] = $newheight; - } else $newheight = ''; - if ($height == 'auto') $height = 150; + } else { + $newheight = ''; + } + if ($height == 'auto') { + $height = 150; + } } else { $newheight = $this->newSize($size[1], $height); if ($height != 'auto' && $newheight > 0) { @@ -404,9 +405,6 @@ $row->pushContent( (HTML::td($cell, $url_image, - // FIXME: no HtmlElement for fontsizes? - // rurban: use ->setAttr("style","font-size:small;") - // but better use a css class HTML::div(array('class' => 'gensmall'), $desc) ))); } elseif ($mode == 'normal') { @@ -414,7 +412,6 @@ $row->pushContent( (HTML::td($cell, $url_image, - // FIXME: no HtmlElement for fontsizes? HTML::div(array('class' => 'gensmall'), $desc) ))); } elseif ($mode == 'slide') { @@ -520,7 +517,7 @@ } /** - * fromLocation - read only one picture from fixed album_location + * fromLocation - read only one picture from fixed album location * and return it in array $photos * * @param string $src Name of page @@ -529,15 +526,11 @@ */ function fromLocation($src, &$photos) { - /*if (!allow_album_location) { - return $this->error(_("Fixed album location is not allowed. Please specify parameter src.")); - }*/ //FIXME! if (!IsSafeURL($src)) { return $this->error(_("Bad URL in src")); } - $photos[] = array("name" => $src, //album_location."/$src".album_default_extension, - "desc" => ""); + $photos[] = array("name" => $src, "desc" => ""); return ''; } @@ -593,7 +586,7 @@ } foreach ($list as $file) { // convert local path to webpath - $photos[] = array("src" => $file, + $photos[] = array( "name" => $webpath . "/$file", "name_tile" => $src . "/$file", "src" => $src . "/$file", @@ -627,7 +620,7 @@ } } if ($web_location == 0) { - $fp = @fopen($src, "r"); + $fp = fopen($src, "r"); if (!$fp) { return $this->error(fmt("Unable to read src=“%s”", $src)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-12-06 16:13:47
|
Revision: 10737 http://sourceforge.net/p/phpwiki/code/10737 Author: vargenau Date: 2021-12-06 16:13:44 +0000 (Mon, 06 Dec 2021) Log Message: ----------- PhotoAlbum plugin: replace class ImageTile by function image_tile to display tiles Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-12-06 15:33:23 UTC (rev 10736) +++ trunk/lib/plugin/PhotoAlbum.php 2021-12-06 16:13:44 UTC (rev 10737) @@ -62,38 +62,10 @@ * TODO: * - specify picture(s) as parameter(s) * - limit amount of pictures on one page - * - use PHP to really resize or greyscale images (only where GD library supports it) - * (quite done for resize with "ImageTile.php") * - * KNOWN ISSUES: - * - reading height and width from images with spaces in their names fails. - * * Fixed album location idea by Philip J. Hollenback. Thanks! */ -class ImageTile extends HtmlElement -{ - // go away, hack! - static function image_tile( /*...*/) - { - $el = new HTML ('img'); - $tag = func_get_args(); - $path = DATA_PATH . "/ImageTile.php"; - $params = "<img src=\"$path?url=" . $tag[0]['src']; - if (!@empty($tag[0]['width'])) - $params .= "&width=" . $tag[0]['width']; - if (!@empty($tag[0]['height'])) - $params .= "&height=" . $tag[0]['height']; - if (!@empty($tag[0]['width'])) - $params .= '" width="' . $tag[0]['width']; - if (!@empty($tag[0]['height'])) - $params .= '" height="' . $tag[0]['height']; - - $params .= '" alt="' . $tag[0]['alt'] . '" />'; - return $el->raw($params); - } -} - class WikiPlugin_PhotoAlbum extends WikiPlugin { @@ -347,7 +319,7 @@ unset ($params['location'], $params['src_tile']); $url_image = $link ? HTML::a(array("id" => basename($value["name"]), "href" => "$url"), - ImageTile::image_tile($params)) + $this->image_tile($params)) : HTML::img($params); $params = $keep; unset ($keep); @@ -507,7 +479,7 @@ * @param mixed $value Either absolute no. or HTML percentage e.g. '50%' * @return integer New size in pixels */ - function newSize($oldSize, $value) + private function newSize($oldSize, $value) { if (trim(substr($value, strlen($value) - 1)) != "%") { return $value; @@ -524,7 +496,7 @@ * @param array $photos * @return string Error if fixed location is not allowed */ - function fromLocation($src, &$photos) + private function fromLocation($src, &$photos) { //FIXME! if (!IsSafeURL($src)) { @@ -540,10 +512,10 @@ * * @param string $src path to dir or textfile (local or remote) * @param array $photos - * @param string $webpath + * @param string $webpath * @return string Error when bad URL or file couldn't be opened */ - function fromFile($src, &$photos, $webpath = '') + private function fromFile($src, &$photos, $webpath = '') { $src_bak = $src; if (preg_match("/^Upload:(.*)$/", $src, $m)) { @@ -565,7 +537,7 @@ if (string_ends_with($src, "/")) $src = substr($src, 0, -1); } - if (!file_exists($src) + if (!file_exists($src) && defined('PHPWIKI_DIR') && file_exists(PHPWIKI_DIR . "/$src")) { $src = PHPWIKI_DIR . "/$src"; @@ -657,4 +629,16 @@ } return ''; } + + private function image_tile($params) + { + if (array_key_exists('width', $params)) { + return HTML::img(array('src' => '/'.$params['src'], + 'width' => $params['width'], + 'alt' => $params['alt'])); + } else { + return HTML::img(array('src' => '/'.$params['src'], + 'alt' => $params['alt'])); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-12-06 16:54:03
|
Revision: 10738 http://sourceforge.net/p/phpwiki/code/10738 Author: vargenau Date: 2021-12-06 16:54:00 +0000 (Mon, 06 Dec 2021) Log Message: ----------- PhotoAlbum plugin: rawurlencode id in case image name contains a space Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-12-06 16:13:44 UTC (rev 10737) +++ trunk/lib/plugin/PhotoAlbum.php 2021-12-06 16:54:00 UTC (rev 10738) @@ -309,7 +309,7 @@ if ($mode == 'normal' || $mode == 'slide') { if (!@empty($params['location'])) $params['src'] = $params['location']; unset ($params['location'], $params['src_tile']); - $url_image = $link ? HTML::a(array("id" => basename($value["name"]), + $url_image = $link ? HTML::a(array("id" => rawurlencode(basename($value["name"])), "href" => "$url"), HTML::img($params)) : HTML::img($params); } else { @@ -317,7 +317,7 @@ if (!@empty ($params['src_tile'])) $params['src'] = $params['src_tile']; unset ($params['location'], $params['src_tile']); - $url_image = $link ? HTML::a(array("id" => basename($value["name"]), + $url_image = $link ? HTML::a(array("id" => rawurlencode(basename($value["name"])), "href" => "$url"), $this->image_tile($params)) : HTML::img($params); @@ -327,7 +327,7 @@ } else { if (!@empty($params['location'])) $params['src'] = $params['location']; unset ($params['location'], $params['src_tile']); - $url_image = $link ? HTML::a(array("id" => basename($value["name"]), + $url_image = $link ? HTML::a(array("id" => rawurlencode(basename($value["name"])), "href" => "$b_url"), HTML::img($params)) : HTML::img($params); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-12-06 17:04:49
|
Revision: 10739 http://sourceforge.net/p/phpwiki/code/10739 Author: vargenau Date: 2021-12-06 17:04:47 +0000 (Mon, 06 Dec 2021) Log Message: ----------- PhotoAlbum plugin: add random number in id in case plugin is called several times Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-12-06 16:54:00 UTC (rev 10738) +++ trunk/lib/plugin/PhotoAlbum.php 2021-12-06 17:04:47 UTC (rev 10739) @@ -309,7 +309,7 @@ if ($mode == 'normal' || $mode == 'slide') { if (!@empty($params['location'])) $params['src'] = $params['location']; unset ($params['location'], $params['src_tile']); - $url_image = $link ? HTML::a(array("id" => rawurlencode(basename($value["name"])), + $url_image = $link ? HTML::a(array("id" => rawurlencode(basename($value["name"])).'-'.rand(), "href" => "$url"), HTML::img($params)) : HTML::img($params); } else { @@ -317,7 +317,7 @@ if (!@empty ($params['src_tile'])) $params['src'] = $params['src_tile']; unset ($params['location'], $params['src_tile']); - $url_image = $link ? HTML::a(array("id" => rawurlencode(basename($value["name"])), + $url_image = $link ? HTML::a(array("id" => rawurlencode(basename($value["name"])).'-'.rand(), "href" => "$url"), $this->image_tile($params)) : HTML::img($params); @@ -327,7 +327,7 @@ } else { if (!@empty($params['location'])) $params['src'] = $params['location']; unset ($params['location'], $params['src_tile']); - $url_image = $link ? HTML::a(array("id" => rawurlencode(basename($value["name"])), + $url_image = $link ? HTML::a(array("id" => rawurlencode(basename($value["name"])).'-'.rand(), "href" => "$b_url"), HTML::img($params)) : HTML::img($params); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-12-06 17:16:52
|
Revision: 10740 http://sourceforge.net/p/phpwiki/code/10740 Author: vargenau Date: 2021-12-06 17:16:51 +0000 (Mon, 06 Dec 2021) Log Message: ----------- PhotoAlbum plugin: use id instead of name for wikislide Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-12-06 17:04:47 UTC (rev 10739) +++ trunk/lib/plugin/PhotoAlbum.php 2021-12-06 17:16:51 UTC (rev 10740) @@ -208,8 +208,8 @@ i = 0; function display_slides() { j = i - 1; - cell0 = document.getElementsByName('wikislide' + j); - cell = document.getElementsByName('wikislide' + i); + cell0 = document.getElementsById('wikislide' + j); + cell = document.getElementsById('wikislide' + i); if (cell0.item(0) != null) cell0.item(0).style.display='none'; if (cell.item(0) != null) @@ -400,7 +400,7 @@ . 'margin-left: -' . round($newwidth / 2) . 'px;' . 'text-align: center; ' . 'vertical-align: top', - 'name' => "wikislide" . $count); + 'id' => "wikislide" . $count); else $cell = array('style' => 'display: none; ' . 'position: absolute ;' @@ -408,7 +408,7 @@ . 'margin-left: -' . round($newwidth / 2) . 'px;' . 'text-align: center; ' . 'vertical-align: top', - 'name' => "wikislide" . $count); + 'id' => "wikislide" . $count); if ($align == 'left' || $align == 'right') { if ($count == 0) $cell = array('style' => 'display: block; ' @@ -415,13 +415,13 @@ . 'position: absolute; ' . $align . ': 50px; ' . 'vertical-align: top', - 'name' => "wikislide" . $count); + 'id' => "wikislide" . $count); else $cell = array('style' => 'display: none; ' . 'position: absolute; ' . $align . ': 50px; ' . 'vertical-align: top', - 'name' => "wikislide" . $count); + 'id' => "wikislide" . $count); } $row->pushContent( (HTML::td($cell, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-12-07 08:17:22
|
Revision: 10743 http://sourceforge.net/p/phpwiki/code/10743 Author: vargenau Date: 2021-12-07 08:17:20 +0000 (Tue, 07 Dec 2021) Log Message: ----------- Fix Javascript function display_slides Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-12-07 07:58:31 UTC (rev 10742) +++ trunk/lib/plugin/PhotoAlbum.php 2021-12-07 08:17:20 UTC (rev 10743) @@ -208,14 +208,14 @@ i = 0; function display_slides() { j = i - 1; - cell0 = document.getElementsById('wikislide' + j); - cell = document.getElementsById('wikislide' + i); - if (cell0.item(0) != null) - cell0.item(0).style.display='none'; - if (cell.item(0) != null) - cell.item(0).style.display='block'; + cell0 = document.getElementById('wikislide' + j); + cell = document.getElementById('wikislide' + i); + if (cell0 != null) + cell0.style.display='none'; + if (cell != null) + cell.style.display='block'; i += 1; - if (cell.item(0) == null) i = 0; + if (cell == null) i = 0; setTimeout('display_slides()',$duration); } display_slides();")); @@ -396,16 +396,16 @@ if ($count == 0) $cell = array('style' => 'display: block; ' . 'position: absolute; ' - . 'left: 50% ; ' - . 'margin-left: -' . round($newwidth / 2) . 'px;' + . 'left: 50%; ' + . 'margin-left: -' . round($newwidth / 2) . 'px; ' . 'text-align: center; ' . 'vertical-align: top', 'id' => "wikislide" . $count); else $cell = array('style' => 'display: none; ' - . 'position: absolute ;' - . 'left: 50% ;' - . 'margin-left: -' . round($newwidth / 2) . 'px;' + . 'position: absolute; ' + . 'left: 50%; ' + . 'margin-left: -' . round($newwidth / 2) . 'px; ' . 'text-align: center; ' . 'vertical-align: top', 'id' => "wikislide" . $count); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-12-07 14:02:03
|
Revision: 10744 http://sourceforge.net/p/phpwiki/code/10744 Author: vargenau Date: 2021-12-07 14:02:01 +0000 (Tue, 07 Dec 2021) Log Message: ----------- PhotoAlbum plugin: no / in front of URL Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-12-07 08:17:20 UTC (rev 10743) +++ trunk/lib/plugin/PhotoAlbum.php 2021-12-07 14:02:01 UTC (rev 10744) @@ -632,12 +632,17 @@ private function image_tile($params) { + if (IsSafeURL($params['src'], true)) { + $src = $params['src']; + } else { + $src = '/'.$params['src']; + } if (array_key_exists('width', $params)) { - return HTML::img(array('src' => '/'.$params['src'], + return HTML::img(array('src' => $src, 'width' => $params['width'], 'alt' => $params['alt'])); } else { - return HTML::img(array('src' => '/'.$params['src'], + return HTML::img(array('src' => $src, 'alt' => $params['alt'])); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-12-07 14:51:43
|
Revision: 10745 http://sourceforge.net/p/phpwiki/code/10745 Author: vargenau Date: 2021-12-07 14:51:42 +0000 (Tue, 07 Dec 2021) Log Message: ----------- PhotoAlbum plugin: use CSS Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-12-07 14:02:01 UTC (rev 10744) +++ trunk/lib/plugin/PhotoAlbum.php 2021-12-07 14:51:42 UTC (rev 10745) @@ -255,7 +255,10 @@ $size = getimagesize($value["src"]); // try " " => "\\ " $newwidth = $this->newSize($size[0], $width); if ($width != 'auto' && $newwidth > 0) { - $params = array_merge($params, array("width" => $newwidth)); + if (is_numeric($newwidth)) { + $newwidth = $newwidth.'px'; + } + $params = array_merge($params, array("style" => 'width: '.$newwidth)); } if (($mode == 'thumbs' || $mode == 'tiles' || $mode == 'list')) { if (!empty($size[0])) { @@ -287,6 +290,9 @@ } else { $newcellwidth = $cellwidth; } + if (is_numeric($newcellwidth)) { + $newcellwidth = $newcellwidth.'px'; + } $cell = array_merge($cell, array("style" => 'width: '.$newcellwidth)); } if (in_array("nowrap", $attributes)) { @@ -639,7 +645,7 @@ } if (array_key_exists('width', $params)) { return HTML::img(array('src' => $src, - 'width' => $params['width'], + 'style' => 'width: '.$params['width'], 'alt' => $params['alt'])); } else { return HTML::img(array('src' => $src, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-12-07 15:15:15
|
Revision: 10746 http://sourceforge.net/p/phpwiki/code/10746 Author: vargenau Date: 2021-12-07 15:15:12 +0000 (Tue, 07 Dec 2021) Log Message: ----------- PhotoAlbum plugin: avoid nested <a> Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-12-07 14:51:42 UTC (rev 10745) +++ trunk/lib/plugin/PhotoAlbum.php 2021-12-07 15:15:12 UTC (rev 10746) @@ -378,8 +378,7 @@ } elseif ($mode == 'thumbs') { $desc = ($showdesc != 'none') ? - HTML::p(HTML::a(array("href" => "$url"), - $url_text)) : ''; + HTML::p($url_text) : ''; $row->pushContent( (HTML::td($cell, $url_image, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-12-10 20:50:51
|
Revision: 10773 http://sourceforge.net/p/phpwiki/code/10773 Author: vargenau Date: 2021-12-10 20:50:49 +0000 (Fri, 10 Dec 2021) Log Message: ----------- PhotoAlbum plugin: rawurlencode anchor in URL Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2021-12-10 19:59:05 UTC (rev 10772) +++ trunk/lib/plugin/PhotoAlbum.php 2021-12-10 20:50:49 UTC (rev 10773) @@ -304,12 +304,12 @@ $url = WikiURL($request->getPage(), array("p" => basename($value["name"]))) . "#" - . basename($value["name"]); + . rawurlencode(basename($value["name"])); $b_url = WikiURL($request->getPage(), array("h" => basename($value["name"]))) . "#" - . basename($value["name"]); + . rawurlencode(basename($value["name"])); $url_text = $link ? HTML::a(array("href" => "$url"), basename($value["desc"])) : basename($value["name"]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2023-07-18 14:15:49
|
Revision: 11060 http://sourceforge.net/p/phpwiki/code/11060 Author: vargenau Date: 2023-07-18 14:15:47 +0000 (Tue, 18 Jul 2023) Log Message: ----------- lib/plugin/PhotoAlbum.php: force int return type for function newSize Modified Paths: -------------- trunk/lib/plugin/PhotoAlbum.php Modified: trunk/lib/plugin/PhotoAlbum.php =================================================================== --- trunk/lib/plugin/PhotoAlbum.php 2023-07-18 13:56:14 UTC (rev 11059) +++ trunk/lib/plugin/PhotoAlbum.php 2023-07-18 14:15:47 UTC (rev 11060) @@ -520,17 +520,17 @@ * Calculate the new size in pixels when the original size * with a value is given. * - * @param integer $oldSize Absolute no. of pixels + * @param integer $oldSize Absolute no. of pixels * @param mixed $value Either absolute no. or HTML percentage e.g. '50%' - * @return integer New size in pixels + * @return int New size in pixels */ private function newSize(int $oldSize, $value): int { if (trim(substr($value, strlen($value) - 1)) != "%") { - return $value; + return intval($value); } $value = str_replace("%", "", $value); - return round(($oldSize * $value) / 100); + return (int)round(($oldSize * $value) / 100); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |