getConfig('data.gallery.albums'); g2ic_magic_quotes_remove($_REQUEST); print g2ic_make_html_header(); $g2ic_rel_path = g2ic_get_rel_path(); $g2ic_current_page = g2ic_get_current_page(); list($g2ic_sortby, $g2ic_display_filenames, $g2ic_images_per_page) = g2ic_get_display_options($g2ic_sortby, $g2ic_display_filenames, $g2ic_images_per_page); list($g2ic_dirs_titles,$g2ic_image_files) = g2ic_get_gallery_dirs_and_files(); $g2ic_imginsert_radiobuttons = g2ic_get_imginsert_radiobuttons(); $g2ic_page_navigation = g2ic_make_html_page_navigation(); print g2ic_make_html_dir_menu(); $g2ic_album_url = g2ic_get_album_info($g2ic_rel_path); if ($g2ic_wpg2_valid) print g2ic_make_html_wpg2_album_insert_button(); if ($g2ic_drupal_g2_filter) print g2ic_make_html_drupal_album_insert_button(); if ($g2ic_page_navigation['empty']) print_r($g2ic_page_navigation['empty']); elseif ($g2ic_page_navigation['error']) print_r($g2ic_page_navigation['error']); else { print g2ic_make_html_display_options(); print_r($g2ic_page_navigation['html']); if ($g2ic_click_mode_variable) print g2ic_make_html_click_options($g2ic_click_mode); print g2ic_make_html_image_navigation(); print_r($g2ic_page_navigation['html']); } print g2ic_make_html_about($g2ic_version_text); print "\n\n"; print ""; $_SESSION['g2ic_last_album_visited'] = $g2ic_rel_path; GalleryEmbed::done(); // ====( Functions )======================================= //--------------------------------------------------------------------- // Function: g2ic_get_album_info // Parameters: string $album_path_name // Returns: string $album_url // Purpose: Get info about an album from Gallery2 and parse out the // album URL //--------------------------------------------------------------------- function g2ic_get_album_info($album_path_name) { global $g2ic_wpg2_valid; $href = ''; // Strip off leading slash //$album_path_name = substr_replace($album_path_name,'',0,1); // Strip out %20 and replace with space $album_path_name = str_replace ("%20", " ", $album_path_name); $gallery_block_html = g2ic_imagebypathblock($album_path_name); // Parse out the results preg_match('/href="[^"]*"/',$gallery_block_html,$href); $album_url = preg_replace('/href="/','',$href[0]); $album_url = preg_replace('/"/','',$album_url); return $album_url; } //--------------------------------------------------------------------- // Function: g2ic_get_current_page // Parameters: None // Returns: integer $page // Purpose: If 'g2ic_page' is set by GET, return current page. //--------------------------------------------------------------------- function g2ic_get_current_page(){ if (isset($_REQUEST['g2ic_page']) and is_numeric($_REQUEST['g2ic_page'])) { $page = floor($_REQUEST['g2ic_page']); } else { $page = 1; } return $page; } //--------------------------------------------------------------------- // Function: g2ic_get_display_options // Parameters: $sortby, $display_filenames, $images_per_page // Returns: array($sortby, $display_filenames, $images_per_page) // Purpose: If the display options are set by GET, substitute them for the defaults. //--------------------------------------------------------------------- function g2ic_get_display_options($sortby, $display_filenames, $images_per_page){ if(IsSet($_REQUEST['sortby'])) $sortby = $_REQUEST['sortby']; if(IsSet($_REQUEST['display'])) if ($_REQUEST['display'] == 'filenames') $display_filenames = TRUE; if(IsSet($_REQUEST['images_per_page'])) $images_per_page = $_REQUEST['images_per_page']; return array($sortby, $display_filenames, $images_per_page); } //--------------------------------------------------------------------- // Function: g2ic_get_g2_id_title_by_path // Parameters: string $path // Returns: array ($g2itemid, $g2item_title) // Purpose: Get an item's Gallery2 Title by path. // Die on errors. //--------------------------------------------------------------------- function g2ic_get_g2_id_title_by_path($path){ global $g2ic_lang; list ($ret, $g2itemid) = GalleryCoreAPI::fetchItemIdByPath($path); if (!$ret){ list ($ret, $item) = GalleryCoreApi::loadEntitiesById($g2itemid); if (!$ret) { $g2item_title = $item->getTitle() . "\n"; } else { print $path . $g2ic_lang['g2_entities_by_id_error']; print $ret->getAsHtml() . "\n"; print "\n\n"; print ""; die; } } else { $g2itemid = '***INVALID***'; $g2item_title = '***INVALID***'; } return array($g2itemid, $g2item_title); } //--------------------------------------------------------------------- // Function: g2ic_get_gallery_dirs_and_files // Parameters: None // Returns: $dirs, $files // Purpose: Return files with allowed extension from upload directory. // The filenames are matched against the allowed file extensions. //--------------------------------------------------------------------- function g2ic_get_gallery_dirs_and_files() { GLOBAL $g2ic_rel_path,$g2ic_root_album_path,$g2ic_image_ext_regex,$g2ic_sortby,$g2ic_lang; $image_files = array(); $dirs = array(); $titles = array(); $ids = array(); $current_dir = ''; $file = ''; $title = ''; $name = ''; $file_on_disk = ''; $filenames = array(); $file_times = array(); $file_titles = array(); $file_ids = array(); $dirs_titles = array(); // open current directory if (FALSE === ($current_dir = opendir($g2ic_root_album_path.$g2ic_rel_path))) { print '

' . $g2ic_lang['g2_directory_error'] . '

'; return FALSE; } // Get info on valid directories and files while (FALSE != ($file = readdir($current_dir))) { $file_on_disk = $g2ic_root_album_path.$g2ic_rel_path."$file"; //Reads the DirNames for navigation if(is_dir($file_on_disk)){ if($file != '.' && $file != '..') { list($id, $title) = g2ic_get_g2_id_title_by_path($g2ic_rel_path . $file); if ($title != '***INVALID***') { $dirs[] = $file; $titles[] = $title; } } } if (is_file($file_on_disk) and preg_match($g2ic_image_ext_regex , $file)) { $name = basename($file_on_disk); list($id, $title) = g2ic_get_g2_id_title_by_path($g2ic_rel_path . $name); if ($title != '***INVALID***') { $filenames[] = $name; $file_titles[] = $title; $file_ids[] = $id; if (FALSE !== ($temp = @filemtime($file_on_disk))) $file_times[] = $temp; } } } closedir($current_dir); // Sort directories and files $count_dirs = count($dirs); $count_files = count($filenames); if($count_dirs>0){ array_multisort($titles,$dirs); for($i=0; $i<$count_dirs; $i++) { $dirs_titles[$i] = array('directory'=>$dirs[$i],'title'=>$titles[$i]); } } if($count_files>0){ switch ($g2ic_sortby) { case 'title_asc' : array_multisort($file_titles, $filenames, $file_times, $file_ids); break; case 'title_desc' : array_multisort($file_titles, SORT_DESC, $filenames, SORT_DESC, $file_times, $file_ids); break; case 'name_asc' : array_multisort($filenames, $file_titles, $file_times, $file_ids); break; case 'name_desc' : array_multisort($filenames, SORT_DESC, $file_titles, SORT_DESC, $file_times, $file_ids); break; case 'mtime_asc' : array_multisort($file_times, $file_titles, $filenames, $file_ids); break; case 'mtime_desc' : array_multisort($file_times, SORT_DESC, $file_titles, $filenames, $file_ids); } for($i=0; $i<$count_files; $i++) { $image_files[$i] = array('filename'=>$filenames[$i],'title'=>$file_titles[$i],'id'=>$file_ids[$i]); } } return array($dirs_titles,$image_files); } //--------------------------------------------------------------------- // Function: g2ic_get_img_info // Parameters: string $image_path_name // Returns: array ($thumbnail_src,$thumbnail_width,$thumbnail_height, // $thumbnail_alt_text,$image_url,$gallery_url) // Purpose: Get info about an image from Gallery2 and parse out the // results into the infomation required to generate the HTML //--------------------------------------------------------------------- function g2ic_get_img_info($img_path_name) { global $g2ic_wpg2_valid,$g2ic_rel_path; $src = ''; $href = ''; $width = ''; $height = ''; $alt = ''; // Strip leading slash unless this is the root directory if (strlen($img_path_name) > 1) $img_path_name = substr_replace($img_path_name,'',0,1); // Strip out %20 and replace with space $img_path_name = str_replace ("%20", " ", $img_path_name); $gallery_block_html = g2ic_imagebypathblock($img_path_name); // Parse out the results preg_match('/src="[^"]*"/',$gallery_block_html,$src); preg_match('/href="[^"]*"/',$gallery_block_html,$href); preg_match('/width="[^"]*"/',$gallery_block_html,$width); preg_match('/height="[^"]*"/',$gallery_block_html,$height); preg_match('/alt="[^"]*"/',$gallery_block_html,$alt); $thumbnail_src = preg_replace('/src="/','',$src[0]); $thumbnail_src = preg_replace('/"/','',$thumbnail_src); $thumbnail_width = $width[0]; $thumbnail_height = $height[0]; $thumbnail_alt_text = preg_replace('/alt="/','',$alt[0]); $thumbnail_alt_text = preg_replace('/"/','',$thumbnail_alt_text ); $image_url = preg_replace('/href="/','',$href[0]); $image_url = preg_replace('/"/','',$image_url); return array ($thumbnail_src,$thumbnail_width,$thumbnail_height,$thumbnail_alt_text,$image_url); } //--------------------------------------------------------------------- // Function: g2ic_get_imginsert_radiobuttons // Parameters: None // Returns: array $imginsert_radiobuttons // Purpose: Define the radio buttons for the "How to insert?" dialog //--------------------------------------------------------------------- function g2ic_get_imginsert_radiobuttons(){ GLOBAL $g2ic_wpg2_valid, $g2ic_wpg2id_tags, $g2ic_default_action,$g2ic_lang,$g2ic_drupal_g2_filter; if ($g2ic_wpg2_valid) { if($g2ic_wpg2id_tags) $wpg2_option = 'wpg2id_image'; else $wpg2_option = 'wpg2_image'; $imginsert_radiobuttons = array( $wpg2_option => array( 'text' => $g2ic_lang['wpg2_tag_image'] ), 'thumbnail_image' => array( 'text' => $g2ic_lang['wpg2_thumbnail_image'] ), 'thumbnail_album' => array( 'text' => $g2ic_lang['wpg2_thumbnail_album'] ), 'thumbnail_custom_url' => array( 'text' => $g2ic_lang['wpg2_thumbnail_custom_url'] ), 'thumbnail_only' => array( 'text' => $g2ic_lang['wpg2_thumbnail_only'] ), 'link_image' => array( 'text' => $g2ic_lang['wpg2_link_image'] ), 'link_album' => array( 'text' => $g2ic_lang['wpg2_link_album'] ), ); } else if($g2ic_drupal_g2_filter) { $imginsert_radiobuttons = array( 'drupal_g2_filter' => array( 'text' => $g2ic_lang['drupal_g2_filter'] ), 'thumbnail_image' => array( 'text' => $g2ic_lang['thumbnail_image'] ), 'thumbnail_album' => array( 'text' => $g2ic_lang['thumbnail_album'] ), 'thumbnail_custom_url' => array( 'text' => $g2ic_lang['thumbnail_custom_url'] ), 'thumbnail_only' => array( 'text' => $g2ic_lang['thumbnail_only'] ), 'link_image' => array( 'text' => $g2ic_lang['link_image'] ), 'link_album' => array( 'text' => $g2ic_lang['link_album'] ), ); } else { $imginsert_radiobuttons = array( 'thumbnail_image' => array( 'text' => $g2ic_lang['thumbnail_image'] ), 'thumbnail_album' => array( 'text' => $g2ic_lang['thumbnail_album'] ), 'thumbnail_custom_url' => array( 'text' => $g2ic_lang['thumbnail_custom_url'] ), 'thumbnail_only' => array( 'text' => $g2ic_lang['thumbnail_only'] ), 'link_image' => array( 'text' => $g2ic_lang['link_image'] ), 'link_album' => array( 'text' => $g2ic_lang['link_album'] ), ); } $imginsert_radiobuttons[$g2ic_default_action]['selected'] = TRUE; return $imginsert_radiobuttons; } //--------------------------------------------------------------------- // Function: g2ic_get_rel_path // Parameters: None // Returns: string $path - relative path to current folder // Purpose: If 'rel_path' is set by GET, return a cleaned-up string. //--------------------------------------------------------------------- function g2ic_get_rel_path(){ global $g2ic_last_album, $g2ic_root_album_path; // If GET or POST have 'rel_path' set, use it if(IsSet($_REQUEST['rel_path'])){ $path = str_replace ('..', '',$_REQUEST['rel_path']); } // Else if the $g2ic_last_album_visited is invalid, use the root '/' elseif (FALSE === (is_dir($g2ic_root_album_path.$g2ic_last_album))) { $path = '/'; } // Else use $g2ic_last_album else { $path = $g2ic_last_album; } return $path; } //--------------------------------------------------------------------- // Function: g2ic_imageblock // Parameters: $g2inputid, $g2itemsize=null // Returns: string $img // Purpose: Imageblock Function for Blog Images. // Called by g2ic_imagebypathblock. // This is a native embedded function for use without // WordPress and WPG2. (If WPG2 is present, the plugin // uses the WPG2 g2_imageblock function instead.) //--------------------------------------------------------------------- function g2ic_imageblock( $g2itemid) { global $g2ic_lang; // Build the Image Block $blockoptions['blocks'] = 'specificItem'; $blockoptions['show'] = 'none'; $blockoptions['itemId'] = $g2itemid; list ($ret, $itemimg, $headimg) = GalleryEmbed::getImageBlock($blockoptions); if (!$ret){ $img = $itemimg; // Compact the output $img = preg_replace("/(\s+)?(\<.+\>)(\s+)?/", "$2", $img); GalleryEmbed::done(); } else { print $g2itemid . ' ' . $g2ic_lang['g2_id_not_found_error']; print $ret->getAsHtml() . "\n"; print "\n\n"; print ""; die; // Die if file not found. Should not be able to get to here. } return $img; } //--------------------------------------------------------------------- // Function: g2ic_imagebypathblock // Parameters: $g2inputpath // Returns: $img // Purpose: Include image from gallery based on path // This is a native embedded function for use without // WordPress and WPG2. (If WPG2 is present, the plugin // uses the WPG2 g2_imagebypathblock function instead.) //--------------------------------------------------------------------- function g2ic_imagebypathblock( $g2itempath ) { global $g2ic_embedded_mode, $g2ic_lang; // Make Sure Item Path does not contain a + as it should instead be a space $g2itempath = str_replace ("+", " ", $g2itempath); // Get the Image list ($ret, $g2itemid) = GalleryCoreAPI::fetchItemIdByPath($g2itempath); if (!$ret){ $img = g2ic_imageblock($g2itemid); } else { print $g2ic_lang['g2_id_by_path_error'] . $g2itempath . '
'; print "\n\n"; print ""; $img = $g2ic_lang['invalid_image']; } return $img; } //--------------------------------------------------------------------- // Function: g2ic_magic_quotes_remove // Parameters: array &$array POST or GET with magic quotes // Returns: None // Purpose: Remove magic Quotes //--------------------------------------------------------------------- function g2ic_magic_quotes_remove(&$array) { if(!get_magic_quotes_gpc()) return; foreach($array as $key => $elem) { if(is_array($elem)) g2ic_magic_quotes_remove($elem); else $array[$key] = stripslashes($elem); } } //--------------------------------------------------------------------- // Function: g2ic_make_html_about // Parameters: $version // Returns: string $html // Purpose: Creates the "About" alert HTML //--------------------------------------------------------------------- function g2ic_make_html_about($version){ global $g2ic_lang; $html = '
' . "\n" . ' ' . "\n" . '
' . "\n"; return $html; } //--------------------------------------------------------------------- // Function: g2ic_make_html_alignment_select // Parameters: None // Returns: string $html // Purpose: Creates the alignment selection HTML //--------------------------------------------------------------------- function g2ic_make_html_alignment_select(){ GLOBAL $g2ic_default_alignment, $g2ic_custom_class_1, $g2ic_custom_class_2, $g2ic_custom_class_3, $g2ic_custom_class_4, $g2ic_lang; // array for output $align_options = array('none' => array('text' => $g2ic_lang['img_none']), 'g2image_normal' => array('text' => $g2ic_lang['img_normal']), 'g2image_float_left' => array('text' => $g2ic_lang['img_float_left']), 'g2image_float_right' => array('text' => $g2ic_lang['img_float_right']), 'g2image_centered' => array('text' => $g2ic_lang['img_centered'])); if ($g2ic_custom_class_1 != 'not_used'){ $align_options = array_merge($align_options, array($g2ic_custom_class_1 => array('text' => $g2ic_custom_class_1))); } if ($g2ic_custom_class_2 != 'not_used'){ $align_options = array_merge($align_options, array($g2ic_custom_class_2 => array('text' => $g2ic_custom_class_2))); } if ($g2ic_custom_class_3 != 'not_used'){ $align_options = array_merge($align_options, array($g2ic_custom_class_3 => array('text' => $g2ic_custom_class_3))); } if ($g2ic_custom_class_4 != 'not_used'){ $align_options = array_merge($align_options, array($g2ic_custom_class_4 => array('text' => $g2ic_custom_class_4))); } $align_options[$g2ic_default_alignment]['selected'] = TRUE; $html = g2ic_make_html_select('alignment',$align_options); return $html; } //--------------------------------------------------------------------- // Function: g2ic_make_html_click_options // Parameters: $click_mode // Returns: string $html // Purpose: Creates the click options HTML //--------------------------------------------------------------------- function g2ic_make_html_click_options($click_mode){ global $g2ic_lang; $html = "
\n" . "
\n" . ' ' . $g2ic_lang['click_options'] . '' . "\n"; $html .= ' ' . $g2ic_lang['click_one_click'] . '' . "\n"; $html .= ' ' . $g2ic_lang['click_advanced'] . '' . "\n"; $html .= "
\n" . "
\n\n"; return $html; } //--------------------------------------------------------------------- // Function: g2ic_make_html_dir_menu // Parameters: None // Returns: string $html // Purpose: Creates the directory navigation HTML //--------------------------------------------------------------------- function g2ic_make_html_dir_menu(){ global $g2ic_rel_path, $g2ic_dirs_titles, $g2ic_sortby, $g2ic_display_filenames, $g2ic_images_per_page,$g2ic_lang; $html = "
\n" . "
\n" . ' ' . $g2ic_lang['current_album'] . '' . "\n" . ' ' . $root_title . '/' . "\n"; $tok = strtok ($g2ic_rel_path,"/"); $rel_path_tok = "/$tok/"; while ($tok) { $html .= ' ' . $dir_title . '/' . "\n"; $tok = strtok ("/"); $rel_path_tok .= "{$tok}/"; } $html.= "
\n"; // Subdirectory navigation if ($g2ic_dirs_titles != null) { $html .= '
' . "\n" . ' ' . $g2ic_lang['subalbums'] . '' . "\n" . '
' . "\n" . ' \n" . ' ' . "\n" . '
' . "\n" . '
' . "\n"; } $html .= '
' . "\n\n"; return $html; } //--------------------------------------------------------------------- // Function: g2ic_make_html_display_options // Parameters: None // Returns: string $html // Purpose: Make the HTML for the Sort Selector //--------------------------------------------------------------------- function g2ic_make_html_display_options(){ global $g2ic_sortby,$g2ic_rel_path,$g2ic_images_per_page,$g2ic_display_filenames,$g2ic_lang; $images_per_page_options = array(10,20,30,40,50,60); if (!in_array($g2ic_images_per_page,$images_per_page_options)){ array_push($images_per_page_options,$g2ic_images_per_page); sort($images_per_page_options); } // array for output $sortoptions = array('title_asc' => array('text' => $g2ic_lang['title_a_to_z']), 'title_desc' => array('text' => $g2ic_lang['title_z_to_a']), 'name_asc' => array('text' => $g2ic_lang['name_a_to_z']), 'name_desc' => array('text' => $g2ic_lang['name_z_to_a']), 'mtime_desc' => array('text' => $g2ic_lang['last_modification_new']), 'mtime_asc' => array('text' => $g2ic_lang['last_modification_old'])); $sortoptions[$g2ic_sortby]['selected'] = TRUE; $html = "
\n" . "
\n" . ' ' . $g2ic_lang['display_legend'] . '' . "\n" . '
' . "\n" . ' ' . "\n" . ' ' . $g2ic_lang['sorted_by'] . "\n" . g2ic_make_html_select('sortby',$sortoptions) . ' ' . $g2ic_lang['thumbnails_per_page'] . "\n" . ' \n" . '
' . "\n"; $html .= ' ' . $g2ic_lang['thumbnails'] . '' . "\n"; $html .= ' ' . $g2ic_lang['filenames'] . '' . "\n"; $html .= "
\n" . "
\n" . "
\n\n"; return $html; } //--------------------------------------------------------------------- // Function: g2ic_make_html_drupal_album_insert_button // Parameters: None // Returns: string $html // Purpose: Create the HTML for Drupal G2 Filter album insertion //--------------------------------------------------------------------- function g2ic_make_html_drupal_album_insert_button(){ GLOBAL $g2ic_rel_path, $g2ic_drupal_g2_filter_prefix, $g2ic_lang, $g2ic_form, $g2ic_field; $html = ''; // Create the form list($album_id, $album_title) = g2ic_get_g2_id_title_by_path($g2ic_rel_path); $html .= "
\n" . "
\n" . ' ' . $g2ic_lang['drupal_album_legend'] . ' ' . $album_title . '' . "\n" . "
\n" // Alignment class select box . ' ' . $g2ic_lang['alignment_class'] . "\n" . g2ic_make_html_alignment_select() // "Insert" button . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . "
\n" . "
\n" . "
\n\n"; return $html; } //--------------------------------------------------------------------- // Function: g2ic_make_html_header // Parameters: None // Returns: string $html - HTML header // Purpose: Make the text for the HTML header //--------------------------------------------------------------------- function g2ic_make_html_header(){ global $g2ic_lang, $g2ic_tinymce; $html = "\n" . "\n" . ' ' . $g2ic_lang['title'] . '' . "\n" . " \n" . " \n"; if($g2ic_tinymce) { $html .= " \n"; } $html .= " \n" . "\n\n" . "\n\n"; return $html; } //--------------------------------------------------------------------- // Function: g2ic_make_html_image_navigation // Parameters: None // Returns: string $html // Purpose: Create the HTML for image navigation/selection //--------------------------------------------------------------------- function g2ic_make_html_image_navigation(){ global $g2ic_image_files,$g2ic_current_page,$g2ic_images_per_page, $g2ic_imginsert_radiobuttons,$g2ic_rel_path,$g2ic_sortby, $g2ic_g2thumbnail_src,$g2ic_thumbnail_width,$g2ic_thumbnail_height, $g2ic_thumbnail_alt_text,$g2ic_image_url,$g2ic_album_url,$g2ic_custom_url, $g2ic_display_filenames, $g2ic_class_mode,$g2ic_lang,$g2ic_form,$g2ic_field, $g2ic_drupal_g2_filter_prefix; reset($g2ic_image_files); $html = ''; foreach($g2ic_image_files as $key => $row) { $image_filename = $row['filename']; $image_title = $row['title']; $image_id = $row['id']; if (!(($g2ic_current_page-1)*$g2ic_images_per_page <= $key)) // Haven't gotten there yet continue; else if (!($key < $g2ic_current_page*$g2ic_images_per_page)) break; // Have gone past the range for this page $album_name = substr_replace($g2ic_rel_path,'',0,1); if ($g2ic_display_filenames) $html .= '
' . "\n"; else $html .= '
' . "\n"; $html .= g2ic_make_html_img($image_filename) . "\n"; if ($g2ic_display_filenames) $html .= '
' . "\n"; else $html .= '
' . "\n"; $html .= ' ' . $g2ic_lang['image_title'] . htmlspecialchars($image_title) . "
\n"; $html .= ' ' . $g2ic_lang['filename'] . htmlspecialchars($image_filename) . "\n"; $html .= "
\n\n"; if ($g2ic_display_filenames) $html .= "
\n"; else $html .= "
\n"; $html .= "
\n\n"; $imgdesc = $g2ic_thumbnail_alt_text; // Create the hidden input area (appears when image is clicked) $html .= "
\n\n" // "How to insert:" radio buttons . "
\n" . ' ' . $g2ic_lang['how_insert'] . '' . "\n" . g2ic_make_html_radiobuttons('imginsert', $g2ic_imginsert_radiobuttons) // hidden fields . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . "
\n\n" // "Insert" button . "
\n" . ' ' . $g2ic_lang['insert_legend'] . '' . "\n" . " ' . "\n" . "
\n\n" // Alignment selection . "
\n" . ' ' . $g2ic_lang['alignment_legend'] . '' . "\n" . g2ic_make_html_alignment_select() . "
\n\n" // "Custom URL" text box . "
\n" . ' ' . $g2ic_lang['custom_url'] . '' . "\n" . ' ' . "\n" . " \n" . "
\n\n" // "Description" text box . "
\n" . ' ' . $g2ic_lang['description_legend'] . '' . "\n" . ' ' . "\n" . " \n" . "
\n\n" . "
\n" . "
\n\n"; } return $html; } //--------------------------------------------------------------------- // Function: g2ic_make_html_img // Parameters: $image - Filename // Returns: string $html // Purpose: Make html snippet for an image //--------------------------------------------------------------------- function g2ic_make_html_img($image) { global $g2ic_rel_path,$g2ic_g2thumbnail_src,$g2ic_thumbnail_width,$g2ic_thumbnail_height, $g2ic_thumbnail_alt_text,$g2ic_image_url, $g2ic_click_mode; $html = ''; $filename = $g2ic_rel_path.rawurlencode($image); // Determine $g2ic_img_html and $g2ic_link_html list ($g2ic_g2thumbnail_src,$g2ic_thumbnail_width,$g2ic_thumbnail_height, $g2ic_thumbnail_alt_text,$g2ic_image_url) = g2ic_get_img_info($filename); // ---- image code $html .= " ".$g2ic_thumbnail_alt_text."

' . "\n\n"; $page_navigation['empty'] = $html; return $page_navigation; } // ---- navigation for pages of images $pages = ceil(count($g2ic_image_files)/$g2ic_images_per_page); if ($g2ic_current_page > $pages) $g2ic_current_page = $pages; $pagelinks = array(); for ($count = 1; $count <= $pages; $count++) { if ($g2ic_current_page == $count) { $pagelinks[] = " $count"; } else { $html = " 1) { $html = "
\n" . "
\n" . ' ' . $g2ic_lang['page_navigation'] . '' . "\n" . ' ' . $g2ic_lang['page'] . ' '. "\n" . implode(" - \n", $pagelinks) . "\n" . "
\n" . "
\n\n"; } else { $html = ""; } $page_navigation['html'] = $html; return $page_navigation; } //--------------------------------------------------------------------- // Function: g2ic_make_html_radiobuttons // Parameters: $name,$options // Returns: string $html // Purpose: Make html for set of radio buttons //--------------------------------------------------------------------- function g2ic_make_html_radiobuttons($name,$options) { $elements = array(); foreach ($options as $value => $option) { $html = " \n",$elements) . "\n"; return $html; } //--------------------------------------------------------------------- // Function: g2ic_make_html_select // Parameters: $name,$options // Returns: string $html // Purpose: Make html for select element // Notes: The hash $options should contain values and Description: // array( // 'value' => array( // text => 'Description', // selected => (TRUE|FALSE), // ), // ... // ) //--------------------------------------------------------------------- function g2ic_make_html_select($name,$options) { $html = " \n" . " \n"; if($g2ic_wpg2id_tags){ $html .= " \n" . " \n"; } else { $html .= " \n" . " \n"; } $html .= " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . " \n" . "
\n\n"; return $html; } ?>