'gallery', 'title' => 'Fisheye Gallery', 'description' => KernelTools::tra( "Display a list of images in other content. This plugin only works with files that have been uploaded using fisheye." ), 'help_page' => 'DataPluginGallery', 'auto_activate' => false, 'requires_pair' => false, 'syntax' => '{gallery id= }', 'plugin_type' => DATA_PLUGIN, // display icon in quicktags bar 'booticon' => '{biticon ipackage="icons" iname="image-x-generic" iexplain="Image"}', 'taginsert' => '{gallery id= size= nolink=}', // functions 'help_function' => 'data_gallery_help', 'load_function' => 'data_gallery', ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAGALLERY, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAGALLERY ); function data_gallery( $pData, $pParams ) { global $gBitSystem, $gBitSmarty; $ret = ' '; $imgStyle = ''; $wrapper = \Bitweaver\Liberty\liberty_plugins_wrapper_style( $pParams ); $description = !isset( $wrapper['description'] ) ? $wrapper['description'] : null; foreach( $pParams as $key => $value ) { if( !empty( $value ) ) { switch( $key ) { // rename a couple of parameters case 'width': case 'height': if( preg_match( "/^\d+(em|px|%|pt)$/", trim( $value ) ) ) { $imgStyle .= $key.':'.$value.';'; } elseif( preg_match( "/^\d+$/", $value ) ) { $imgStyle .= $key.':'.$value.'px;'; } // remove values from the hash that they don't get used in the div as well $pParams[$key] = null; break; } } } $wrapper = \Bitweaver\Liberty\liberty_plugins_wrapper_style( $pParams ); if( !empty( $pParams['src'] ) ) { $thumbUrl = $pParams['src']; } elseif( BitBase::verifyId( $pParams['id'] ) && $gBitSystem->isPackageActive( 'fisheye' )) { require_once FISHEYE_PKG_CLASS_PATH.'FisheyeImage.php'; $gallery = new FisheyeImage(); $listHash = $pParams; $listHash['size'] = 'small'; $listHash['gallery_id'] = $pParams['id']; $listHash['max_records'] = 3; $listHash['sort_mode'] = 'random'; $images = $gallery->getList( $listHash ); $out = '
'; foreach( $images as $image ) { // insert source url if we need the original file if( !empty( $pParams['size'] ) && $pParams['size'] == 'original' ) { $thumbUrl = $image['source_url']; } elseif( $image['thumbnail_url'] ) { $thumbUrl = $image['thumbnail_url']; } if( empty( $image['$description'] ) ) { $description = !isset( $wrapper['description'] ) ? $wrapper['description'] : $image['title']; } // check if we have a valid thumbnail if( !empty( $thumbUrl )) { // set up image first $ret = ''.  $description.''; if( !empty( $pParams['nolink'] ) ) { } elseif( !empty( $wrapper['link'] ) ) { // if this image is linking to something, wrap the image with the $ret = ''.$ret.''; } elseif ( empty( $pParams['size'] ) || $pParams['size'] != 'original' ) { if ( $image['source_url'] ) { $ret = ''.$ret.''; } } if( !empty( $wrapper['style'] ) || !empty( $class ) || !empty( $wrapper['description'] ) ) { $ret = '<'.$wrapper['wrapper'].' class="'.( !empty( $wrapper['class'] ) ? $wrapper['class'] : "img-responsive" ).'" style="'.$wrapper['style'].'">'.$ret.( !empty( $wrapper['description'] ) ? '
'.$wrapper['description'] : '' ).''; } } else { $ret = KernelTools::tra( "Unknown Gallery" ); } $out .= $ret; } $out .= '
'; } return $out; } function data_gallery_help() { $help = '' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'
' . KernelTools::tra( "Key" ) . '' . KernelTools::tra( "Type" ) . '' . KernelTools::tra( "Comments" ) . '
id' . KernelTools::tra( "numeric") . '
' . KernelTools::tra("(required)") . '
' . KernelTools::tra( "gallery id number of Images to display inline.") . KernelTools::tra( "You can use either content_id or id." ).'
size' . KernelTools::tra( "key-words") . '
' . KernelTools::tra("(optional)") . '
' . KernelTools::tra( "If the File is an image, you can specify the size of the thumbnail displayed. Possible values are:") . ' avatar, small, medium, large, original ' . KernelTools::tra( "(Default = " ) . 'medium)
nolink' . KernelTools::tra( "key-words") . '
' . KernelTools::tra("(optional)") . '
' . KernelTools::tra( "Remove hotlink from element. Used to display fixed copies of an image item.") . '
num' . KernelTools::tra( "key-words") . '
' . KernelTools::tra("(optional)") . '
' . KernelTools::tra( "Number of images to display from the gallery") . KernelTools::tra( "(Default = " ) . '3)
' . KernelTools::tra( "Example: ") . "{gallery id='13' size='small'}"; return $help; }