public function slideshow($galleryID, $type) { if (!$galleryID) { return ""; } $fade = $type == "widget" ? 'data-fade="enabled"' : ""; $picturelist = nggdb::get_gallery($galleryID, $this->options['galSort'], $this->options['galSortDir']); $html = '<div class="sliderWrap"><div class="slider" data-delay="3" data-pause="enabled" ' . $fade . '>'; $blank = PE_THEME_URL . "/img/blank.png"; $first = true; foreach ($picturelist as $p) { if ($first) { $src = $p->thumbURL; $data = ""; $first = false; } else { $src = $blank; $data = $p->thumbURL; } $html .= <<<EOL <a data-target="prettyphoto" href="{$p->imageURL}" title="{$p->title}"><img src="{$src}" data-src="{$data}" alt="{$p->title}"/></a> EOL; } $html .= "</div></div>"; return $html; }
/** * Get the XML <rss> node corresponding to a gallery * * @param $gallery (object) The gallery to include in RSS * @param $prev_gallery (object) The previous gallery to link in RSS (null if none) * @param $next_gallery (object) The next gallery to link in RSS (null if none) */ function get_gallery_mrss($gallery, $prev_gallery = null, $next_gallery = null) { $ngg_options = nggGallery::get_option('ngg_options'); //Set sort order value, if not used (upgrade issue) $ngg_options['galSort'] = $ngg_options['galSort'] ? $ngg_options['galSort'] : 'pid'; $ngg_options['galSortDir'] = $ngg_options['galSortDir'] == 'DESC' ? 'DESC' : 'ASC'; $title = stripslashes(M_I18N::translate($gallery->title)); $description = stripslashes(M_I18N::translate($gallery->galdesc)); $link = nggMediaRss::get_permalink($gallery->pageid); $prev_link = $prev_gallery != null ? nggMediaRss::get_gallery_mrss_url($prev_gallery->gid, true) : ''; $next_link = $next_gallery != null ? nggMediaRss::get_gallery_mrss_url($next_gallery->gid, true) : ''; $images = nggdb::get_gallery($gallery->gid, $ngg_options['galSort'], $ngg_options['galSortDir']); return nggMediaRss::get_mrss_root_node($title, $description, $link, $prev_link, $next_link, $images); }
/** * nggShowImageBrowser() * * @access public * @param int|string $galleryID or gallery name * @param string $template (optional) name for a template file, look for imagebrowser-$template * @return the content */ function nggShowImageBrowser($galleryID, $template = '') { global $wpdb; $ngg_options = nggGallery::get_option('ngg_options'); //Set sort order value, if not used (upgrade issue) $ngg_options['galSort'] = $ngg_options['galSort'] ? $ngg_options['galSort'] : 'pid'; $ngg_options['galSortDir'] = $ngg_options['galSortDir'] == 'DESC' ? 'DESC' : 'ASC'; // get the pictures $picturelist = nggdb::get_gallery($galleryID, $ngg_options['galSort'], $ngg_options['galSortDir']); if (is_array($picturelist)) { $out = nggCreateImageBrowser($picturelist, $template); } else { $out = __('[Gallery not found]', 'nggallery'); } $out = apply_filters('ngg_show_imagebrowser_content', $out, $galleryID); return $out; }
/** * Parse the gallery/imagebrowser/slideshow shortcode and return all images into an array * * @param string $atts * @return */ function add_gallery($atts) { global $wpdb; extract(shortcode_atts(array('id' => 0), $atts)); // backward compat for user which uses the name instead, still deprecated if (!is_numeric($id)) { $id = $wpdb->get_var($wpdb->prepare("SELECT gid FROM {$wpdb->nggallery} WHERE name = '%s' ", $id)); } $images = nggdb::get_gallery($id, 'pid', 'ASC', true, 1000); foreach ($images as $image) { $src = $image->imageURL; $newimage = array(); if (!empty($image->title)) { $newimage['title'] = $image->title; } if (!empty($image->alttext)) { $newimage['alt'] = $image->alttext; } $this->images[$src] = $newimage; } return; }
function getNGGalleryImages($ngGalleries, $ngImages, $dt, $lat, $lon, $dtoffset, &$error) { $result = array(); $galids = explode(',', $ngGalleries); $imgids = explode(',', $ngImages); if (!isNGGalleryActive()) { return ''; } try { $pictures = array(); foreach ($galids as $g) { $pictures = array_merge($pictures, nggdb::get_gallery($g)); } foreach ($imgids as $i) { array_push($pictures, nggdb::find_image($i)); } foreach ($pictures as $p) { $item = array(); $item["data"] = $p->thumbHTML; if (is_callable('exif_read_data')) { $exif = @exif_read_data($p->imagePath); if ($exif !== false) { $item["lon"] = getExifGps($exif["GPSLongitude"], $exif['GPSLongitudeRef']); $item["lat"] = getExifGps($exif["GPSLatitude"], $exif['GPSLatitudeRef']); if ($item["lat"] != 0 || $item["lon"] != 0) { $result[] = $item; } else { if (isset($p->imagedate)) { $_dt = strtotime($p->imagedate) + $dtoffset; $_item = findItemCoordinate($_dt, $dt, $lat, $lon); if ($_item != null) { $item["lat"] = $_item["lat"]; $item["lon"] = $_item["lon"]; $result[] = $item; } } } } } else { $error .= "Sorry, <a href='http://php.net/manual/en/function.exif-read-data.php' target='_blank' >exif_read_data</a> function not found! check your hosting..<br />"; } } /* START FIX NEXT GEN GALLERY 2.x */ if (class_exists("C_Component_Registry")) { $renderer = C_Component_Registry::get_instance()->get_utility('I_Displayed_Gallery_Renderer'); $params['gallery_ids'] = $ngGalleries; $params['image_ids'] = $ngImages; $params['display_type'] = NEXTGEN_GALLERY_BASIC_THUMBNAILS; $params['images_per_page'] = 999; // also add js references to get the gallery working $dummy = $renderer->display_images($params, $inner_content); /* START FIX NEXT GEN GALLERY PRO */ if (preg_match("/data-nplmodal-gallery-id=[\"'](.*?)[\"']/", $dummy, $m)) { $galid = $m[1]; if ($galid) { for ($i = 0; $i < count($result); ++$i) { $result[$i]["data"] = str_replace("%PRO_LIGHTBOX_GALLERY_ID%", $galid, $result[$i]["data"]); } } } /* END FIX NEXT GEN GALLERY PRO */ } /* END FIX NEXT GEN GALLERY 2.x */ } catch (Exception $e) { $error .= 'Error When Retrieving NextGen Gallery galleries/images: $e <br />'; } return $result; }
/** * nggShowGallery() - return a gallery * * @access public * @param int $galleryID * @param string $template (optional) name for a template file, look for gallery-$template * @param int $images (optional) number of images per page * @return the content */ function nggShowGallery($galleryID, $template = '', $images = false) { global $nggRewrite; $ngg_options = nggGallery::get_option('ngg_options'); $galleryID = (int) $galleryID; //Set sort order value, if not used (upgrade issue) $ngg_options['galSort'] = $ngg_options['galSort'] ? $ngg_options['galSort'] : 'pid'; $ngg_options['galSortDir'] = $ngg_options['galSortDir'] == 'DESC' ? 'DESC' : 'ASC'; // get gallery values $picturelist = nggdb::get_gallery($galleryID, $ngg_options['galSort'], $ngg_options['galSortDir']); if (!$picturelist) { return __('[Gallery not found]', 'nggallery'); } // $_GET from wp_query $show = get_query_var('show'); $pid = get_query_var('pid'); $pageid = get_query_var('pageid'); // set $show if slideshow first if (empty($show) and $ngg_options['galShowOrder'] == 'slide') { if (is_home()) { $pageid = get_the_ID(); } $show = 'slide'; } // go on only on this page if (!is_home() || $pageid == get_the_ID()) { // 1st look for ImageBrowser link if (!empty($pid) && $ngg_options['galImgBrowser'] && $template != 'carousel') { $out = nggShowImageBrowser($galleryID, $template); return $out; } // 2nd look for slideshow if ($show == 'slide') { $args['show'] = "gallery"; $out = '<div class="ngg-galleryoverview">'; $out .= '<div class="slideshowlink"><a class="slideshowlink" href="' . $nggRewrite->get_permalink($args) . '">' . nggGallery::i18n($ngg_options['galTextGallery']) . '</a></div>'; $out .= nggShowSlideshow($galleryID, $ngg_options['irWidth'], $ngg_options['irHeight']); $out .= '</div>' . "\n"; $out .= '<div class="ngg-clear"></div>' . "\n"; return $out; } } // get all picture with this galleryid if (is_array($picturelist)) { $out = nggCreateGallery($picturelist, $galleryID, $template, $images); } $out = apply_filters('ngg_show_gallery_content', $out, intval($galleryID)); return $out; }
public static function images_from_ngg_gallery($nggGallery_ID) { if (method_exists('nggdb', 'get_gallery')) { // if NextGen is installed and the function get_gallery exists $options = get_option('wp-supersized_options'); if ($options['background_url']) { $full_background_url = "http://" . $options['background_url']; } else { $full_background_url = ''; } $full_output = ''; $imagesList = nggdb::get_gallery($nggGallery_ID, 'sortorder', 'ASC'); // calls the NextGen Gallery function to retrieve the content of the NextGen gallery with ID $nggGallery_ID. Images are sorted in ascending order of Sort Order. if ($imagesList) { // if there are images in the gallery global $totalSlides; $totalSlides = count($imagesList); foreach ($imagesList as $image) { $ngggallery_url = $image->imageURL; // full link to the full size image $ngggallery_thumburl = $image->thumbURL; // full link to the thumbnail $ngggallery_title = $image->alttext; // image title $ngggallery_caption = $image->description; // image caption if ($ngggallery_caption == '') { $ngggallery_caption = $ngggallery_title; } // if there is no caption, use title instead $full_output = $full_output . "\n{image : '" . $ngggallery_url . "', title : '" . $ngggallery_caption . "', thumb : '" . $ngggallery_thumburl . "', url : '" . $full_background_url . "'},"; } $full_output = substr($full_output, 0, -1) . "\n"; // removes the trailing comma to avoid trouble in IE echo $full_output; } else { self::output_error_image('nextgen-gallery_images_not_present'); } // if the requested NextGEN Gallery images are not present, display error image } }
/** * nggAdmin::import_gallery() * TODO: Check permission of existing thumb folder & images * since 1.9.19: sanitize existing folders and images - see old_import_gallery() to use the old system * * @class nggAdmin * @param string $galleryfolder contains relative path to the gallery itself * @return void */ static function import_gallery($galleryfolder) { global $wpdb, $user_ID; // get the current user ID get_currentuserinfo(); $created_msg = NULL; // remove trailing slash at the end, if somebody use it $galleryfolder = untrailingslashit($galleryfolder); $gallerypath = WINABSPATH . $galleryfolder; if (!is_dir($gallerypath)) { nggGallery::show_error(__('Directory', 'nggallery') . ' <strong>' . esc_html($gallerypath) . '</strong> ' . __('doesn`t exist!', 'nggallery')); return; } $test_images = nggAdmin::scandir($gallerypath); if (empty($test_images)) { nggGallery::show_message(__('Directory', 'nggallery') . ' <strong>' . esc_html($gallerypath) . '</strong> ' . __('contains no pictures', 'nggallery')); return; } //save orginals $old_galleryfolder = $galleryfolder; $old_gallerypath = $gallerypath; //sanitize name $new_name = sanitize_file_name(sanitize_title(basename($galleryfolder))); //set new names $galleryfolder = dirname($galleryfolder) . "/" . sanitize_file_name(sanitize_title(basename($galleryfolder))); $gallerypath = WINABSPATH . $galleryfolder; //rename existing folder if (!($old_galleryfolder == $galleryfolder)) { //check if it exists $increment = ''; //start with no suffix while (file_exists($gallerypath . $increment)) { $increment++; } $galleryfolder = dirname($galleryfolder) . "/" . basename($galleryfolder) . $increment; $gallerypath = WINABSPATH . $galleryfolder; if (!rename($old_gallerypath, $gallerypath)) { nggGallery::show_message(__('Something went wrong when renaming', 'nggallery') . ' <strong>' . esc_html($old_galleryfolder) . '</strong>! ' . __('Importing was aborted.', 'nggallery')); } } // check & create thumbnail folder if (!nggGallery::get_thumbnail_folder($gallerypath)) { return; } // take folder name as gallery name $galleryname = basename($galleryfolder); $galleryname = apply_filters('ngg_gallery_name', $galleryname); // check for existing gallery folder $gallery_id = $wpdb->get_var("SELECT gid FROM {$wpdb->nggallery} WHERE path = '{$old_galleryfolder}' "); if (!$gallery_id) { // now add the gallery to the database $gallery_id = nggdb::add_gallery($galleryname, $galleryfolder, '', 0, 0, $user_ID); if (!$gallery_id) { nggGallery::show_error(__('Database error. Could not add gallery!', 'nggallery')); return; } $created_msg = __('Gallery', 'nggallery') . ' <strong>' . esc_html($galleryname) . '</strong> ' . __('successfully created!', 'nggallery') . '<br />'; } else { //if the gallery path has changed, update the database if (!($old_galleryfolder == $galleryfolder)) { $wpdb->query($wpdb->prepare("UPDATE {$wpdb->nggallery} SET path= '%s' WHERE gid = %d", $galleryfolder, $gallery_id)); } } // Look for existing image list and sanitize file names before scanning for new images $db_images = nggdb::get_gallery($gallery_id); $updated = array(); foreach ($db_images as $image) { //save old values $old_name = $image->filename; $old_path = $gallerypath . '/' . $old_name; //get new name $filepart = nggGallery::fileinfo($old_name); //only rename if necessary if (!($old_name == $filepart['basename'])) { //check if the sanitized name already exists $increment = ''; //start with no suffix while (file_exists($gallerypath . '/' . $filepart['filename'] . $increment . '.' . $filepart['extension'])) { $increment++; } //define new values $name = $filepart['filename'] . $increment . '.' . $filepart['extension']; $new_path = $gallerypath . "/" . $name; //rename the file and update alttext rename($old_path, $new_path); $alttext = sanitize_file_name($image->alttext); // update the database nggdb::update_image($image->pid, false, $name, false, $alttext); $updated[] = $image->pid; } } // read list of images $new_imageslist = nggAdmin::scandir($gallerypath); $old_imageslist = $wpdb->get_col("SELECT filename FROM {$wpdb->nggpictures} WHERE galleryid = '{$gallery_id}' "); // if no images are there, create empty array if ($old_imageslist == NULL) { $old_imageslist = array(); } // check difference $new_images = array_diff($new_imageslist, $old_imageslist); // all images must be valid files foreach ($new_images as $key => $picture) { //rename images with the cleaned filename $old_path = $gallerypath . '/' . $picture; $filepart = nggGallery::fileinfo($picture); //define new values $picture = $filepart['basename']; $new_path = $gallerypath . "/" . $picture; rename($old_path, $new_path); // filter function to rename/change/modify image before $picture = apply_filters('ngg_pre_add_new_image', $picture, $gallery_id); $new_images[$key] = $picture; if (!@getimagesize($gallerypath . '/' . $picture)) { unset($new_images[$key]); @unlink($gallerypath . '/' . $picture); } } // add images to database $image_ids = nggAdmin::add_Images($gallery_id, $new_images); //add the preview image if needed nggAdmin::set_gallery_preview($gallery_id); // now create thumbnails nggAdmin::do_ajax_operation('create_thumbnail', array_merge($image_ids, $updated), __('Create new thumbnails', 'nggallery')); //TODO:Message will not shown, because AJAX routine require more time, message should be passed to AJAX $message = $created_msg; if (count($updated) > 0) { $message .= $c . __(' picture(s) successfully renamed', 'nggallery') . '<br />'; } if (count($image_ids) > 0) { $message .= count($image_ids) . __(' picture(s) successfully added', 'nggallery') . '<br />'; } if ($created_msg) { $message .= ' [<a href="' . admin_url() . 'admin.php?page=nggallery-manage-gallery&mode=edit&gid=' . $gallery_id . '" >'; $message .= __('Edit gallery', 'nggallery'); $message .= '</a>]'; } if (!$message) { $message = __('No images were added.', 'nggallery'); } nggGallery::show_message($message); return; }
function start_process() { global $ngg; if (!$this->valid_access()) { return; } switch ($this->method) { case 'search': //search for some images $this->result['images'] = array_merge((array) nggdb::search_for_images($this->term), (array) nggTags::find_images_for_tags($this->term, 'ASC')); break; case 'album': //search for some album //TODO : Get images for each gallery, could end in a big db query $this->result['album'] = nggdb::find_album($this->id); break; case 'gallery': //search for some gallery $this->result['images'] = $this->id == 0 ? nggdb::find_last_images(0, 100) : nggdb::get_gallery($this->id, $ngg->options['galSort'], $ngg->options['galSortDir'], true, 0, 0, true); break; case 'image': //search for some image $this->result['images'] = nggdb::find_image($this->id); break; case 'tag': //search for images based on tags $this->result['images'] = nggTags::find_images_for_tags($this->term, 'ASC'); break; case 'recent': //search for images based on tags $this->result['images'] = nggdb::find_last_images(0, $this->limit); break; case 'autocomplete': //return images, galleries or albums for autocomplete drop down list return $this->autocomplete(); break; case 'version': $this->result = array('stat' => 'ok', 'version' => $ngg->version); return; break; default: $this->result = array('stat' => 'fail', 'code' => '98', 'message' => 'Method not known.'); return false; break; } // result should be fine $this->result['stat'] = 'ok'; }
/** * Retrieves the image data for a given NextGen Gallery ID * * @param array $dynamic_data Existing Dynamic Data Array * @param int $id NextGen Gallery ID * @param array $data Slider Configuration * @return bool|array Array of data on success, false on failure */ public function get_nextgen_images($dynamic_data, $id, $data) { // Return false if the NextGen database class is not available. if (!class_exists('nggdb')) { return false; } // Get shortcode instance $instance = Soliloquy_Shortcode::get_instance(); // Get NextGen Gallery ID $nextgen_id = explode('-', $id); $id = $nextgen_id[1]; // Get NextGen Gallery Objects $nggdb = new nggdb(); $objects = apply_filters('soliloquy_dynamic_get_nextgen_image_data', $nggdb->get_gallery($id), $id); // Return if no objects found if (!$objects) { return false; } // Build gallery foreach ((array) $objects as $key => $object) { // Depending on the NextGEN version, the structure of the object will vary if (!isset($object->_ngiw)) { // Get path for gallery if (!isset($nextgen_gallery_path)) { global $wpdb; $nextgen_gallery_path = $wpdb->get_row($wpdb->prepare("SELECT path FROM {$wpdb->nggallery} WHERE gid = %d", $id)); } $image = $object->_orig_image; $image_url = get_bloginfo('url') . '/' . $nextgen_gallery_path->path . '/' . str_replace(' ', '%20', $image->filename); } else { $image = $object->_ngiw->_orig_image; $image_url = get_bloginfo('url') . '/' . $image->path . '/' . str_replace(' ', '%20', $image->filename); } // Build image attributes to match Envira Gallery $dynamic_data[$image->pid] = array('src' => $image_url, 'title' => isset($image->alttext) ? strip_tags(esc_attr($image->alttext)) : '', 'link' => '', 'alt' => isset($image->alttext) ? strip_tags(esc_attr($image->alttext)) : '', 'caption' => isset($image->description) ? $image->description : ''); // Set the link property based on $data variable. $link = $instance->get_config('link', $data); if ($link) { if ('file' == $link || 'attachment' == $link) { $dynamic_data[$image->pid]['link'] = isset($image_url) ? esc_url($image_url) : ''; } } } return apply_filters('soliloquy_dynamic_nextgen_images', $dynamic_data, $objects, $id, $data); }
function nggShow_oSlide($args, $id = "", $class = "oSlide") { //aBWpDebug($args); if (!class_exists(nggdb)) { return false; } $return = ""; global $oslideLoaded; if ($oslideLoaded == FALSE) { if (PHP_OS == "Linux") { $oss = "/"; } elseif (PHP_OS == "WIN") { $oss = "\\"; } $url = plugins_url(); $url2 = explode($oss, __FILE__); array_pop($url2); $url2 = array_reverse($url2); $url2 = $url2[0]; $url = $url . $oss . $url2 . $oss; $return .= ' <script type="text/javascript" src="' . $url . 'jquery.oSlide-0.9.3.2.js"></script>' . "\n"; $return .= ' <link rel="stylesheet" type="text/css" href="' . $url . 'oSlide-0.9.3.css" media="screen" /> ' . "\n"; $oslideLoaded = true; } extract($args); if ($id != false) { $id = 'oSlide-' . $id; } else { $id = time(); } switch ($args['animation']) { case 0: $animation = 'slideleft'; break; case 1: $animation = 'slideright'; break; case 2: $animation = 'fade'; break; case 3: $animation = 'crossfade'; break; default: $animation = 'fade'; break; } $images = nggdb::get_gallery($args['galleryid']); $return .= '<div id="' . $id . '" class = "' . $class . '" style="width:' . $args['width'] . '; height:' . $args['height'] . '"> </div>'; $return .= "\n" . '<script type="text/javascript">'; $return .= "\n" . ' var Photos_' . str_replace("-", "_", $id) . '=['; foreach ($images as $image) { $return .= "\n" . '{ "url": "' . $image->imageURL . '" } ,'; } $return = substr($return, 0, -1); $return .= "\n" . ']' . "\n"; // $return.=' // jQuery(document).ready(function($) { // //alert("hola"); // }); // '; $return .= ' jQuery(document).ready(function($){' . "\n"; $return .= ' $("#' . $id . '").oSlide({' . "\n"; $return .= ' enableCaptions:false,' . "\n"; $return .= ' fade_time:' . $args['fadetime'] . ',' . "\n"; $return .= ' sleep:' . $args['sleeptime'] . ',' . "\n"; $return .= ' enableNavigationBar: false,' . "\n"; if ($args['printcontrols'] == true) { $return .= ' enableNavigationControls: true,' . "\n"; } else { $return .= ' enableNavigationControls: false,' . "\n"; } $return .= ' animation:"' . $animation . '",' . "\n"; $return .= ' allowZoom: false,' . "\n"; $return .= ' images: Photos_' . str_replace("-", "_", $id) . ', // an array containing all data to the images' . "\n"; $return .= ' });' . "\n"; $return .= ' }) ' . "\n"; $return .= "\n" . '</script>'; return $return; }
function nggallery_picturelist() { // *** show picture list global $wpdb, $user_ID, $ngg; // GET variables $act_gid = $ngg->manage_page->gid; $showTags = $ngg->manage_page->showTags; $hideThumbs = $ngg->manage_page->hideThumbs; // Load the gallery metadata $gallery = nggdb::find_gallery($act_gid); if (!$gallery) { nggGallery::show_error(__('Gallery not found.', 'nggallery')); return; } // get picture values $picturelist = nggdb::get_gallery($act_gid, $ngg->options['galSort'], $ngg->options['galSortDir'], false); // get the current author $act_author_user = get_userdata((int) $gallery->author); // list all galleries $gallerylist = nggdb::find_all_galleries(); ?> <script type="text/javascript"> function showDialog( windowId ) { var form = document.getElementById('updategallery'); var elementlist = ""; for (i = 0, n = form.elements.length; i < n; i++) { if(form.elements[i].type == "checkbox") { if(form.elements[i].name == "doaction[]") if(form.elements[i].checked == true) if (elementlist == "") elementlist = form.elements[i].value else elementlist += "," + form.elements[i].value ; } } jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val()); jQuery("#" + windowId + "_imagelist").val(elementlist); // console.log (jQuery("#TB_imagelist").val()); tb_show("", "#TB_inline?width=640&height=120&inlineId=" + windowId + "&modal=true", false); } </script> <script type="text/javascript"> <!-- function checkAll(form) { for (i = 0, n = form.elements.length; i < n; i++) { if(form.elements[i].type == "checkbox") { if(form.elements[i].name == "doaction[]") { if(form.elements[i].checked == true) form.elements[i].checked = false; else form.elements[i].checked = true; } } } } function getNumChecked(form) { var num = 0; for (i = 0, n = form.elements.length; i < n; i++) { if(form.elements[i].type == "checkbox") { if(form.elements[i].name == "doaction[]") if(form.elements[i].checked == true) num++; } } return num; } // this function check for a the number of selected images, sumbmit false when no one selected function checkSelected() { var numchecked = getNumChecked(document.getElementById('updategallery')); if(numchecked < 1) { alert('<?php echo js_escape(__("No images selected", 'nggallery')); ?> '); return false; } //TODO: For copy to and move to we need some better way around if (jQuery('#bulkaction').val() == 'copy_to') { showDialog('selectgallery'); return false; } if (jQuery('#bulkaction').val() == 'move_to') { showDialog('selectgallery'); return false; } return confirm('<?php echo sprintf(js_escape(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '"); ?> '); } jQuery(document).ready( function() { // close postboxes that should be closed jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed'); if (typeof postboxes != "undefined") postboxes.add_postbox_toggles('ngg-manage-gallery'); // WP 2.7 else add_postbox_toggles('ngg-manage-gallery'); // WP 2.6 }); //--> </script> <div class="wrap"> <h2><?php echo __ngettext('Gallery', 'Galleries', 1, 'nggallery'); ?> : <?php echo $gallery->title; ?> </h2> <br style="clear: both;" /> <form id="updategallery" class="nggform" method="POST" action="<?php echo $ngg->manage_page->base_page . '&mode=edit&gid=' . $act_gid; ?> " accept-charset="utf-8"> <?php wp_nonce_field('ngg_updategallery'); ?> <?php if ($showTags) { ?> <input type="hidden" name="showTags" value="true" /><?php } if ($hideThumbs) { ?> <input type="hidden" name="hideThumbs" value="true" /><?php } ?> <div id="poststuff"> <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?> <div id="gallerydiv" class="postbox <?php echo postbox_classes('gallerydiv', 'ngg-manage-gallery'); ?> " > <h3><?php _e('Gallery settings', 'nggallery'); ?> <small> (<?php _e('Click here for more settings', 'nggallery'); ?> )</small></h3> <div class="inside"> <table class="form-table" > <tr> <th align="left"><?php _e('Title'); ?> :</th> <th align="left"><input type="text" size="50" name="title" value="<?php echo $gallery->title; ?> " /></th> <th align="right"><?php _e('Page Link to', 'nggallery'); ?> :</th> <th align="left"> <select name="pageid" style="width:95%"> <option value="0" ><?php _e('Not linked', 'nggallery'); ?> </option> <?php parent_dropdown($gallery->pageid); ?> </select> </th> </tr> <tr> <th align="left"><?php _e('Description'); ?> :</th> <th align="left"><textarea name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php echo $gallery->galdesc; ?> </textarea></th> <th align="right"><?php _e('Preview image', 'nggallery'); ?> :</th> <th align="left"> <select name="previewpic" style="width:95%" > <option value="0" ><?php _e('No Picture', 'nggallery'); ?> </option> <?php if (is_array($picturelist)) { foreach ($picturelist as $picture) { $selected = $picture->pid == $gallery->previewpic ? 'selected="selected" ' : ''; echo '<option value="' . $picture->pid . '" ' . $selected . '>' . $picture->pid . ' - ' . $picture->filename . '</option>' . "\n"; } } ?> </select> </th> </tr> <tr> <th align="left"><?php _e('Path', 'nggallery'); ?> :</th> <th align="left"><input <?php if (IS_WPMU) { echo 'readonly = "readonly"'; } ?> type="text" size="50" name="path" value="<?php echo $gallery->path; ?> " /></th> <th align="right"><?php _e('Author', 'nggallery'); ?> :</th> <th align="left"> <?php $editable_ids = $ngg->manage_page->get_editable_user_ids($user_ID); if ($editable_ids && count($editable_ids) > 1) { wp_dropdown_users(array('include' => $editable_ids, 'name' => 'author', 'selected' => empty($gallery->author) ? 0 : $gallery->author)); } else { echo $act_author_user->display_name; } ?> </th> </tr> <tr> <th align="left"> </th> <th align="left"> </th> <th align="right"><?php _e('Create new page', 'nggallery'); ?> :</th> <th align="left"> <select name="parent_id" style="width:95%"> <option value="0"><?php _e('Main page (No parent)', 'nggallery'); ?> </option> <?php parent_dropdown(); ?> </select> <input class="button-secondary action" type="submit" name="addnewpage" value="<?php _e('Add page', 'nggallery'); ?> " id="group"/> </th> </tr> </table> <div class="submit"> <input type="submit" class="button-secondary" name="scanfolder" value="<?php _e("Scan Folder for new images", 'nggallery'); ?> " /> <input type="submit" class="button-primary action" name="updatepictures" value="<?php _e("Save Changes", 'nggallery'); ?> " /> </div> </div> </div> </div> <!-- poststuff --> <div class="tablenav ngg-tablenav"> <div class="alignleft actions" style="float: left;"> <select id="bulkaction" name="bulkaction"> <option value="no_action" ><?php _e("No action", 'nggallery'); ?> </option> <?php if (!$showTags) { ?> <option value="set_watermark" ><?php _e("Set watermark", 'nggallery'); ?> </option> <option value="new_thumbnail" ><?php _e("Create new thumbnails", 'nggallery'); ?> </option> <option value="resize_images" ><?php _e("Resize images", 'nggallery'); ?> </option> <option value="delete_images" ><?php _e("Delete images", 'nggallery'); ?> </option> <option value="import_meta" ><?php _e("Import metadata", 'nggallery'); ?> </option> <option value="copy_to" ><?php _e("Copy to...", 'nggallery'); ?> </option> <option value="move_to"><?php _e("Move to...", 'nggallery'); ?> </option> <?php } else { ?> <option value="add_tags" ><?php _e("Add tags", 'nggallery'); ?> </option> <option value="delete_tags" ><?php _e("Delete tags", 'nggallery'); ?> </option> <option value="overwrite_tags" ><?php _e("Overwrite tags", 'nggallery'); ?> </option> <?php } ?> </select> <?php if (!$showTags) { ?> <input class="button-secondary" type="submit" name="doaction" value="<?php _e("OK", 'nggallery'); ?> " onclick="if ( !checkSelected() ) return false;" /> <?php } else { ?> <input class="button-secondary" type="submit" name="showThickbox" value="<?php _e("OK", 'nggallery'); ?> " onclick="showDialog('tags'); return false;" /> <?php } ?> <?php if (!$hideThumbs) { ?> <input class="button-secondary" type="submit" name="togglethumbs" value="<?php _e("Hide thumbnails ", 'nggallery'); ?> " /> <?php } else { ?> <input class="button-secondary" type="submit" name="togglethumbs" value="<?php _e("Show thumbnails ", 'nggallery'); ?> " /> <?php } ?> <?php if (!$showTags) { ?> <input class="button-secondary" type="submit" name="toggletags" value="<?php _e("Show tags", 'nggallery'); ?> " /> <?php } else { ?> <input class="button-secondary" type="submit" name="toggletags" value="<?php _e("Hide tags", 'nggallery'); ?> " /> <?php } ?> <?php if ($ngg->options['galSort'] == "sortorder") { ?> <input class="button-secondary" type="submit" name="sortGallery" value="<?php _e("Sort gallery", 'nggallery'); ?> " /> <?php } ?> </div> <span style="float:right; padding:2px 8px 0 0;"><input type="submit" name="updatepictures" class="button-primary action" value="<?php _e("Save Changes", 'nggallery'); ?> " /></span> </div> <table id="ngg-listimages" class="widefat" > <thead> <tr> <?php $gallery_columns = ngg_manage_gallery_columns(); ?> <?php foreach ($gallery_columns as $gallery_column_key => $column_display_name) { switch ($gallery_column_key) { case 'cb': $class = ' class="check-column;"'; break; case 'tags': $class = ' style="width:70%;"'; break; case 'action': $class = ' colspan="3" style="text-align: center;"'; break; default: $class = ' style="text-align: center;"'; } ?> <th scope="col"<?php echo $class; ?> ><?php echo $column_display_name; ?> </th> <?php } ?> </tr> </thead> <tfoot> <tr> <?php foreach ($gallery_columns as $gallery_column_key => $column_display_name) { switch ($gallery_column_key) { case 'cb': $class = ' class="check-column;"'; break; case 'tags': $class = ' style="width:70%;"'; break; case 'action': $class = ' colspan="3" style="text-align: center;"'; break; default: $class = ' style="text-align: center;"'; } ?> <th scope="col"<?php echo $class; ?> ><?php echo $column_display_name; ?> </th> <?php } ?> </tr> </tfoot> <tbody> <?php if ($picturelist) { $thumbsize = ""; if ($ngg->options['thumbfix']) { $thumbsize = 'width="' . $ngg->options['thumbwidth'] . '" height="' . $ngg->options['thumbheight'] . '"'; } if ($ngg->options['thumbcrop']) { $thumbsize = 'width="' . $ngg->options['thumbwidth'] . '" height="' . $ngg->options['thumbwidth'] . '"'; } foreach ($picturelist as $picture) { $pid = (int) $picture->pid; $class = $class == 'class="alternate"' ? '' : 'class="alternate"'; $exclude = $picture->exclude ? 'checked="checked"' : ''; $date = mysql2date(get_option('date_format'), $picture->imagedate); $time = mysql2date(get_option('time_format'), $picture->imagedate); ?> <tr id="picture-<?php echo $pid; ?> " <?php echo $class; ?> style="text-align:center"> <?php foreach ($gallery_columns as $gallery_column_key => $column_display_name) { switch ($gallery_column_key) { case 'cb': ?> <td class="check-column" scope="row"><input name="doaction[]" type="checkbox" value="<?php echo $pid; ?> " /></td> <?php break; case 'id': ?> <td class="id column-id" scope="row" style="text-align: center"><?php echo $pid; ?> </td> <?php break; case 'filename': ?> <td class="media-icon" style="text-align: left;"> <a href="<?php echo $picture->imageURL; ?> " class="thickbox" title="<?php echo $picture->filename; ?> "> <?php echo $picture->filename; ?> </a> <br /><?php echo $date; ?> </td> <?php break; case 'thumbnail': ?> <td class="thumbnail column-thumbnail"><a href="<?php echo $picture->imageURL; ?> " class="thickbox" title="<?php echo $picture->filename; ?> "> <img class="thumb" src="<?php echo $picture->thumbURL; ?> " <?php echo $thumbsize; ?> /> </a> <br /><?php echo $date; ?> </td> <?php break; case 'alt_title_desc': ?> <td class="altdesc column-altdesc" style="width:500px"> <input name="alttext[<?php echo $pid; ?> ]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php echo stripslashes($picture->alttext); ?> " /><br/> <textarea name="description[<?php echo $pid; ?> ]" style="width:95%; margin-top: 2px;" rows="2" ><?php echo stripslashes($picture->description); ?> </textarea> </td> <?php break; case 'description': ?> <td class="description column-description"><textarea name="description[<?php echo $pid; ?> ]" class="textarea1" cols="42" rows="2" ><?php echo stripslashes($picture->description); ?> </textarea></td> <?php break; case 'alt_title_text': ?> <td class="alttext column-alttext"><input name="alttext[<?php echo $pid; ?> ]" type="text" size="30" value="<?php echo stripslashes($picture->alttext); ?> " /></td> <?php break; case 'exclude': ?> <td class="exclude column-exclude"><input name="exclude[<?php echo $pid; ?> ]" type="checkbox" value="1" <?php echo $exclude; ?> /></td> <?php break; case 'tags': $picture->tags = wp_get_object_terms($pid, 'ngg_tag', 'fields=names'); if (is_array($picture->tags)) { $picture->tags = implode(', ', $picture->tags); } ?> <td class="tags column-tags" style="width:500px;"><textarea name="tags[<?php echo $pid; ?> ]" style="width:95%;" rows="2"><?php echo $picture->tags; ?> </textarea></td> <?php break; case 'action': ?> <td><a href="<?php echo NGGALLERY_URLPATH . "admin/showmeta.php?id=" . $pid; ?> " class="thickbox" title="<?php _e("Show Meta data", 'nggallery'); ?> " ><?php _e('Meta'); ?> </a></td> <td><a href="<?php echo wp_nonce_url("admin.php?page=nggallery-manage-gallery&mode=delpic&gid=" . $act_gid . "&pid=" . $pid, 'ngg_delpicture'); ?> " class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this file ?", 'nggallery'); ?> ');if(check==false) return false;" ><?php _e('Delete'); ?> </a></td> <?php break; default: ?> <td><?php do_action('ngg_manage_gallery_custom_column', $gallery_column_key, $pid); ?> </td> <?php break; } ?> <?php } ?> </tr> <?php } } else { echo '<tr><td colspan="8" align="center"><strong>' . __('No entries found', 'nggallery') . '</strong></td></tr>'; } ?> </tbody> </table> <p class="submit"><input type="submit" class="button-primary action" name="updatepictures" value="<?php _e("Save Changes", 'nggallery'); ?> " /></p> </form> <br class="clear"/> </div><!-- /#wrap --> <!-- #entertags --> <div id="tags" style="display: none;" > <form id="form-tags" method="POST" accept-charset="utf-8"> <?php wp_nonce_field('ngg_thickbox_form'); ?> <?php if ($showTags) { ?> <input type="hidden" name="showTags" value="true" /><?php } ?> <?php if ($hideThumbs) { ?> <input type="hidden" name="hideThumbs" value="true" /><?php } ?> <input type="hidden" id="tags_imagelist" name="TB_imagelist" value="" /> <input type="hidden" id="tags_bulkaction" name="TB_bulkaction" value="" /> <table width="100%" border="0" cellspacing="3" cellpadding="3" > <tr> <th><?php _e("Enter the tags", 'nggallery'); ?> : <input name="taglist" type="text" style="width:90%" value="" /></th> </tr> <tr align="right"> <td class="submit"> <input class="button-primary" type="submit" name="TB_EditTags" value="<?php _e("OK", 'nggallery'); ?> " onclick="var numchecked = getNumChecked(document.getElementById('updategallery')); if(numchecked < 1) { alert('<?php echo js_escape(__("No images selected", 'nggallery')); ?> '); tb_remove(); return false } return confirm('<?php echo sprintf(js_escape(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '"); ?> ')" /> <input class="button-secondary" type="reset" value=" <?php _e("Cancel", 'nggallery'); ?> " onclick="tb_remove()"/> </td> </tr> </table> </form> </div> <!-- /#entertags --> <!-- #selectgallery --> <div id="selectgallery" style="display: none;" > <form id="form-select-gallery" method="POST" accept-charset="utf-8"> <?php wp_nonce_field('ngg_thickbox_form'); ?> <?php if ($showTags) { ?> <input type="hidden" name="showTags" value="true" /><?php } ?> <?php if ($hideThumbs) { ?> <input type="hidden" name="hideThumbs" value="true" /><?php } ?> <input type="hidden" id="selectgallery_imagelist" name="TB_imagelist" value="" /> <input type="hidden" id="selectgallery_bulkaction" name="TB_bulkaction" value="" /> <table width="100%" border="0" cellspacing="3" cellpadding="3" > <tr> <th> <?php _e("Select the destination gallery:", 'nggallery'); ?> <select name="dest_gid" style="width:90%" > <?php foreach ($gallerylist as $gallery) { if ($gallery->gid != $act_gid) { ?> <option value="<?php echo $gallery->gid; ?> " ><?php echo $gallery->gid; ?> - <?php echo stripslashes($gallery->title); ?> </option> <?php } } ?> </select> </th> </tr> <tr align="right"> <td class="submit"> <input type="submit" class="button-primary" name="TB_SelectGallery" value="<?php _e("OK", 'nggallery'); ?> " onclick="var numchecked = getNumChecked(document.getElementById('updategallery')); if(numchecked < 1) { alert('<?php echo js_escape(__("No images selected", 'nggallery')); ?> '); tb_remove(); return false } return confirm('<?php echo sprintf(js_escape(__("You are about to copy or move %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '"); ?> ')" /> <input class="button-secondary" type="reset" value="<?php _e("Cancel", 'nggallery'); ?> " onclick="tb_remove()"/> </td> </tr> </table> </form> </div> <!-- /#selectgallery --> <?php }
get_header(); ?> <div class="row-fluid"> <div class="span12"> <div class="moduletable"> <div id="vmTouchSlider94" class="ordasoft"> <div class="vehicleSlider horizontal" style="max-width: 1350px;"> <div class="swiper-container" style="height: 500px;"> <span id="loaderGif" style="display:block;"></span> <div class="swiper-wrapper" style="visibility:hidden;"> <?php $gallery_id = 1; $nng_object = new nggdb(); $gallery_images = $nng_object->get_gallery($gallery_id); ?> <?php $i = 1; foreach ($gallery_images as $key => $val) { ?> <div class="swiper-slide"> <img id="slideImgVm" src="<?php echo $val->imageURL; ?> " alt="img"/> </div> <?php $i++; } ?>