__('NextGEN Gallery','nggallery')); return array_merge($tabs,$newtab); } add_filter('media_upload_tabs', 'ngg_wp_upload_tabs'); function media_upload_nextgen() { // Not in use $errors = false; // Generate TinyMCE HTML output if ( isset($_POST['send']) ) { $keys = array_keys($_POST['send']); $send_id = (int) array_shift($keys); $image = $_POST['image'][$send_id]; $alttext = stripslashes( htmlspecialchars ($image['alttext'], ENT_QUOTES)); $description = stripslashes (htmlspecialchars($image['description'], ENT_QUOTES)); // here is no new line allowed $clean_description = preg_replace("/\n|\r\n|\r$/", " ", $description); $img = nggdb::find_image($send_id); $thumbcode = $img->get_thumbcode(); $class="ngg-singlepic ngg-{$image['align']}"; // Build output if ($image['size'] == "thumbnail") $html = "$alttext"; // Wrap the link to the fullsize image around $html = "$html"; if ($image['size'] == "full") $html = "$alttext"; if ($image['size'] == "singlepic") $html = "[singlepic id=$send_id w=320 h=240 float={$image['align']}]"; media_upload_nextgen_save_image(); // Return it to TinyMCE return media_send_to_editor($html); } // Save button if ( isset($_POST['save']) ) { media_upload_nextgen_save_image(); } return wp_iframe( 'media_upload_nextgen_form', $errors ); } add_action('media_upload_nextgen', 'media_upload_nextgen'); function media_upload_nextgen_save_image() { global $wpdb; check_admin_referer('ngg-media-form'); if ( !empty($_POST['image']) ) foreach ( $_POST['image'] as $image_id => $image ) { // create a unique slug $image_slug = nggdb::get_unique_slug( sanitize_title( $image['alttext'] ), 'image' ); $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggpictures SET image_slug= '%s', alttext= '%s', description = '%s' WHERE pid = %d", $image_slug, $image['alttext'], $image['description'], $image_id)); wp_cache_delete($image_id, 'ngg_image'); } } function media_upload_nextgen_form($errors) { global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types, $ngg, $nggdb; media_upload_header(); $post_id = intval($_REQUEST['post_id']); $galleryID = 0; $total = 1; $picarray = array(); $form_action_url = site_url( "wp-admin/media-upload.php?type={$GLOBALS['type']}&tab=nextgen&post_id=$post_id", 'admin'); // Get number of images in gallery if ( isset($_REQUEST['select_gal']) ){ $galleryID = (int) $_REQUEST['select_gal']; $total = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures WHERE galleryid = '$galleryID'"); } // Build navigation $_GET['paged'] = isset($_GET['paged']) ? intval($_GET['paged']) : 0; if ( $_GET['paged'] < 1 ) $_GET['paged'] = 1; $start = ( $_GET['paged'] - 1 ) * 10; if ( $start < 1 ) $start = 0; // Get the images if ( $galleryID != 0 ) $picarray = $wpdb->get_col("SELECT pid FROM $wpdb->nggpictures WHERE galleryid = '$galleryID' AND exclude != 1 ORDER BY {$ngg->options['galSort']} {$ngg->options['galSortDir']} LIMIT $start, 10 "); // WP-Core code for Post-thumbnail $calling_post_id = 0; if ( isset( $_GET['post_id'] ) ) $calling_post_id = $_GET['post_id']; ?>
add_query_arg( 'paged', '%#%' ), 'format' => '', 'total' => ceil($total / 10), 'current' => $_GET['paged'] )); if ( $page_links ) echo "
$page_links
"; ?>

alttext) ) ? wp_html_excerpt( esc_html( $picture->filename ),60) : stripslashes( wp_html_excerpt( esc_html( $picture->alttext ),60) ); ?>
<?php echo esc_attr( $picture->alttext ); ?>
filename ); ?>
alttext) ); ?>
 
" . esc_html__( 'Use as featured image' ) . ""; ?>