/**
  * Renders a NextGen Gallery page in an iframe, suited for the attach to post
  * interface
  * @param string $page
  * @return string
  */
 public function _render_ngg_page_in_frame($page, $tab_id = null)
 {
     $frame_url = admin_url("/admin.php?page={$page}&attach_to_post");
     $frame_url = nextgen_esc_url($frame_url);
     if ($tab_id) {
         $tab_id = " id='ngg-iframe-{$tab_id}'";
     }
     return "<iframe name='{$page}' frameBorder='0'{$tab_id} class='ngg-attach-to-post ngg-iframe-page-{$page}' scrolling='no' src='{$frame_url}'></iframe>";
 }
Exemplo n.º 2
0
 /**
  * Display the pagination.
  *
  * @since 1.8.0
  * @author taken from WP core (see includes/class-wp-list-table.php)
  * @return string echo the html pagination bar
  */
 function pagination($which, $current, $total_items, $per_page)
 {
     $total_pages = $per_page > 0 ? ceil($total_items / $per_page) : 1;
     $output = '<span class="displaying-num">' . sprintf(_n('1 item', '%s items', $total_items), number_format_i18n($total_items)) . '</span>';
     $current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $current_url = remove_query_arg(array('hotkeys_highlight_last', 'hotkeys_highlight_first'), $current_url);
     $page_links = array();
     $disable_first = $disable_last = '';
     if ($current == 1) {
         $disable_first = ' disabled';
     }
     if ($current == $total_pages) {
         $disable_last = ' disabled';
     }
     $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", 'first-page' . $disable_first, esc_attr__('Go to the first page'), nextgen_esc_url(remove_query_arg('paged', $current_url)), '&laquo;');
     $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", 'prev-page' . $disable_first, esc_attr__('Go to the previous page'), nextgen_esc_url(add_query_arg('paged', max(1, $current - 1), $current_url)), '&lsaquo;');
     if ('bottom' == $which) {
         $html_current_page = $current;
     } else {
         $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name='%s' value='%s' size='%d' />", esc_attr__('Current page'), esc_attr('post_paged'), $current, strlen($total_pages));
     }
     $html_total_pages = sprintf("<span class='total-pages'>%s</span>", number_format_i18n($total_pages));
     $page_links[] = '<span class="paging-input">' . sprintf(_x('%1$s of %2$s', 'paging'), $html_current_page, $html_total_pages) . '</span>';
     $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", 'next-page' . $disable_last, esc_attr__('Go to the next page'), nextgen_esc_url(add_query_arg('paged', min($total_pages, $current + 1), $current_url)), '&rsaquo;');
     $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", 'last-page' . $disable_last, esc_attr__('Go to the last page'), nextgen_esc_url(add_query_arg('paged', $total_pages, $current_url)), '&raquo;');
     $output .= "\n<span class='pagination-links'>" . join("\n", $page_links) . '</span>';
     if ($total_pages) {
         $page_class = $total_pages < 2 ? ' one-page' : '';
     } else {
         $page_class = ' no-pages';
     }
     $pagination = "<div class='tablenav-pages{$page_class}'>{$output}</div>";
     echo $pagination;
 }
Exemplo n.º 3
0
 /**
  * Get the XML <item> node corresponding to one single image
  *
  * @param $image The image object
  */
 function get_image_mrss_node($image, $indent = "\t\t")
 {
     $ngg_options = nggGallery::get_option('ngg_options');
     $tags = $image->get_tags();
     $tag_names = '';
     foreach ($tags as $tag) {
         $tag_names .= $tag_names == '' ? $tag->name : ', ' . $tag->name;
     }
     $title = html_entity_decode(stripslashes($image->alttext));
     $desc = html_entity_decode(stripslashes($image->description));
     $thumbwidth = $ngg_options['thumbwidth'];
     $thumbheight = $ngg_options['thumbfix'] ? $ngg_options['thumbheight'] : $thumbwidth;
     $out = $indent . "<item>\n";
     $out .= $indent . "\t<title><![CDATA[" . nggGallery::i18n($title, 'pic_' . $image->pid . '_alttext') . "]]></title>\n";
     $out .= $indent . "\t<description><![CDATA[" . nggGallery::i18n($desc, 'pic_' . $image->pid . '_description') . "]]></description>\n";
     $out .= $indent . "\t<link><![CDATA[" . $image->get_permalink() . "]]></link>\n";
     $out .= $indent . "\t<guid>image-id:" . $image->pid . "</guid>\n";
     $out .= $indent . "\t<media:content url='" . nextgen_esc_url($image->imageURL) . "' medium='image' />\n";
     $out .= $indent . "\t<media:title><![CDATA[" . nggGallery::i18n($title, 'pic_' . $image->pid . '_alttext') . "]]></media:title>\n";
     $out .= $indent . "\t<media:description><![CDATA[" . nggGallery::i18n($desc, 'pic_' . $image->pid . '_description') . "]]></media:description>\n";
     $out .= $indent . "\t<media:thumbnail url='" . nextgen_esc_url($image->thumbURL) . "' width='" . $thumbwidth . "' height='" . $thumbheight . "' />\n";
     $out .= $indent . "\t<media:keywords><![CDATA[" . nggGallery::i18n($tag_names) . "]]></media:keywords>\n";
     $out .= $indent . "\t<media:copyright><![CDATA[Copyright (c) " . get_option("blogname") . " (" . site_url() . ")]]></media:copyright>\n";
     $out .= $indent . "</item>\n";
     return $out;
 }
Exemplo n.º 4
0
    ?>
		<?php 
    $image_url = $storage->get_image_url($image, 'full', TRUE);
    $thumb_url = $storage->get_thumb_url($image, TRUE);
    $thumb_size = $storage->get_thumb_dimensions($image);
    $width = $thumb_size['width'];
    $height = $thumb_size['height'];
    $image_title = $image->description;
    if ($image_title == null) {
        $image_title = $image->alttext;
    }
    if (strlen($image_title) >= 25) {
        $image_title = substr_replace($image_title, '...', 15, -10);
    }
    ?>
		<track>
			<title><![CDATA[<?php 
    echo_h($image_title);
    ?>
]]></title>
			<location><![CDATA[<?php 
    echo nextgen_esc_url($image_url);
    ?>
]]></location>
		</track>
		<?php 
}
?>
	</trackList>
</playlist>
Exemplo n.º 5
0
function ngg_dashboard_quota()
{
    if (get_site_option('upload_space_check_disabled')) {
        return;
    }
    if (!wpmu_enable_function('wpmuQuotaCheck')) {
        return;
    }
    $settings = C_NextGen_Settings::get_instance();
    $fs = C_Fs::get_instance();
    $dir = $fs->join_paths($fs->get_document_root('content'), $settings->gallerypath);
    $quota = get_space_allowed();
    $used = get_dirsize($dir) / 1024 / 1024;
    if ($used > $quota) {
        $percentused = '100';
    } else {
        $percentused = $used / $quota * 100;
    }
    $used_color = $percentused < 70 ? $percentused >= 40 ? 'waiting' : 'approved' : 'spam';
    $used = round($used, 2);
    $percentused = number_format($percentused);
    ?>
	<p class="sub musub" style="position:static" ><?php 
    _e('Storage Space');
    ?>
</p>
	<div class="table table_content musubtable">
	<table>
		<tr class="first">
			<td class="first b b-posts"><?php 
    printf(__('<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB</a>'), nextgen_esc_url(admin_url('admin.php?page=nggallery-manage-gallery')), $quota);
    ?>
</td>
			<td class="t posts"><?php 
    _e('Space Allowed');
    ?>
</td>
		</tr>
	</table>
	</div>
	<div class="table table_discussion musubtable">
	<table>
		<tr class="first">
			<td class="b b-comments"><?php 
    printf(__('<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB (%3$s%%)</a>'), nextgen_esc_url(admin_url('admin.php?page=nggallery-manage-gallery')), $used, $percentused);
    ?>
</td>
			<td class="last t comments <?php 
    echo $used_color;
    ?>
"><?php 
    _e('Space Used');
    ?>
</td>
		</tr>
	</table>
	</div>
	<br class="clear" />
	<?php 
}
Exemplo n.º 6
0
    echo $image->previous_pid;
    ?>
" href="<?php 
    echo nextgen_esc_url($image->previous_image_link);
    ?>
">&#9668; <?php 
    _e('Back', 'nggallery');
    ?>
</a>
		</div>
		<div class="next">
			<a class="ngg-browser-next" id="ngg-next-<?php 
    echo $image->next_pid;
    ?>
" href="<?php 
    echo nextgen_esc_url($image->next_image_link);
    ?>
"><?php 
    _e('Next', 'nggallery');
    ?>
 &#9658;</a>
		</div>
		<div class="counter"><?php 
    _e('Picture', 'nggallery');
    ?>
 <?php 
    echo $image->number;
    ?>
 <?php 
    _e('of', 'nggallery');
    ?>
Exemplo n.º 7
0
function nggallery_picturelist()
{
    // *** show picture list
    global $wpdb, $nggdb, $user_ID, $ngg;
    // Look if its a search result
    $is_search = isset($_GET['s']) ? true : false;
    $counter = 0;
    $wp_list_table = new _NGG_Images_List_Table('nggallery-manage-images');
    if ($is_search) {
        // fetch the imagelist
        $picturelist = $ngg->manage_page->search_result;
        // we didn't set a gallery or a pagination
        $act_gid = 0;
        $_GET['paged'] = 1;
        $page_links = false;
    } else {
        // GET variables
        $act_gid = $ngg->manage_page->gid;
        // Load the gallery metadata
        $gallery = $nggdb->find_gallery($act_gid);
        if (!$gallery) {
            nggGallery::show_error(__('Gallery not found.', 'nggallery'));
            return;
        }
        // Check if you have the correct capability
        if (!nggAdmin::can_manage_this_gallery($gallery->author)) {
            nggGallery::show_error(__('Sorry, you have no access here', 'nggallery'));
            return;
        }
        // look for pagination
        $_GET['paged'] = isset($_GET['paged']) && $_GET['paged'] > 0 ? absint($_GET['paged']) : 1;
        $start = ($_GET['paged'] - 1) * 50;
        // get picture values
        $picturelist = $nggdb->get_gallery($act_gid, $ngg->options['galSort'], $ngg->options['galSortDir'], false, 50, $start);
        // get the current author
        $act_author_user = get_userdata((int) $gallery->author);
    }
    // list all galleries
    $gallerylist = $nggdb->find_all_galleries();
    //get the columns
    $image_columns = $wp_list_table->get_columns();
    $hidden_columns = get_hidden_columns('nggallery-manage-images');
    $num_columns = count($image_columns) - count($hidden_columns);
    $attr = nggGallery::current_user_can('NextGEN Edit gallery options') ? '' : 'disabled="disabled"';
    ?>
<script type="text/javascript">
<!--
function showDialog( windowId, title ) {
	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);
    // now show the dialog
	jQuery( "#" + windowId ).dialog({
		width: 640,
        resizable : false,
		modal: true,
        title: title,
		position: {
			my:		'center',
			at:		'center',
			of:		window.parent
		}
	});
    jQuery("#" + windowId + ' .dialog-cancel').click(function() { jQuery( "#" + windowId ).dialog("close"); });
}

jQuery(function (){

    jQuery('span.tooltip, label.tooltip').tooltip();

    // load a content via ajax
    jQuery('a.ngg-dialog').click(function() {
    	var dialogs = jQuery('.ngg-overlay-dialog:visible');
    	if (dialogs.size() > 0) {
    		return false;
    	}

      if ( jQuery( "#spinner" ).length == 0) {
      	jQuery("body").append('<div id="spinner"></div>');
      }

    	var $this = jQuery(this);
      var results = new RegExp('[\\?&]w=([^&#]*)').exec(this.href);
    	var width  = ( results ) ? results[1] : 600;
      var results = new RegExp('[\\?&]h=([^&#]*)').exec(this.href);
	    var height = ( results ) ? results[1] : 440;
      var container = window;

      if (window.parent) {
      	container = window.parent;
      }

      jQuery('#spinner').fadeIn();
      jQuery('#spinner').position({ my: "center", at: "center", of: container });

      var dialog = jQuery('<div class="ngg-overlay-dialog" style="display:hidden"></div>').appendTo('body');
      // load the remote content
      dialog.load(
          this.href,
          {},
          function () {
              jQuery('#spinner').hide();

              dialog.dialog({
                  title: ($this.attr('title')) ? $this.attr('title') : '',
                  position: { my: "center", at: "center", of: container },
                  width: width,
                  height: height,
                  modal: true,
                  resizable: false,
                  close: function() { dialog.remove(); }
              }).width(width - 30).height(height - 30);
          }
      );

      //prevent the browser to follow the link
      return false;
    });
});

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 (typeof document.activeElement == "undefined" && document.addEventListener) {
    	document.addEventListener("focus", function (e) {
    		document.activeElement = e.target;
    	}, true);
    }

    if ( document.activeElement.name == 'post_paged' )
        return true;

	if(numchecked < 1) {
		alert('<?php 
    echo esc_js(__('No images selected', 'nggallery'));
    ?>
');
		return false;
	}

	actionId = jQuery('#bulkaction').val();

	switch (actionId) {
		case "copy_to":
			showDialog('selectgallery', '<?php 
    echo esc_js(__('Copy image to...', 'nggallery'));
    ?>
');
			return false;
			break;
		case "move_to":
			showDialog('selectgallery', '<?php 
    echo esc_js(__('Move image to...', 'nggallery'));
    ?>
');
			return false;
			break;
		case "add_tags":
			showDialog('entertags', '<?php 
    echo esc_js(__('Add new tags', 'nggallery'));
    ?>
');
			return false;
			break;
		case "delete_tags":
			showDialog('entertags', '<?php 
    echo esc_js(__('Delete tags', 'nggallery'));
    ?>
');
			return false;
			break;
		case "overwrite_tags":
			showDialog('entertags', '<?php 
    echo esc_js(__('Overwrite', 'nggallery'));
    ?>
');
			return false;
			break;
		case "resize_images":
			showDialog('resize_images', '<?php 
    echo esc_js(__('Resize images', 'nggallery'));
    ?>
');
			return false;
			break;
		case "new_thumbnail":
			showDialog('new_thumbnail', '<?php 
    echo esc_js(__('Create new thumbnails', 'nggallery'));
    ?>
');
			return false;
			break;
	}

	return confirm('<?php 
    echo sprintf(esc_js(__("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($) {
	if ($(this).data('ready')) return;

	// close postboxes that should be closed
	jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
	postboxes.add_postbox_toggles('ngg-manage-gallery');

	$(this).data('ready', true);
});

//-->
</script>
<div class="wrap">
<?php 
    //include('templates/social_media_buttons.php');
    screen_icon('nextgen-gallery');
    if ($is_search) {
        ?>
<h2><?php 
        printf(__('Search results for &#8220;%s&#8221;', 'nggallery'), esc_html(get_search_query()));
        ?>
</h2>
<form class="search-form" action="" method="get">
<p class="search-box">
	<label class="hidden" for="media-search-input"><?php 
        _e('Search Images', 'nggallery');
        ?>
:</label>
	<input type="hidden" id="page-name" name="page" value="nggallery-manage-gallery" />
	<input type="text" id="media-search-input" name="s" value="<?php 
        the_search_query();
        ?>
" />
	<input type="submit" value="<?php 
        _e('Search Images', 'nggallery');
        ?>
" class="button" />
</p>
</form>

<br style="clear: both;" />

<form id="updategallery" class="nggform" method="POST" action="<?php 
        echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;s=' . get_search_query();
        ?>
" accept-charset="utf-8">
<?php 
        wp_nonce_field('ngg_updategallery');
        ?>
<input type="hidden" name="page" value="manage-images" />

<?php 
    } else {
        ?>
<h2><?php 
        echo _n('Gallery', 'Galleries', 1, 'nggallery');
        ?>
 : <?php 
        echo esc_html(nggGallery::i18n($gallery->title));
        ?>
</h2>

<br style="clear: both;" />

<form id="updategallery" class="nggform" method="POST" action="<?php 
        echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;gid=' . $act_gid . '&amp;paged=' . $_GET['paged'];
        ?>
" accept-charset="utf-8">
<?php 
        wp_nonce_field('ngg_updategallery');
        ?>
<input type="hidden" name="page" value="manage-images" />

<?php 
        if (nggGallery::current_user_can('NextGEN Edit gallery options')) {
            ?>
<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 <?php 
            nggGallery::current_user_can_form('NextGEN Edit gallery title');
            ?>
 type="text" size="50" name="title" value="<?php 
            echo esc_attr(stripslashes($gallery->title));
            ?>
"  /></th>
					<th align="right"><?php 
            _e('Page Link to', 'nggallery');
            ?>
:</th>
					<th align="left">
					<select <?php 
            nggGallery::current_user_can_form('NextGEN Edit gallery page id');
            ?>
  name="pageid" style="width:95%">
						<option value="0" ><?php 
            _e('Not linked', 'nggallery');
            ?>
</option>
                        <?php 
            foreach (get_pages() as $page) {
                ?>
                            <option <?php 
                selected($gallery->pageid, $page->ID);
                ?>
 value="<?php 
                echo esc_attr($page->ID);
                ?>
"><?php 
                echo esc_html($page->post_title);
                ?>
</option>
                        <?php 
            }
            ?>
					</select>
					</th>
				</tr>
				<tr>
					<th align="left"><?php 
            _e('Description');
            ?>
:</th>
					<th align="left"><textarea  <?php 
            nggGallery::current_user_can_form('NextGEN Edit gallery description');
            ?>
 name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php 
            echo esc_attr(stripslashes($gallery->galdesc));
            ?>
</textarea></th>
					<th align="right"><?php 
            _e('Preview image', 'nggallery');
            ?>
:</th>
					<th align="left">
						<select <?php 
            nggGallery::current_user_can_form('NextGEN Edit gallery preview pic');
            ?>
 name="previewpic" style="width:95%" >
							<option value="0" ><?php 
            _e('No Picture', 'nggallery');
            ?>
</option>
							<?php 
            // ensure that a preview pic from a other page is still shown here
            if (intval($gallery->previewpic) != 0) {
                if (!array_key_exists($gallery->previewpic, $picturelist)) {
                    $previewpic = $nggdb->find_image($gallery->previewpic);
                    if ($previewpic) {
                        echo '<option value="' . $previewpic->pid . '" selected="selected" >' . $previewpic->pid . ' - ' . esc_attr($previewpic->filename) . '</option>' . "\n";
                    }
                }
            }
            if (is_array($picturelist)) {
                foreach ($picturelist as $picture) {
                    if ($picture->exclude) {
                        continue;
                    }
                    $selected = $picture->pid == $gallery->previewpic ? 'selected="selected" ' : '';
                    echo '<option value="' . $picture->pid . '" ' . $selected . '>' . $picture->pid . ' - ' . esc_attr($picture->filename) . '</option>' . "\n";
                }
            }
            ?>
						</select>
					</th>
				</tr>
				<tr>
					<th align="left"><?php 
            _e('Path', 'nggallery');
            ?>
:</th>
					<th align="left"><input 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 && nggGallery::current_user_can('NextGEN Edit gallery author')) {
                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>
				<?php 
            if (current_user_can('publish_pages')) {
                ?>
				<tr>
					<th align="left">&nbsp;</th>
					<th align="left">&nbsp;</th>
					<th align="right">
                        <label for='ngg_settings_parent_id'
                               class='tooltip'
                               title="Clicking <?php 
                _e('Add Page');
                ?>
 will create a new page with the same name as this gallery and will display the gallery on that new page. You can create a sub-page by selecting the parent page from the drop down.">
                            <?php 
                _e('Create new page', 'nggallery');
                ?>
:
                        </label>
                    </th>
					<th align="left">
					<select name="parent_id" style="width:95%" id='ngg_settings_parent_id'>
						<option value="0"><?php 
                _e('Main page (No parent)', 'nggallery');
                ?>
</option>
						<?php 
                foreach (get_pages() as $page) {
                    ?>
                        <option value="<?php 
                    echo esc_attr($page->ID);
                    ?>
"><?php 
                    echo esc_html($page->post_title);
                    ?>
</option>
                        <?php 
                }
                ?>
					</select>
					<input class="button-secondary action" type="submit" name="addnewpage" value="<?php 
                _e('Add page', 'nggallery');
                ?>
" id="group"/>
					</th>
				</tr>
				<?php 
            }
            ?>
                <?php 
            do_action('ngg_manage_gallery_settings', $act_gid);
            ?>

			</table>

			<div class="submit">
				<?php 
            if (wpmu_enable_function('wpmuScanFolder') && nggGallery::current_user_can('NextGEN Scan folder')) {
                ?>
				<input type="submit" class="button-secondary" name="scanfolder" value="<?php 
                _e("Scan Folder for new images", 'nggallery');
                ?>
 " />
				<?php 
            }
            ?>
				<input type="submit" class="button-primary action" name="updatepictures" value="<?php 
            _e("Save Changes", 'nggallery');
            ?>
" />
			</div>

		</div>
	</div>
</div> <!-- poststuff -->
<?php 
        }
        ?>

<?php 
    }
    ?>

<div class="tablenav top ngg-tablenav">
    <?php 
    $ngg->manage_page->pagination('top', $_GET['paged'], $nggdb->paged['total_objects'], $nggdb->paged['objects_per_page']);
    ?>
	<div class="alignleft actions">
	<select id="bulkaction" name="bulkaction">
		<option value="no_action" ><?php 
    _e("Bulk actions", 'nggallery');
    ?>
</option>
		<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="recover_images" ><?php 
    _e("Recover from backup", 'nggallery');
    ?>
</option>
		<option value="delete_images" ><?php 
    _e("Delete images", 'nggallery');
    ?>
</option>
		<option value="import_meta" ><?php 
    _e("Import metadata", 'nggallery');
    ?>
</option>
		<option value="rotate_cw" ><?php 
    _e("Rotate images clockwise", 'nggallery');
    ?>
</option>
		<option value="rotate_ccw" ><?php 
    _e("Rotate images counter-clockwise", 'nggallery');
    ?>
</option>
		<option value="copy_to" ><?php 
    _e("Copy to...", 'nggallery');
    ?>
</option>
		<option value="move_to"><?php 
    _e("Move to...", 'nggallery');
    ?>
</option>
		<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>
	</select>
	<input class="button-secondary" type="submit" name="showThickbox" value="<?php 
    _e('Apply', 'nggallery');
    ?>
" onclick="if ( !checkSelected() ) return false;" />

	<?php 
    if ($ngg->options['galSort'] == "sortorder" && !$is_search) {
        ?>
		<input class="button-secondary" type="submit" name="sortGallery" value="<?php 
        _e('Sort gallery', 'nggallery');
        ?>
" />
	<?php 
    }
    ?>

	<input type="submit" name="updatepictures" class="button-primary action"  value="<?php 
    _e('Save Changes', 'nggallery');
    ?>
" />
	</div>
</div>

<table id="ngg-listimages" class="widefat fixed" cellspacing="0" >

	<thead>
	<tr>
<?php 
    $wp_list_table->print_column_headers(true);
    ?>
	</tr>
	</thead>
	<tfoot>
	<tr>
<?php 
    $wp_list_table->print_column_headers(false);
    ?>
	</tr>
	</tfoot>
	<tbody id="the-list">
<?php 
    if ($picturelist) {
        $thumbsize = '';
        if ($ngg->options['thumbfix']) {
            $thumbsize = 'width="' . $ngg->options['thumbwidth'] . '" height="' . $ngg->options['thumbheight'] . '"';
        }
        foreach ($picturelist as $picture) {
            //for search result we need to check the capatibiliy
            if (!nggAdmin::can_manage_this_gallery($picture->author) && $is_search) {
                continue;
            }
            $counter++;
            $pid = (int) $picture->pid;
            $alternate = !isset($alternate) || $alternate == 'alternate' ? '' : '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;
            ?>
" class="<?php 
            echo $alternate;
            ?>
 iedit"  valign="top">
			<?php 
            foreach ($image_columns as $image_column_key => $column_display_name) {
                $class = "class='{$image_column_key} column-{$image_column_key}'";
                $style = '';
                if (in_array($image_column_key, $hidden_columns)) {
                    $style = ' style="display:none;"';
                }
                $attributes = $class . $style;
                switch ($image_column_key) {
                    case 'cb':
                        $attributes = 'class="column-cb check-column"' . $style;
                        ?>
						<th <?php 
                        echo $attributes;
                        ?>
 scope="row"><input name="doaction[]" type="checkbox" value="<?php 
                        echo $pid;
                        ?>
" /></th>
						<?php 
                        break;
                    case 'id':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
 style=""><?php 
                        echo $pid;
                        ?>
							<input type="hidden" name="pid[]" value="<?php 
                        echo $pid;
                        ?>
" />
						</td>
						<?php 
                        break;
                    case 'filename':
                        $attributes = 'class="title column-filename column-title"' . $style;
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<strong><a href="<?php 
                        echo nextgen_esc_url($picture->imageURL);
                        ?>
" class="thickbox" title="<?php 
                        echo esc_attr($picture->filename);
                        ?>
">
								<?php 
                        echo empty($picture->alttext) ? esc_html($picture->filename) : esc_html(stripslashes(nggGallery::i18n($picture->alttext)));
                        ?>
							</a></strong>
							<br /><?php 
                        echo $date;
                        ?>
							<?php 
                        if (!empty($picture->meta_data)) {
                            ?>
							<br /><?php 
                            echo $picture->meta_data['width'];
                            ?>
 x <?php 
                            echo $picture->meta_data['height'];
                            ?>
 <?php 
                            _e('pixel', 'nggallery');
                            ?>

							<?php 
                        }
                        ?>
							<p>
							<?php 
                        $actions = array();
                        $actions['view'] = '<a class="shutter" href="' . nextgen_esc_url($picture->imageURL) . '" title="' . esc_attr(sprintf(__('View "%s"'), sanitize_title($picture->filename))) . '">' . __('View', 'nggallery') . '</a>';
                        $actions['meta'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/showmeta.php?id=' . $pid . '" title="' . __('Show Meta data', 'nggallery') . '">' . __('Meta', 'nggallery') . '</a>';
                        $actions['custom_thumb'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/edit-thumbnail.php?id=' . $pid . '" title="' . __('Customize thumbnail', 'nggallery') . '">' . __('Edit thumb', 'nggallery') . '</a>';
                        $actions['rotate'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/rotate.php?id=' . $pid . '" title="' . __('Rotate', 'nggallery') . '">' . __('Rotate', 'nggallery') . '</a>';
                        if (current_user_can('publish_posts')) {
                            $actions['publish'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/publish.php?id=' . $pid . '&h=230" title="' . __('Publish this image', 'nggallery') . '">' . __('Publish', 'nggallery') . '</a>';
                        }
                        if (file_exists($picture->imagePath . '_backup')) {
                            $actions['recover'] = '<a class="confirmrecover" href="' . wp_nonce_url("admin.php?page=nggallery-manage-gallery&amp;mode=recoverpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'ngg_recoverpicture') . '" title="' . __('Recover', 'nggallery') . '" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Recover "%s" ?', 'nggallery'), $picture->filename)) . '\');if(check==false) return false;">' . __('Recover', 'nggallery') . '</a>';
                        }
                        $actions['delete'] = '<a class="submitdelete" href="' . wp_nonce_url("admin.php?page=nggallery-manage-gallery&amp;mode=delpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'ngg_delpicture') . '" class="delete column-delete" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Delete "%s" ?', 'nggallery'), $picture->filename)) . '\');if(check==false) return false;">' . __('Delete') . '</a>';
                        $action_count = count($actions);
                        $i = 0;
                        echo '<div class="row-actions">';
                        foreach ($actions as $action => $link) {
                            ++$i;
                            $i == $action_count ? $sep = '' : ($sep = ' | ');
                            echo "<span class='{$action}'>{$link}{$sep}</span>";
                        }
                        echo '</div>';
                        ?>
</p>
						</td>
						<?php 
                        break;
                    case 'thumbnail':
                        $attributes = 'class="id column-thumbnail media-icon"' . $style;
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><a href="<?php 
                        echo nextgen_esc_url(add_query_arg('i', mt_rand(), $picture->imageURL));
                        ?>
" class="shutter" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<img class="thumb" src="<?php 
                        echo nextgen_esc_url(add_query_arg('i', mt_rand(), $picture->thumbURL));
                        ?>
" id="thumb<?php 
                        echo $pid;
                        ?>
" />
							</a>
						</td>
						<?php 
                        break;
                    case 'alt_title_desc':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<input name="alttext[<?php 
                        echo $pid;
                        ?>
]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php 
                        echo esc_attr(stripslashes($picture->alttext));
                        ?>
" /><br/>
							<textarea name="description[<?php 
                        echo $pid;
                        ?>
]" style="width:95%; margin-top: 2px;" rows="2" ><?php 
                        echo esc_attr(stripslashes($picture->description));
                        ?>
</textarea>
						</td>
						<?php 
                        break;
                    case 'exclude':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><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 <?php 
                        echo $attributes;
                        ?>
><textarea name="tags[<?php 
                        echo $pid;
                        ?>
]" style="width:95%;" rows="2"><?php 
                        echo $picture->tags;
                        ?>
</textarea></td>
						<?php 
                        break;
                    default:
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        do_action('ngg_manage_image_custom_column', $image_column_key, $pid);
                        ?>
</td>
						<?php 
                        break;
                }
                ?>
			<?php 
            }
            ?>
		</tr>
		<?php 
        }
    }
    // In the case you have no capaptibility to see the search result
    if ($counter == 0) {
        echo '<tr><td colspan="' . $num_columns . '" align="center"><strong>' . __('No entries found', 'nggallery') . '</strong></td></tr>';
    }
    ?>

		</tbody>
	</table>
    <div class="tablenav bottom">
    <input type="submit" class="button-primary action" name="updatepictures" value="<?php 
    _e('Save Changes', 'nggallery');
    ?>
" />
    <?php 
    $ngg->manage_page->pagination('bottom', $_GET['paged'], $nggdb->paged['total_objects'], $nggdb->paged['objects_per_page']);
    ?>
    </div>
	</form>
	<br class="clear"/>
	</div><!-- /#wrap -->

	<!-- #entertags -->
	<div id="entertags" style="display: none;" >
		<form id="form-tags" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="entertags_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="entertags_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<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');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e("Cancel", 'nggallery');
    ?>
&nbsp;" />
		    	</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');
    ?>
		<input type="hidden" id="selectgallery_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="selectgallery_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
		  	<tr>
		    	<th>
		    		<?php 
    _e('Select the destination gallery:', 'nggallery');
    ?>
&nbsp;
		    		<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 esc_attr(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');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="<?php 
    _e("Cancel", 'nggallery');
    ?>
" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#selectgallery -->

	<!-- #resize_images -->
	<div id="resize_images" style="display: none;" >
		<form id="form-resize-images" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="resize_images_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="resize_images_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<td>
					<strong><?php 
    _e('Resize Images to', 'nggallery');
    ?>
:</strong>
				</td>
				<td>
					<input type="text" size="5" name="imgWidth" value="<?php 
    echo $ngg->options['imgWidth'];
    ?>
" /> x <input type="text" size="5" name="imgHeight" value="<?php 
    echo $ngg->options['imgHeight'];
    ?>
" />
					<br /><small><?php 
    _e('Width x height (in pixel). NextGEN Gallery will keep ratio size', 'nggallery');
    ?>
</small>
				</td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php 
    _e('OK', 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#resize_images -->

	<!-- #new_thumbnail -->
	<div id="new_thumbnail" style="display: none;" >
		<form id="form-new-thumbnail" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="new_thumbnail_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="new_thumbnail_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
    <table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<th align="left"><?php 
    _e('Width x height (in pixel)', 'nggallery');
    ?>
</th>
				<td>
				<?php 
    include dirname(__FILE__) . '/thumbnails-template.php';
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th align="left"><?php 
    _e('Set fix dimension', 'nggallery');
    ?>
</th>
				<td><input type="checkbox" name="thumbfix" value="1" <?php 
    checked('1', $ngg->options['thumbfix']);
    ?>
 />
				<br /><small><?php 
    _e('Ignore the aspect ratio, no portrait thumbnails', 'nggallery');
    ?>
</small></td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php 
    _e('OK', 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#new_thumbnail -->

	<script type="text/javascript">
	/* <![CDATA[ */
	jQuery(document).ready(function(){columns.init('nggallery-manage-images');});
	/* ]]> */
	</script>
	<?php 
}
Exemplo n.º 8
0
function ngg_locale()
{
    global $ngg;
    require_once NGGALLERY_ABSPATH . '/lib/locale.php';
    $locale = new ngg_locale();
    $overview_url = admin_url() . 'admin.php?page=' . NGGFOLDER;
    $result = $locale->check();
    $update_url = wp_nonce_url($overview_url . '&amp;locale=update', 'ngg_update_locale');
    //Translators can change this text via gettext
    if ($result == 'installed') {
        echo $ngg->translator;
        if (!is_wp_error($locale->response) && $locale->response['response']['code'] == '200') {
            ?>
		<p class="textright">
			<a class="button" href="<?php 
            echo nextgen_esc_url(strip_tags($update_url));
            ?>
"><?php 
            _e('Update', 'nggallery');
            ?>
</a>
		</p>
		<?php 
        }
    }
    //Translators can change this text via gettext
    if ($result == 'available') {
        ?>
		<p><strong>Download now your language file !</strong></p>
		<p class="textright">
			<a class="button" href="<?php 
        echo nextgen_esc_url(strip_tags($update_url));
        ?>
"><?php 
        _e('Download', 'nggallery');
        ?>
</a>
		</p>
		<?php 
    }
    if ($result == 'not_exist') {
        echo '<p class="hint">' . sprintf('<strong>Would you like to help translating this plugin?</strong> <a target="_blank" href="%s">Download</a> the current pot file and read <a href="http://www.nextgen-gallery.com/translating-nextgen-gallery/">here</a> how you can translate the plugin.', NGGALLERY_URLPATH . 'lang/nggallery.pot') . '</p>';
    }
}
Exemplo n.º 9
0
" <?php 
        echo $image->size;
        ?>
 />
			</a>
		</li>

	 	<?php 
    }
    ?>
	 	
	 	<!-- NEXT LINK -->
		<?php 
    if ($next) {
        ?>
		<li class="ngg-next">
			<a class="next" href="<?php 
        echo nextgen_esc_url($next);
        ?>
">&#9658;</a>
		</li>
		<?php 
    }
    ?>
	 	
	</ul>
 	
</div>

<?php 
}
Exemplo n.º 10
0
		jQuery('#thumbMsg').html(message);
		jQuery('#thumbMsg').css({'display':'block'});
		setTimeout(function(){ jQuery('#thumbMsg').fadeOut('slow'); }, 1500);
		
		var d = new Date();
		newUrl = jQuery("#imageToEdit").attr("src") + "?" + d.getTime();
		jQuery("#imageToEdit").attr("src" , newUrl);
							
	}
</script>

<table width="98%" align="center" style="border:1px solid #DADADA">
	<tr style="height : 360px;">
		<td valign="middle" align="center" style="background-color:#DADADA; width : 370px;">
			<img src="<?php 
echo nextgen_esc_url($preview_image);
?>
" alt="" id="imageToEdit" />	
		</td>
		<td>
			<input type="radio" name="ra" value="cw" /><?php 
esc_html_e('90&deg; clockwise', 'nggallery');
?>
<br />
			<input type="radio" name="ra" value="ccw" /><?php 
esc_html_e('90&deg; counter-clockwise', 'nggallery');
?>
<br />
			<input type="radio" name="ra" value="fv" /><?php 
esc_html_e('Flip vertically', 'nggallery');
?>
Exemplo n.º 11
0
/**
 * @author Alex Rabe
 *
 */
function nggallery_sortorder($galleryID = 0)
{
    global $wpdb, $ngg, $nggdb;
    if ($galleryID == 0) {
        return;
    }
    $galleryID = (int) $galleryID;
    if (isset($_POST['updateSortorder'])) {
        check_admin_referer('ngg_updatesortorder');
        // get variable new sortorder
        parse_str($_POST['sortorder']);
        if (is_array($sortArray)) {
            $neworder = array();
            foreach ($sortArray as $pid) {
                $neworder[] = (int) $pid;
            }
            $sortindex = 1;
            foreach ($neworder as $pic_id) {
                $wpdb->query("UPDATE {$wpdb->nggpictures} SET sortorder = '{$sortindex}' WHERE pid = {$pic_id}");
                $sortindex++;
            }
            C_Photocrati_Cache::flush('displayed_gallery_rendering');
            do_action('ngg_gallery_sort', $galleryID);
            nggGallery::show_message(__('Sort order changed', 'nggallery'));
        }
    }
    // look for presort args
    $presort = isset($_GET['presort']) ? $_GET['presort'] : false;
    $dir = isset($_GET['dir']) && $_GET['dir'] == 'DESC' ? 'DESC' : 'ASC';
    $sortitems = array('pid', 'filename', 'alttext', 'imagedate');
    // ensure that nobody added some evil sorting :-)
    if (in_array($presort, $sortitems)) {
        $picturelist = $nggdb->get_gallery($galleryID, $presort, $dir, false);
    } else {
        $picturelist = $nggdb->get_gallery($galleryID, 'sortorder', $dir, false);
    }
    //this is the url without any presort variable
    $clean_url = 'admin.php?page=nggallery-manage-gallery&amp;mode=sort&amp;gid=' . $galleryID;
    //if we go back , then the mode should be edit
    $back_url = 'admin.php?page=nggallery-manage-gallery&amp;mode=edit&amp;gid=' . $galleryID;
    // In the case somebody presort, then we take this url
    if (isset($_GET['dir']) || isset($_GET['presort'])) {
        $base_url = $_SERVER['REQUEST_URI'];
    } else {
        $base_url = $clean_url;
    }
    ?>
	<script type="text/javascript">
		jQuery(document).ready(function($) {
			if ($(this).data('ready')) return;

			// Enable sorting
			$(".jqui-sortable").sortable({items: 'div.imageBox'});

			$('#sortGallery').submit(function(e){
				var serial = "";
				var $images = $('div.imageBox');
				for (var i=0; i<$images.length; i++) {
					var image_id = $images[i].id.split('-').pop();
					if (serial.length > 0) serial = serial + '&';
					serial = serial + "sortArray[]=" + image_id;
				}
				$('input[name=sortorder]').val(serial);
			});

			// Listen for events in other frames
			if (window.Frame_Event_Publisher) {
				Frame_Event_Publisher.listen_for('attach_to_post:manage_galleries attach_to_post:manage_images', function(){
					window.location.href = window.location.href;
				});
			}

			$(this).data('ready', true);
		});


	</script>
	<div class="wrap">
		<form id="sortGallery" method="POST" action="<?php 
    echo $clean_url;
    ?>
" accept-charset="utf-8">
			<h2><?php 
    _e('Sort Gallery', 'nggallery');
    ?>
</h2>
			<div class="tablenav">
				<div class="alignleft actions">
					<?php 
    wp_nonce_field('ngg_updatesortorder');
    ?>
					<input class="button-primary action" type="submit" name="updateSortorder" value="<?php 
    _e('Update Sort Order', 'nggallery');
    ?>
" />
				</div>
				<div class="alignright actions">
					<a href="<?php 
    echo nextgen_esc_url($back_url);
    ?>
" class="button"><?php 
    _e('Back to gallery', 'nggallery');
    ?>
</a>
				</div>
			</div>
			<input name="sortorder" type="hidden" />
			<ul class="subsubsub">
				<li><?php 
    _e('Presort', 'nggallery');
    ?>
 :</li>
				<li><a href="<?php 
    echo esc_attr(remove_query_arg('presort', $base_url));
    ?>
" <?php 
    if ($presort == '') {
        echo 'class="current"';
    }
    ?>
><?php 
    _e('Unsorted', 'nggallery');
    ?>
</a> |</li>
				<li><a href="<?php 
    echo esc_attr(add_query_arg('presort', 'pid', $base_url));
    ?>
" <?php 
    if ($presort == 'pid') {
        echo 'class="current"';
    }
    ?>
><?php 
    _e('Image ID', 'nggallery');
    ?>
</a> |</li>
				<li><a href="<?php 
    echo esc_attr(add_query_arg('presort', 'filename', $base_url));
    ?>
" <?php 
    if ($presort == 'filename') {
        echo 'class="current"';
    }
    ?>
><?php 
    _e('Filename', 'nggallery');
    ?>
</a> |</li>
				<li><a href="<?php 
    echo esc_attr(add_query_arg('presort', 'alttext', $base_url));
    ?>
" <?php 
    if ($presort == 'alttext') {
        echo 'class="current"';
    }
    ?>
><?php 
    _e('Alt/Title text', 'nggallery');
    ?>
</a> |</li>
				<li><a href="<?php 
    echo esc_attr(add_query_arg('presort', 'imagedate', $base_url));
    ?>
" <?php 
    if ($presort == 'imagedate') {
        echo 'class="current"';
    }
    ?>
><?php 
    _e('Date/Time', 'nggallery');
    ?>
</a> |</li>
				<li><a href="<?php 
    echo esc_attr(add_query_arg('dir', 'ASC', $base_url));
    ?>
" <?php 
    if ($dir == 'ASC') {
        echo 'class="current"';
    }
    ?>
><?php 
    _e('Ascending', 'nggallery');
    ?>
</a> |</li>
				<li><a href="<?php 
    echo esc_attr(add_query_arg('dir', 'DESC', $base_url));
    ?>
" <?php 
    if ($dir == 'DESC') {
        echo 'class="current"';
    }
    ?>
><?php 
    _e('Descending', 'nggallery');
    ?>
</a></li>
			</ul>
		</form>
		<div id="debug" style="clear:both"></div>
		<div class='jqui-sortable'>
			<?php 
    if ($picturelist) {
        foreach ($picturelist as $picture) {
            ?>
					<div class="imageBox" id="pid-<?php 
            echo $picture->pid;
            ?>
">
						<div class="imageBox_theImage" style="background-image:url('<?php 
            echo nextgen_esc_url($picture->thumbURL);
            ?>
')"></div>
						<div class="imageBox_label"><span><?php 
            echo esc_html(stripslashes($picture->alttext));
            ?>
</span></div>
					</div>
					<?php 
        }
    }
    ?>
		</div>
	</div>

<?php 
}
Exemplo n.º 12
0
    /**
     * Create the album or gallery container
     *
     * @param integer $id (the prefix 'a' indidcates that you look for a album
     * @param bool $used (object will be hidden)
     * @return $output
     */
    function get_container($id = 0, $used = false)
    {
        global $wpdb, $nggdb;
        $obj = array();
        $preview_image = '';
        $class = '';
        // if the id started with a 'a', then it's a sub album
        if (substr($id, 0, 1) == 'a') {
            if (!($album = $this->_get_album(substr($id, 1)))) {
                return;
            }
            $obj['id'] = $album->id;
            $obj['name'] = $obj['title'] = $album->name;
            $obj['type'] = 'album';
            $class = 'album_obj';
            // get the post name
            $post = get_post($album->pageid);
            $obj['pagenname'] = $post == null ? '---' : $post->post_title;
            // for speed reason we limit it to 50
            if ($this->num_albums < 50) {
                $thumbURL = "";
                if ($album->previewpic) {
                    $image = $nggdb->find_image($album->previewpic);
                    if ($image) {
                        $thumbURL = @add_query_arg('timestamp', time(), $image->thumbURL);
                    }
                }
                $preview_image = $thumbURL ? '<div class="inlinepicture"><img rel="' . $album->previewpic . '" src="' . nextgen_esc_url($thumbURL) . '" /></div>' : '';
            }
            // this indicates that we have a album container
            $prefix = 'a';
        } else {
            if (!($gallery = $nggdb->find_gallery($id))) {
                return;
            }
            $obj['id'] = $gallery->gid;
            $obj['name'] = $gallery->name;
            $obj['title'] = $gallery->title;
            $obj['type'] = 'gallery';
            // get the post name
            $post = get_post($gallery->pageid);
            $obj['pagenname'] = $post == null ? '---' : $post->post_title;
            // for spped reason we limit it to 50
            if ($this->num_galleries < 50) {
                // set image url
                $thumbURL = "";
                if ($gallery->previewpic) {
                    $image = $nggdb->find_image($gallery->previewpic);
                    $thumbURL = @add_query_arg('timestamp', time(), $image->thumbURL);
                }
                $preview_image = !is_null($thumbURL) ? '<div class="inlinepicture"><img rel="' . $gallery->previewpic . '" src="' . nextgen_esc_url($thumbURL) . '" /></div>' : '';
            }
            $prefix = '';
        }
        // add class if it's in use in other albums
        $used = $used ? ' inUse' : '';
        echo '<div id="gid-' . $prefix . $obj['id'] . '" class="groupItem' . $used . '">
				<div class="innerhandle">
					<div class="item_top ' . $class . '">
						<a href="#" class="min" title="close">[-]</a>
						ID: ' . $obj['id'] . ' | ' . wp_html_excerpt(esc_html(M_I18N::translate($obj['title'])), 25) . '
					</div>
					<div class="itemContent">
							' . $preview_image . '
							<p><strong>' . __('Name', 'nggallery') . ' : </strong>' . esc_html(M_I18N::translate($obj['name'])) . '</p>
							<p><strong>' . __('Title', 'nggallery') . ' : </strong>' . esc_html(M_I18N::translate($obj['title'])) . '</p>
							<p><strong>' . __('Page', 'nggallery') . ' : </strong>' . esc_html(M_I18N::translate($obj['pagenname'])) . '</p>
							' . apply_filters('ngg_display_album_item_content', '', $obj) . '
						</div>
				</div>
			   </div>';
    }
Exemplo n.º 13
0
}
?>
	<?php 
if ($success and empty($errors)) {
    ?>
	<div class='success updated'>
		<p><?php 
    echo_h($success);
    ?>
</p>
	</div>
	<?php 
}
?>
	<form method="POST" action="<?php 
echo nextgen_esc_url($_SERVER['REQUEST_URI']);
?>
">
		<?php 
if (isset($form_header)) {
    ?>
		<?php 
    echo $form_header . "\n";
    ?>
		<?php 
}
?>
		<input type="hidden" name="action"/>
		<div class="accordion" id="nextgen_admin_accordion">
		<?php 
foreach ($tabs as $tab) {
Exemplo n.º 14
0
function nggallery_manage_gallery_main()
{
    global $ngg, $nggdb, $wp_query;
    //Build the pagination for more than 25 galleries
    $_GET['paged'] = isset($_GET['paged']) && $_GET['paged'] > 0 ? absint($_GET['paged']) : 1;
    $items_per_page = apply_filters('ngg_manage_galleries_items_per_page', 25);
    $start = ($_GET['paged'] - 1) * $items_per_page;
    if (!empty($_GET['order']) && in_array(strtoupper($_GET['order']), array('DESC', 'ASC'))) {
        $order = $_GET['order'];
    } else {
        $order = apply_filters('ngg_manage_galleries_items_order', 'ASC');
    }
    if (!empty($_GET['orderby']) && in_array($_GET['orderby'], array('gid', 'title', 'author'))) {
        $orderby = $_GET['orderby'];
    } else {
        $orderby = apply_filters('ngg_manage_galleries_items_orderby', 'gid');
    }
    $mapper = C_Gallery_Mapper::get_instance();
    $total_number_of_galleries = $mapper->count();
    $gallerylist = $mapper->select()->order_by($orderby, $order)->limit($items_per_page, $start)->run_query();
    // Need for upgrading from 2.0.40 to 2.0.52 or later.
    // For some reason, the installer doesn't always run.
    // TODO: Remove in 2.1
    if (!$gallerylist) {
        global $wpdb;
        if ($wpdb->get_results("SELECT gid FROM {$wpdb->nggallery} LIMIT 1")) {
            $installer = new C_NggLegacy_Installer();
            $installer->install();
            $gallerylist = $mapper->select()->order_by($orderby, $order)->limit($items_per_page, $start)->run_query();
        }
    }
    $wp_list_table = new _NGG_Galleries_List_Table('nggallery-manage-gallery');
    ?>
	<script type="text/javascript">
	<!--

	// Listen for frame events
	jQuery(function($){
		if ($(this).data('ready')) return;

		if (window.Frame_Event_Publisher) {

			// If a new gallery is added, refresh the page
			Frame_Event_Publisher.listen_for('attach_to_post:new_gallery attach_to_post:manage_images attach_to_post:images_added',function(){
				window.location.href = window.location.href;
			});
		}

		$(this).data('ready', true);
	});


	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() {

        if (typeof document.activeElement == "undefined" && document.addEventListener) {
        	document.addEventListener("focus", function (e) {
        		document.activeElement = e.target;
        	}, true);
        }

        if ( document.activeElement.name == 'post_paged' )
            return true;

		var numchecked = getNumChecked(document.getElementById('editgalleries'));

		if(numchecked < 1) {
			alert('<?php 
    echo esc_js(__('No images selected', 'nggallery'));
    ?>
');
			return false;
		}

		actionId = jQuery('#bulkaction').val();

		switch (actionId) {
			case "resize_images":
                showDialog('resize_images', '<?php 
    echo esc_js(__('Resize images', 'nggallery'));
    ?>
');
				return false;
				break;
			case "new_thumbnail":
				showDialog('new_thumbnail', '<?php 
    echo esc_js(__('Create new thumbnails', 'nggallery'));
    ?>
');
				return false;
				break;
		}

		return confirm('<?php 
    echo sprintf(esc_js(__("You are about to start the bulk edit for %s galleries \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '");
    ?>
');
	}

	function showDialog( windowId, title ) {
		var form = document.getElementById('editgalleries');
		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);
        // now show the dialog
    	jQuery( "#" + windowId ).dialog({
    		width: 640,
            resizable : false,
    		modal: true,
            title: title,
			position: {
				my:		'center',
				at:		'center',
				of:		window.parent
			}
    	});
        jQuery("#" + windowId + ' .dialog-cancel').click(function() { jQuery( "#" + windowId ).dialog("close"); });
	}

	function showAddGallery() {
    	jQuery( "#addGallery").dialog({
    		width: 640,
            resizable : false,
    		modal: true,
            title: '<?php 
    echo esc_js(__('Add new gallery', 'nggallery'));
    ?>
',
			position: {
				my:		'center',
				at:		'center',
				of:		window.parent
			}
    	});
        jQuery("#addGallery .dialog-cancel").click(function() { jQuery( "#addGallery" ).dialog("close"); });
	}
	//-->
	</script>
	<div class="wrap">
		<?php 
    screen_icon('nextgen-gallery');
    ?>
		<h2><?php 
    echo _n('Manage Galleries', 'Manage Galleries', 2, 'nggallery');
    ?>
</h2>
		<form class="search-form" action="" method="get">
		<p class="search-box">
			<label class="hidden" for="media-search-input"><?php 
    _e('Search Images', 'nggallery');
    ?>
:</label>
			<input type="hidden" id="page-name" name="page" value="nggallery-manage-gallery" />
			<input type="text" id="media-search-input" name="s" value="<?php 
    the_search_query();
    ?>
" />
			<input type="submit" value="<?php 
    _e('Search Images', 'nggallery');
    ?>
" class="button" />
		</p>
		</form>
		<form id="editgalleries" class="nggform" method="POST" action="<?php 
    echo nextgen_esc_url($ngg->manage_page->base_page . '&orderby=' . $orderby . '&order=' . $order . '&paged=' . $_GET['paged']);
    ?>
" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_bulkgallery');
    ?>
		<input type="hidden" name="page" value="manage-galleries" />

		<div class="tablenav top">

			<div class="alignleft actions">
				<?php 
    if (function_exists('json_encode')) {
        ?>
				<select name="bulkaction" id="bulkaction">
					<option value="no_action" ><?php 
        _e("Bulk actions", 'nggallery');
        ?>
</option>
					<option value="delete_gallery" ><?php 
        _e("Delete", 'nggallery');
        ?>
</option>
                    <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="import_meta" ><?php 
        _e("Import metadata", 'nggallery');
        ?>
</option>
					<option value="recover_images" ><?php 
        _e("Recover from backup", 'nggallery');
        ?>
</option>
				</select>
				<input name="showThickbox" class="button-secondary" type="submit" value="<?php 
        _e('Apply', 'nggallery');
        ?>
" onclick="if ( !checkSelected() ) return false;" />
				<?php 
    }
    ?>
				<?php 
    if (current_user_can('NextGEN Upload images') && nggGallery::current_user_can('NextGEN Add new gallery')) {
        ?>
					<input name="doaction" class="button-secondary action" type="submit" onclick="showAddGallery(); return false;" value="<?php 
        _e('Add new gallery', 'nggallery');
        ?>
"/>
				<?php 
    }
    ?>
			</div>


        <?php 
    $ngg->manage_page->pagination('top', $_GET['paged'], $total_number_of_galleries, $items_per_page);
    ?>

		</div>
		<table class="wp-list-table widefat" cellspacing="0">
			<thead>
			<tr>
<?php 
    $wp_list_table->print_column_headers(true);
    ?>
			</tr>
			</thead>
			<tfoot>
			<tr>
<?php 
    $wp_list_table->print_column_headers(false);
    ?>
			</tr>
			</tfoot>
			<tbody id="the-list">
<?php 
    if ($gallerylist) {
        //get the columns
        $gallery_columns = $wp_list_table->get_columns();
        $hidden_columns = get_hidden_columns('nggallery-manage-gallery');
        $num_columns = count($gallery_columns) - count($hidden_columns);
        $image_mapper = C_Image_Mapper::get_instance();
        foreach ($gallerylist as $gallery) {
            $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
            $gid = $gallery->gid;
            $name = empty($gallery->title) ? $gallery->name : $gallery->title;
            $author_user = get_userdata((int) $gallery->author);
            ?>
		<tr id="gallery-<?php 
            echo $gid;
            ?>
" <?php 
            echo $alternate;
            ?>
 >
		<?php 
            foreach ($gallery_columns as $gallery_column_key => $column_display_name) {
                $class = "class=\"{$gallery_column_key} column-{$gallery_column_key}\"";
                $style = '';
                if (in_array($gallery_column_key, $hidden_columns)) {
                    $style = ' style="display:none;"';
                }
                $attributes = "{$class}{$style}";
                switch ($gallery_column_key) {
                    case 'cb':
                        ?>
        			<th scope="row" class="column-cb check-column">
        				<?php 
                        if (nggAdmin::can_manage_this_gallery($gallery->author)) {
                            ?>
        					<input name="doaction[]" type="checkbox" value="<?php 
                            echo $gid;
                            ?>
" />
        				<?php 
                        }
                        ?>
        			</th>
        			<?php 
                        break;
                    case 'id':
                        ?>
					<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        echo $gid;
                        ?>
</td>
					<?php 
                        break;
                    case 'title':
                        ?>
        			<td class="title column-title">
        				<?php 
                        if (nggAdmin::can_manage_this_gallery($gallery->author)) {
                            ?>
        					<a href="<?php 
                            echo wp_nonce_url($ngg->manage_page->base_page . '&amp;mode=edit&amp;gid=' . $gid, 'ngg_editgallery');
                            ?>
" class='edit' title="<?php 
                            _e('Edit');
                            ?>
" >
        						<?php 
                            echo esc_html(M_I18N::translate($name));
                            ?>
        					</a>
        				<?php 
                        } else {
                            ?>
        					<?php 
                            echo esc_html(M_I18N::translate($gallery->title));
                            ?>
        				<?php 
                        }
                        ?>
                        <div class="row-actions"></div>
        			</td>
        			<?php 
                        break;
                    case 'description':
                        ?>
					<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        echo esc_html(M_I18N::translate($gallery->galdesc));
                        ?>
&nbsp;</td>
					<?php 
                        break;
                    case 'author':
                        ?>
					<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        echo esc_html($author_user->display_name);
                        ?>
</td>
					<?php 
                        break;
                    case 'page_id':
                        ?>
        			<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        echo $gallery->pageid;
                        ?>
</td>
        			<?php 
                        break;
                    case 'quantity':
                        $gallery->counter = count($image_mapper->select($image_mapper->get_primary_key_column())->where(array("galleryid = %d", $gallery->{$gallery->id_field}))->run_query(FALSE, FALSE, TRUE));
                        ?>
        			<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        echo $gallery->counter;
                        ?>
</td>
        			<?php 
                        break;
                    default:
                        ?>
					<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        do_action('ngg_manage_gallery_custom_column', $gallery_column_key, $gid);
                        ?>
</td>
					<?php 
                        break;
                }
            }
            ?>
		</tr>
		<?php 
        }
    } else {
        echo '<tr><td colspan="7" align="center"><strong>' . __('No entries found', 'nggallery') . '</strong></td></tr>';
    }
    ?>
			</tbody>
		</table>
        <div class="tablenav bottom">
		<?php 
    $ngg->manage_page->pagination('bottom', $_GET['paged'], $total_number_of_galleries, $items_per_page);
    ?>
        </div>
		</form>
	</div>
	<!-- #addGallery -->
	<div id="addGallery" style="display: none;" >
		<form id="form-tags" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_addgallery');
    ?>
		<input type="hidden" name="page" value="manage-galleries" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
		  	<tr>
		    	<td>
					<strong><?php 
    _e('New Gallery', 'nggallery');
    ?>
:</strong> <input type="text" size="35" name="galleryname" value="" /><br />
					<?php 
    if (!is_multisite()) {
        ?>
					<?php 
        _e('Create a new , empty gallery below the folder', 'nggallery');
        ?>
  <strong><?php 
        echo $ngg->options['gallerypath'];
        ?>
</strong><br />
					<?php 
    }
    ?>
					<i>( <?php 
    _e('Allowed characters for file and folder names are', 'nggallery');
    ?>
: a-z, A-Z, 0-9, -, _ )</i>
				</td>
		  	</tr>
            <?php 
    do_action('ngg_add_new_gallery_form');
    ?>
		  	<tr align="right">
		    	<td class="submit">
		    		<input class="button-primary" type="submit" name="addgallery" value="<?php 
    _e('OK', 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#addGallery -->

	<!-- #resize_images -->
	<div id="resize_images" style="display: none;" >
		<form id="form-resize-images" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="resize_images_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="resize_images_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-galleries" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<td>
					<strong><?php 
    _e('Resize Images to', 'nggallery');
    ?>
:</strong>
				</td>
				<td>
					<input type="text" size="5" name="imgWidth" value="<?php 
    echo $ngg->options['imgWidth'];
    ?>
" /> x <input type="text" size="5" name="imgHeight" value="<?php 
    echo $ngg->options['imgHeight'];
    ?>
" />
					<br /><small><?php 
    _e('Width x height (in pixel). NextGEN Gallery will keep ratio size', 'nggallery');
    ?>
</small>
				</td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php 
    _e('OK', 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#resize_images -->

	<!-- #new_thumbnail -->
	<div id="new_thumbnail" style="display: none;" >
		<form id="form-new-thumbnail" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="new_thumbnail_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="new_thumbnail_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-galleries" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<th align="left"><?php 
    _e('Width x height (in pixel)', 'nggallery');
    ?>
</th>
				<td>
				<?php 
    include dirname(__FILE__) . '/thumbnails-template.php';
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th align="left"><?php 
    _e('Set fix dimension', 'nggallery');
    ?>
</th>
				<td><input type="checkbox" name="thumbfix" value="1" <?php 
    checked('1', $ngg->options['thumbfix']);
    ?>
 />
				<br /><small><?php 
    _e('Ignore the aspect ratio, no portrait thumbnails', 'nggallery');
    ?>
</small></td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php 
    _e('OK', 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#new_thumbnail -->

<?php 
}
Exemplo n.º 15
0
 /**
  * Output HTML for the post thumbnail meta-box.
  *
  * @see wp-admin\includes\post.php
  * @param int $thumbnail_id ID of the image used for thumbnail
  * @return string html output
  */
 function _wp_post_thumbnail_html($thumbnail_id = NULL)
 {
     global $_wp_additional_image_sizes, $post_ID;
     $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__('Set featured image', 'nggallery') . '" href="' . nextgen_esc_url(get_upload_iframe_src('image')) . '" id="set-post-thumbnail" class="thickbox">%s</a></p>';
     $content = sprintf($set_thumbnail_link, esc_html__('Set featured image', 'nggallery'));
     $image = nggdb::find_image($thumbnail_id);
     $img_src = false;
     // get the options
     $ngg_options = nggGallery::get_option('ngg_options');
     if ($image) {
         if (is_array($_wp_additional_image_sizes) && isset($_wp_additional_image_sizes['post-thumbnail'])) {
             // Use post thumbnail settings if defined
             $width = absint($_wp_additional_image_sizes['post-thumbnail']['width']);
             $height = absint($_wp_additional_image_sizes['post-thumbnail']['height']);
             $mode = $_wp_additional_image_sizes['post-thumbnail']['crop'] ? 'crop' : '';
             // check fo cached picture
             $img_src = $image->cached_singlepic_file($width, $height, $mode);
         }
         // if we didn't use a cached image then we take the on-the-fly mode
         if ($img_src == false) {
             $img_src = trailingslashit(home_url()) . 'index.php?callback=image&amp;pid=' . $image->pid . '&amp;width=' . $width . '&amp;height=' . $height . '&amp;mode=crop';
         }
         $thumbnail_html = '<img width="266" src="' . $img_src . '" alt="' . $image->alttext . '" title="' . $image->alttext . '" />';
         if (!empty($thumbnail_html)) {
             $ajax_nonce = wp_create_nonce("set_post_thumbnail-{$post_ID}");
             $content = sprintf($set_thumbnail_link, $thumbnail_html);
             $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__('Remove featured image') . '</a></p>';
         }
     }
     return $content;
 }
Exemplo n.º 16
0
		<td align="center" width="300" height="320">
			<div id="previewNewThumb" style="display:none;width:<?php 
echo $WidthHtmlPrev;
?>
px;height:<?php 
echo $HeightHtmlPrev;
?>
px;overflow:hidden; margin-left:5px;">
				<img src="<?php 
echo nextgen_esc_url($preview_image);
?>
" id="imageToEditPreview" />
			</div>
			<div id="actualThumb">
				<img src="<?php 
echo nextgen_esc_url($picture->thumbURL);
?>
?<?php 
echo time();
?>
" />
			</div>
		</td>
	</tr>
	<tr style="background-color:#DADADA;">
		<td>
			<input type="button" name="update" value="<?php 
esc_attr_e('Update', 'nggallery');
?>
" onclick="updateThumb()" class="button-secondary" style="float:left; margin-left:4px;"/>
			<div id="thumbMsg" style="color:#FF0000; display : none;font-size:11px; float:right; width:60%; height:2em; line-height:2em;"></div>
Exemplo n.º 17
0
?>

  <div class="container">
    <div class="row">
      <div class="col-xs-2">
        <h1 class="site-title"><a href="<?php 
echo SITE_ROOT;
?>
">Sandy Cooper Nature Photos</h1>
      </div>
      <div class="col-xs-8">
        <img class="gallery" id"galleryHero" alt="<?php 
echo esc_attr($gallery->title);
?>
" src="<?php 
echo nextgen_esc_url($gallery->previewurl);
?>
"/>
      </div>
      <div class="col-xs-2">
        <?php 
require_once 'inc/header-main.php';
?>
      </div>
    </div>
  </div>
  
	<div id="primary" class="content-area">
		<main id="main" class="site-main" role="main">
  		<div class="container">
        <div class="row">
Exemplo n.º 18
0
        ?>
			<media:description><![CDDATA[<?php 
        esc_html_e($image->description);
        ?>
]]></media:description>
			<?php 
    }
    ?>
			<media:thumbnail width="<?php 
    esc_attr_e($width);
    ?>
" height="<?php 
    esc_attr_e($height);
    ?>
" url="<?php 
    echo nextgen_esc_url($thumb_url);
    ?>
"/>
			<?php 
    if (isset($tagnames)) {
        ?>
			<media:keywords><![CDATA[<?php 
        esc_html_e($tagnames);
        ?>
]]></media:keywords>
			<?php 
    }
    ?>
			<media:copyright><![CDATA[<?php 
    esc_html_e($copyright);
    ?>
Exemplo n.º 19
0
"
               <?php 
        echo $image->thumbcode;
        ?>
 >
				<?php 
        if (!$image->hidden) {
            ?>
				<img title="<?php 
            echo esc_attr($image->alttext);
            ?>
" alt="<?php 
            echo esc_attr($image->alttext);
            ?>
" src="<?php 
            echo nextgen_esc_url($image->thumbnailURL);
            ?>
" <?php 
            echo $image->size;
            ?>
 />
				<?php 
        }
        ?>
			</a>
			<span><?php 
        if (!$image->hidden) {
            echo $image->caption;
        }
        ?>
</span>
Exemplo n.º 20
0
		<?php 
    $this->include_template('photocrati-nextgen_gallery_display#image/after', $template_params);
}
$this->include_template('photocrati-nextgen_gallery_display#list/after');
?>
</div>
<?php 
$this->include_template('photocrati-nextgen_gallery_display#container/before');
?>
<div class="ngg-galleryoverview ngg-slideshow"
     id="<?php 
esc_attr_e($anchor);
?>
"
     data-placeholder="<?php 
echo nextgen_esc_url($placeholder);
?>
"
     style="max-width: <?php 
esc_attr_e($gallery_width);
?>
px; max-height: <?php 
esc_attr_e($gallery_height);
?>
px;">
	<div class="ngg-slideshow-loader"
	     id="<?php 
esc_attr_e($anchor);
?>
-loader"
	     style="width: <?php 
Exemplo n.º 21
0
            </div>
            <?php 
    if (!empty($image_gen_params)) {
        $max_width = 'style="max-width: ' . ($image_gen_params['width'] + 20) . 'px"';
    } else {
        $max_width = '';
    }
    ?>
            <h4>
                <a class="ngg-album-desc"
                   title="<?php 
    echo esc_attr($gallery->title);
    ?>
"
                   href="<?php 
    echo nextgen_esc_url($gallery->pagelink);
    ?>
"
                    <?php 
    echo $max_width;
    ?>
>
                    <?php 
    echo_safe_html($gallery->title);
    ?>
                </a>
            </h4>
            <p class="ngg-album-gallery-image-counter">
                <?php 
    if (isset($gallery->counter) && $gallery->counter > 0) {
        ?>
Exemplo n.º 22
0
 /**
  * Get the XML <item> node corresponding to one single image
  *
  * @param $image The image object
  */
 function get_image_mrss_node($image, $indent = "\t\t")
 {
     $settings = C_NextGen_Settings::get_instance();
     $storage = C_Gallery_Storage::get_instance();
     $tags = wp_get_object_terms($image->pid, 'ngg_tag', 'fields=names');
     if (is_array($tags)) {
         $tags = implode(', ', $tags);
     }
     $title = html_entity_decode(stripslashes($image->alttext));
     $desc = html_entity_decode(stripslashes($image->description));
     $image_url = $storage->get_image_url($image);
     $thumb_url = $storage->get_thumb_url($image);
     $thumbwidth = 80;
     $thumbheight = 80;
     if ($dimensions = $storage->get_thumb_dimensions($image)) {
         $thumbwidth = $dimensions['width'];
         $thumbheight = $dimensions['height'];
     }
     $out = $indent . "<item>\n";
     $out .= $indent . "\t<title><![CDATA[" . M_I18N::translate($title, 'pic_' . $image->pid . '_alttext') . "]]></title>\n";
     $out .= $indent . "\t<description><![CDATA[" . M_I18N::translate($desc, 'pic_' . $image->pid . '_description') . "]]></description>\n";
     $out .= $indent . "\t<link><![CDATA[" . nextgen_esc_url($image_url) . "]]></link>\n";
     $out .= $indent . "\t<guid>image-id:" . $image->pid . "</guid>\n";
     $out .= $indent . "\t<media:content url='" . nextgen_esc_url($image_url) . "' medium='image' />\n";
     $out .= $indent . "\t<media:title><![CDATA[" . M_I18N::translate($title, 'pic_' . $image->pid . '_alttext') . "]]></media:title>\n";
     $out .= $indent . "\t<media:description><![CDATA[" . M_I18N::translate($desc, 'pic_' . $image->pid . '_description') . "]]></media:description>\n";
     $out .= $indent . "\t<media:thumbnail url='" . nextgen_esc_url($thumb_url) . "' width='" . $thumbwidth . "' height='" . $thumbheight . "' />\n";
     $out .= $indent . "\t<media:keywords><![CDATA[" . esc_html(M_I18N::translate($tags)) . "]]></media:keywords>\n";
     $out .= $indent . "\t<media:copyright><![CDATA[Copyright (c) " . get_option("blogname") . " (" . site_url() . ")]]></media:copyright>\n";
     $out .= $indent . "</item>\n";
     return $out;
 }