Habe versucht, Zeilen 137-146 mit deinem Code zu ersetzen.
Code: Select all
<?php
/***********************************************************
============================================================
Gallery Collection Image Album - CMSimple plugin - Commercial version
============================================================
Version: 1.4.0
Copyright: © simpleSolutions 2012
Website: simpleSolutions.dk
License: view file license.txt and https://simpleSolutions.dk
Supported lightboxes: Lightbox version 2.04 and prettyPhoto
Unzip downloaded file and move imgalbum folder to plugin folder of your CMSimple website.
To activate insert #CMSimple $output.= imgalbum('/path/to/your/gallery/folder');# somewhere on your page or in template.
Disclaimer : No warranties at all, use on your own risk !
Requirements : PH5, The Plugin-Loader must be installed and working ! ,
History
version 1.0.0 (Marts. 2012)
version 1.1.0 (Marts 2012)
added random thumbs
added run from template
added function change_table_cols($count); to change a number of colons on a page.
versin 1.1.1 (April 2012)
removed fuction parameters expcept gallery_path
function change_table_cols removed and replaced by function imgalbum_cofig(..))
versin 1.2.0 (September 2012)
added class parameter on function call
bug fix in multilanguage admin
added target on links in image text fields
added textarea styles for plugins alternate styesheet
added class parameter on function call imgalbum($path, $css_class=null)
$plugin_cf['imgalbum']['thumb_random'] replaced by $plugin_cf['imgalbum']['thumb_sort']
added alphabetical sorting by image file names in the galleries, unless randomly selected in plugins configuration.
added option to rename images file names to manipulate alphabetical sorting order.
version 1.2.1
compatibility with CMSimple_XH ver 1.6
version 1.3.0
added integration with cmsimplemobile plugin. Images are resized by cmsimplemobile plugin. On mobile devices, with installed simplesolutions plugin cmsimplemobile, the class parameter (both the defualt (ie imgalbum) and passed to the imgalbum function) is appended the suffix "_mobile".
New lightbox Image Lightbox is used as default on mobile devices
Added config to show or not show description with thumbs, If extrainfo_under_thumbs = false then description is only visble in lightbox
version 1.4.0
php 7 ready
bug fixes
version 1.5.0 (not released)
fixed >/div> bug when no images are found
fixed bug fileupload creates now the watermark defined in configuration.
removed Svarrer gallery compatibility (ie tn_imgName)
CMSimple XH 1.7 ready
remvoed on the fly reconfiguration option due to removed functionality in CMSimpe XH 1.7
***********************************************************/
global $pth, $hjs, $plugin_cf;
//echo "[".$plugin_cf['cmsimplemobile']['lightbox']."]";
$plugin = basename(dirname(__FILE__), "/");
if (stristr($plugin_cf[$plugin]['template'],"true")) { // inititlize plugin header to run from template
if (!function_exists('simplesolutions_gallery')){
include_once($pth['folder']['plugins'].$plugin."/libs/gallery_functions.php");
}
$css_class=$plugin;
$lightbox=$plugin_cf[$plugin]['lightbox'];
if (function_exists('is_mobile_device')) {
if (is_mobile_device()) {
$css_class.="_mobile";
if (trim($lightbox)!="" and trim($plugin_cf['cmsimplemobile']['lightbox'])!="") {
$lightbox=$plugin_cf['cmsimplemobile']['lightbox']; //replace lightbox
}
}
}
imgalbum_scripts('', $css_class ,$plugin_cf['imgalbum']['thumb_effect_mouseover'], $plugin_cf['imgalbum']['thumb_effect_mouseout'], $plugin_cf['imgalbum']['thumb_effect_onload']);
sgallery_load_lightbox($lightbox, $css_class);
}
function imgalbum($path, $css_class=null, $thumb_paginate_thumbs_page=null) {
global $plugin_cf, $plugin_tx, $plugin, $pth, $hjs, $cf;
static $serialno=0;
$plugin = basename(dirname(__FILE__), "/");
$lightbox=$plugin_cf[$plugin]['lightbox'];
$lightbox_group = $plugin.(string) $serialno++;
$thumb_width=intval($plugin_cf[$plugin]['thumb_width']);
$thumb_height=intval($plugin_cf[$plugin]['thumb_height']);
$effect_onload=$plugin_cf['imgalbum']['thumb_effect_onload'];
$effect_mouseover=$plugin_cf['imgalbum']['thumb_effect_mouseover'];
$effect_mouseout=$plugin_cf['imgalbum']['thumb_effect_mouseout'];
$path=trim($path);
$t='<!-- Gallery Collection: Image Album (c) simpleSolutions.dk -->';
if (!is_dir($path)) {
if (!mkdir($path,0777,true)) {
die($plugin_tx[$plugin]['dir_fail']);
}
}
if (!is_dir($path ."/thumb")) {
if (!mkdir($path ."/thumb")) {
$t.='<p class="'.$plugin.'_error_msg">'.$path."/thumb: ".$plugin_tx[$plugin]['thumb_dir_fail'].'</p>';
}
}
if ($css_class==null) {
$css_class=$plugin;
}
if (function_exists('is_mobile_device')) {
if (is_mobile_device()) {
if (trim($plugin_cf[$plugin]['lightbox'])!="" and trim($plugin_cf['cmsimplemobile']['lightbox'])!="") {
$lightbox=$plugin_cf['cmsimplemobile']['lightbox']; //replace lightbox
}
$css_class.="_mobile";
}
}
if (!function_exists('simplesolutions_gallery')){
include_once($pth['folder']['plugins'].$plugin."/libs/gallery_functions.php");
}
$img_array=sgallery_read_images($path);
if (sizeof($img_array)>0) {
$thumb_prefix="tn_";
if (!stristr($plugin_cf[$plugin]['thumb_use_gallery'],"true")) {
$thumb_prefix=$plugin."_";
}
$cols=0;
$t_paginator="";
if (!isset($thumb_paginate_thumbs_page)) {
$thumb_paginate_thumbs_page = $plugin_cf[$plugin]['thumb_paginate_thumbs_page'];
}
if (!stristr($plugin_cf[$plugin]['thumb_paginate'],"true")) {
$thumb_paginate_thumbs_page=sizeof($img_array);
}
require_once $pth['folder']['plugins'].$plugin."/libs/pagination/pagination.php";
$totall_content=sizeof($img_array);
$current_page=(isset($_GET['page']) && is_numeric($_GET['page']))?$_GET['page']:1;
$cat=new pagination($totall_content, intval($thumb_paginate_thumbs_page), $current_page, (ceil($totall_content/intval($thumb_paginate_thumbs_page))+2) );
$t_paginator.=$cat->Show_Pagination(curPageURL(),'page','pagination');
if (stristr($plugin_cf[$plugin]['thumb_paginate_position'],"top") || stristr($plugin_cf[$plugin]['thumb_paginate_position'],"both")) {
$t.=$t_paginator;
}
+ if (stristr($plugin_cf[$plugin]['thumb_sort_order'],"alpha")) {
+ natcasesort($img_array);
+ }
if (intval($thumb_paginate_thumbs_page) >= sizeof($img_array)) {
if (stristr($plugin_cf[$plugin]['thumb_sort_order'],"random")) {
skshuffle($img_array);
- }
+ }
}
$t.='<div class="'.$css_class.'" >';
if (stristr($plugin_cf[$plugin]['thumb_table'],"true")) {
$t.='<table border="0"><tr>';
}
$imgcount=1;
foreach($img_array as $file) {
if ($imgcount>(($current_page-1)*intval($thumb_paginate_thumbs_page)) && ($imgcount<=(($current_page-1)*intval($thumb_paginate_thumbs_page) + intval($thumb_paginate_thumbs_page)))) {
if (stristr($plugin_cf[$plugin]['thumb_table'],"true")) {
$t.='<td class="thumb_container">';
}
else {
$t.='<span class="thumb_container">';
}
if (!file_exists($path.'/thumb/'.$thumb_prefix.$file)) {
sgallery_create_thumb($path,$file,$thumb_prefix, $thumb_width, $thumb_height, $plugin_cf[$plugin]['thumb_crop']);
}
$t.= sgallery_lightbox_code($path, $file, $thumb_prefix, $lightbox, $lightbox_group, null, (stristr($plugin_cf[$plugin]['extrainfo_under_thumbs'],'true')?true:false));
if (stristr($plugin_cf[$plugin]['thumb_table'],"true")) {
$t.='</td>';
}
else {
$t.='</span>';
}
if (++$cols==intval($plugin_cf['imgalbum']['thumb_table_cols'])) {
if (stristr($plugin_cf[$plugin]['thumb_table'],"true")) {
$t.='</tr><tr>';
}
$cols=0;
}
}
$imgcount++;
}
if (stristr($plugin_cf[$plugin]['thumb_table'],"true")) {
for ($in=$cols; ($in<$plugin_cf['imgalbum']['thumb_table_cols']) && ($cols!=0) ;$in++) {
$t.='<td></td>';
}
$t.='</tr></table>';
}
if (stristr($plugin_cf[$plugin]['thumb_paginate_position'],"bottom") || stristr($plugin_cf[$plugin]['thumb_paginate_position'],"both")) {
$t.=$t_paginator;
}
//$t.=$tmp;
if (!stristr($plugin_cf[$plugin]['template'],"true")) {
imgalbum_scripts($path, $css_class, $effect_onload, $effect_mouseover, $effect_mouseout);
sgallery_load_lightbox($lightbox, $css_class);
}
}
else {
$t.='<div><p class="'.$plugin.'_error_msg">'.$plugin_tx[$plugin]['err_no_images'];
}
$t.='</p>';
$t.='</div>';
//DO NOT REMOVE. To hide buy a license at http://simplesolutions.dk/?License
$t.='<p class="'.$plugin.'_credits">CMSimple plugin: Gallery Collection Image Album'.tag('br').'© <a href="http://simplesolutions.dk"><span style="color: #aaa;">simple</span><span style="color:red";>Solutions</span></a></p>';
//DO NOT REMOVE. To hide buy a license at http://simplesolutions.dk
$t.='<!-- Image Album (c) simpleSolutions.dk -->';
return $t;
}
function imgalbum_scripts($path, $css_class, $effect_onload, $effect_mouseover, $effect_mouseout) {
global $hjs, $pth, $cf, $plugin, $plugin_cf, $jQueryPlugins;
include_once($pth['folder']['plugins'].'jquery/jquery.inc.php');
include_jQuery();
include_jQueryUI();
if (file_exists($path.'/css/stylesheet.css') && stristr($plugin_cf[$plugin]['local_stylesheet'],'true')) {
$hjs.=tag('link rel="stylesheet" href="'.$path.'/css/stylesheet.css" type="text/css"');
}
$hjs.='
<script type="text/javascript">
/* <![CDATA[ */
(function($) {
$(document).ready(function() {';
if ($effect_onload!=null && $effect_onload!="") {
$hjs.='
$(".'.$css_class.' .thumb").'.$effect_onload.';';
}
if ($effect_mouseover!=null && $effect_mouseover!="") {
$hjs.='
$(".'.$css_class.' .thumb").mouseover(function(){ $(this).'.$effect_mouseover.'; });';
}
if ($effect_mouseout!=null && $effect_mouseout!="") {
$hjs.='
$(".'.$css_class.' .thumb").mouseout(function(){ $(this).'.$effect_mouseout.'; });';
}
$hjs.='
})
})(jQuery);
/* ]]> */
</script>';
/*
show("explode", { pieces: 16 }, 1000);
effect( "highlight", {color: "#ffffff"}, 1000 );
$(this).animate({ backgroundColor: "black" }, 1000);
$(this).effect("bounce", { times:12 }, 300);
$(".thumb").hide("fade", {}, 1000);
$(".thumb").show("fade", {}, 5000);
*/
}
/*******************************************************
// Change configuration
*******************************************************/
/*
function imgalbum_config($cf, $value) {
global $plugin, $plugin_cf;
$plugin_cf['imgalbum'][$cf]=$value;
return;
}
*/
function curPageURL() {
$pageURL = 'http';
//if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
if ( isset( $_SERVER["HTTPS"] ) && strtolower( $_SERVER["HTTPS"] ) == "on" ) {
$pageURL .= "s";
}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
$pageURL=explode("&page",$pageURL);
return $pageURL[0];
}
?>