本文整理汇总了PHP中nggGallery::current_user_can方法的典型用法代码示例。如果您正苦于以下问题:PHP nggGallery::current_user_can方法的具体用法?PHP nggGallery::current_user_can怎么用?PHP nggGallery::current_user_can使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nggGallery
的用法示例。
在下文中一共展示了nggGallery::current_user_can方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nggallery_manage_gallery_main
//.........这里部分代码省略.........
<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
if ($page_links) {
?>
<div class="tablenav-pages"><?php
$page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s–%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $nggdb->paged['objects_per_page'] + 1), number_format_i18n(min($_GET['paged'] * $nggdb->paged['objects_per_page'], $nggdb->paged['total_objects'])), number_format_i18n($nggdb->paged['total_objects']), $page_links);
echo $page_links_text;
?>
</div>
<?php
}
?>
</div>
<table class="widefat" cellspacing="0">
<thead>
<tr>
<?php
print_column_headers('nggallery-manage-galleries');
?>
</tr>
</thead>
<tfoot>
示例2: current_user_can_form
/**
* Check for extended capabilites and echo disabled="disabled" for input form
*
* @since 1.5.0
* @param string $capability
* @return void
*/
static function current_user_can_form($capability)
{
if (!nggGallery::current_user_can($capability)) {
echo 'disabled="disabled"';
}
}
示例3: tabs_order
/**
* Create array for tabs and add a filter for other plugins to inject more tabs
*
* @return array $tabs
*/
function tabs_order()
{
$tabs = array();
if (!empty($this->gallerylist)) {
$tabs['uploadimage'] = __('Upload Images', 'nggallery');
}
if (nggGallery::current_user_can('NextGEN Add new gallery')) {
$tabs['addgallery'] = __('Add new gallery', 'nggallery');
}
if (wpmu_enable_function('wpmuZipUpload') && nggGallery::current_user_can('NextGEN Upload a zip')) {
$tabs['zipupload'] = __('Upload a Zip-File', 'nggallery');
}
if (wpmu_enable_function('wpmuImportFolder') && nggGallery::current_user_can('NextGEN Import image folder')) {
$tabs['importfolder'] = __('Import image folder', 'nggallery');
}
$tabs = apply_filters('ngg_addgallery_tabs', $tabs);
return $tabs;
}
示例4: post_processor_images
//.........这里部分代码省略.........
}
}
if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_EditTags'])) {
// do tags update
check_admin_referer('ngg_thickbox_form');
// get the images list
$pic_ids = explode(',', $_POST['TB_imagelist']);
$taglist = explode(',', $_POST['taglist']);
$taglist = array_map('trim', $taglist);
if (is_array($pic_ids)) {
foreach ($pic_ids as $pic_id) {
// which action should be performed ?
switch ($_POST['TB_bulkaction']) {
case 'no_action':
// No action
break;
case 'overwrite_tags':
// Overwrite tags
wp_set_object_terms($pic_id, $taglist, 'ngg_tag');
break;
case 'add_tags':
// Add / append tags
wp_set_object_terms($pic_id, $taglist, 'ngg_tag', TRUE);
break;
case 'delete_tags':
// Delete tags
$oldtags = wp_get_object_terms($pic_id, 'ngg_tag', 'fields=names');
// get the slugs, to vaoid case sensitive problems
$slugarray = array_map('sanitize_title', $taglist);
$oldtags = array_map('sanitize_title', $oldtags);
// compare them and return the diff
$newtags = array_diff($oldtags, $slugarray);
wp_set_object_terms($pic_id, $newtags, 'ngg_tag');
break;
}
}
nggGallery::show_message(__('Tags changed', 'nggallery'));
}
}
if (isset($_POST['updatepictures'])) {
// Update pictures
check_admin_referer('ngg_updategallery');
if (nggGallery::current_user_can('NextGEN Edit gallery options') && !isset($_GET['s'])) {
if (nggGallery::current_user_can('NextGEN Edit gallery title')) {
// don't forget to update the slug
$slug = nggdb::get_unique_slug(sanitize_title($_POST['title']), 'gallery', $this->gid);
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->nggallery} SET title= '%s', slug= '%s' WHERE gid = %d", esc_attr($_POST['title']), $slug, $this->gid));
}
if (nggGallery::current_user_can('NextGEN Edit gallery path')) {
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->nggallery} SET path= '%s' WHERE gid = %d", untrailingslashit(str_replace('\\', '/', trim(stripslashes($_POST['path'])))), $this->gid));
}
if (nggGallery::current_user_can('NextGEN Edit gallery description')) {
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->nggallery} SET galdesc= '%s' WHERE gid = %d", esc_attr($_POST['gallerydesc']), $this->gid));
}
if (nggGallery::current_user_can('NextGEN Edit gallery page id')) {
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->nggallery} SET pageid= '%d' WHERE gid = %d", (int) $_POST['pageid'], $this->gid));
}
if (nggGallery::current_user_can('NextGEN Edit gallery preview pic')) {
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->nggallery} SET previewpic= '%d' WHERE gid = %d", (int) $_POST['previewpic'], $this->gid));
}
if (isset($_POST['author']) && nggGallery::current_user_can('NextGEN Edit gallery author')) {
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->nggallery} SET author= '%d' WHERE gid = %d", (int) $_POST['author'], $this->gid));
}
wp_cache_delete($this->gid, 'ngg_gallery');
}
$this->update_pictures();
//hook for other plugin to update the fields
do_action('ngg_update_gallery', $this->gid, $_POST);
nggGallery::show_message(__('Update successful', "nggallery"));
}
if (isset($_POST['scanfolder'])) {
// Rescan folder
check_admin_referer('ngg_updategallery');
$gallerypath = $wpdb->get_var("SELECT path FROM {$wpdb->nggallery} WHERE gid = '{$this->gid}' ");
nggAdmin::import_gallery($gallerypath);
}
if (isset($_POST['addnewpage'])) {
// Add a new page
check_admin_referer('ngg_updategallery');
$parent_id = esc_attr($_POST['parent_id']);
$gallery_title = esc_attr($_POST['title']);
$gallery_name = $wpdb->get_var("SELECT name FROM {$wpdb->nggallery} WHERE gid = '{$this->gid}' ");
// Create a WP page
global $user_ID;
$page['post_type'] = 'page';
$page['post_content'] = '[nggallery id=' . $this->gid . ']';
$page['post_parent'] = $parent_id;
$page['post_author'] = $user_ID;
$page['post_status'] = 'publish';
$page['post_title'] = $gallery_title == '' ? $gallery_name : $gallery_title;
$page = apply_filters('ngg_add_new_page', $page, $this->gid);
$gallery_pageid = wp_insert_post($page);
if ($gallery_pageid != 0) {
$result = $wpdb->query("UPDATE {$wpdb->nggallery} SET title= '{$gallery_title}', pageid = '{$gallery_pageid}' WHERE gid = '{$this->gid}'");
wp_cache_delete($this->gid, 'ngg_gallery');
nggGallery::show_message(__('New gallery page ID', 'nggallery') . ' ' . $gallery_pageid . ' -> <strong>' . $gallery_title . '</strong> ' . __('created', 'nggallery'));
}
do_action('ngg_gallery_addnewpage', $this->gid);
}
}
示例5: nggallery_picturelist
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) {
//.........这里部分代码省略.........
示例6: nggallery_manage_gallery_main
//.........这里部分代码省略.........
<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">
示例7: nggallery_picturelist
function nggallery_picturelist($controller)
{
// *** 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
$mapper = C_Gallery_Mapper::get_instance();
$gallery = $mapper->find($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;
$items_per_page = 50;
$start = ($_GET['paged'] - 1) * $items_per_page;
// get picture values
$image_mapper = C_Image_Mapper::get_instance();
$total_number_of_images = count($image_mapper->select($image_mapper->get_primary_key_column())->where(array("galleryid = %d", $act_gid))->run_query(FALSE, TRUE));
$picturelist = $image_mapper->select()->where(array("galleryid = %d", $act_gid))->order_by($ngg->options['galSort'], $ngg->options['galSortDir'])->limit($items_per_page, $start)->run_query();
// 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);
//.........这里部分代码省略.........
示例8: post_processor_images
//.........这里部分代码省略.........
}
}
if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_EditTags'])) {
// do tags update
check_admin_referer('ngg_thickbox_form');
// get the images list
$pic_ids = explode(',', $_POST['TB_imagelist']);
$taglist = explode(',', $_POST['taglist']);
$taglist = array_map('trim', $taglist);
if (is_array($pic_ids)) {
foreach ($pic_ids as $pic_id) {
// which action should be performed ?
switch ($_POST['TB_bulkaction']) {
case 'no_action':
// No action
break;
case 'overwrite_tags':
// Overwrite tags
wp_set_object_terms($pic_id, $taglist, 'ngg_tag');
break;
case 'add_tags':
// Add / append tags
wp_set_object_terms($pic_id, $taglist, 'ngg_tag', TRUE);
break;
case 'delete_tags':
// Delete tags
$oldtags = wp_get_object_terms($pic_id, 'ngg_tag', 'fields=names');
// get the slugs, to vaoid case sensitive problems
$slugarray = array_map('sanitize_title', $taglist);
$oldtags = array_map('sanitize_title', $oldtags);
// compare them and return the diff
$newtags = array_diff($oldtags, $slugarray);
wp_set_object_terms($pic_id, $newtags, 'ngg_tag');
break;
}
}
nggGallery::show_message(__('Tags changed', 'nggallery'));
}
}
if (isset($_POST['updatepictures'])) {
// Update pictures
check_admin_referer('ngg_updategallery');
if (nggGallery::current_user_can('NextGEN Edit gallery options') && !isset($_GET['s'])) {
$tags = array('<a>', '<abbr>', '<acronym>', '<address>', '<b>', '<base>', '<basefont>', '<big>', '<blockquote>', '<br>', '<br/>', '<caption>', '<center>', '<cite>', '<code>', '<col>', '<colgroup>', '<dd>', '<del>', '<dfn>', '<dir>', '<div>', '<dl>', '<dt>', '<em>', '<fieldset>', '<font>', '<h1>', '<h2>', '<h3>', '<h4>', '<h5>', '<h6>', '<hr>', '<i>', '<ins>', '<label>', '<legend>', '<li>', '<menu>', '<noframes>', '<noscript>', '<ol>', '<optgroup>', '<option>', '<p>', '<pre>', '<q>', '<s>', '<samp>', '<select>', '<small>', '<span>', '<strike>', '<strong>', '<sub>', '<sup>', '<table>', '<tbody>', '<td>', '<tfoot>', '<th>', '<thead>', '<tr>', '<tt>', '<u>', '<ul>');
$fields = array('title', 'galdesc');
// Sanitize fields
foreach ($fields as $field) {
$html = $_POST[$field];
$html = preg_replace('/\\s+on\\w+=(["\']).*?\\1/i', '', $html);
$html = preg_replace('/(<\\/[^>]+?>)(<[^>\\/][^>]*?>)/', '$1 $2', $html);
$html = strip_tags($html, implode('', $tags));
$_POST[$field] = $html;
}
// Update the gallery
$mapper = C_Gallery_Mapper::get_instance();
if ($entity = $mapper->find($this->gid)) {
foreach ($_POST as $key => $value) {
$entity->{$key} = $value;
}
$mapper->save($entity);
}
wp_cache_delete($this->gid, 'ngg_gallery');
}
$this->update_pictures();
//hook for other plugin to update the fields
do_action('ngg_update_gallery', $this->gid, $_POST);
nggGallery::show_message(__('Update successful', 'nggallery'));
}
if (isset($_POST['scanfolder'])) {
// Rescan folder
check_admin_referer('ngg_updategallery');
$gallerypath = $wpdb->get_var("SELECT path FROM {$wpdb->nggallery} WHERE gid = '{$this->gid}' ");
nggAdmin::import_gallery($gallerypath, $this->gid);
}
// Add a new page
if (isset($_POST['addnewpage'])) {
check_admin_referer('ngg_updategallery');
$parent_id = esc_attr($_POST['parent_id']);
$gallery_title = esc_attr($_POST['title']);
$mapper = C_Gallery_Mapper::get_instance();
$gallery = $mapper->find($this->gid);
$gallery_name = $gallery->name;
// Create a WP page
global $user_ID;
$page['post_type'] = 'page';
$page['post_content'] = apply_filters('ngg_add_page_shortcode', '[nggallery id="' . $this->gid . '"]');
$page['post_parent'] = $parent_id;
$page['post_author'] = $user_ID;
$page['post_status'] = 'publish';
$page['post_title'] = $gallery_title == '' ? $gallery_name : $gallery_title;
$page = apply_filters('ngg_add_new_page', $page, $this->gid);
$gallery_pageid = wp_insert_post($page);
if ($gallery_pageid != 0) {
$gallery->pageid = $gallery_pageid;
$mapper->save($gallery);
nggGallery::show_message(__('New gallery page ID', 'nggallery') . ' ' . $gallery_pageid . ' -> <strong>' . $gallery_title . '</strong> ' . __('created', 'nggallery'));
}
do_action('ngg_gallery_addnewpage', $this->gid);
}
}
示例9: output
//.........这里部分代码省略.........
</h2>
<form id="selectalbum" method="POST" onsubmit="ngg_serialize()" accept-charset="utf-8">
<?php
wp_nonce_field('ngg_album');
?>
<input name="sortorder" type="hidden" />
<div class="albumnav tablenav">
<div class="alignleft actions">
<?php
esc_html_e('Select album', 'nggallery');
?>
<select id="act_album" name="act_album" onchange="this.form.submit();">
<option value="0" ><?php
esc_html_e('No album selected', 'nggallery');
?>
</option>
<?php
if (is_array($this->albums)) {
foreach ($this->albums as $album) {
$selected = $this->currentID == $album->id ? 'selected="selected" ' : '';
echo '<option value="' . $album->id . '" ' . $selected . '>' . $album->id . ' - ' . esc_attr($album->name) . '</option>' . "\n";
}
}
?>
</select>
<?php
if ($this->currentID > 0) {
?>
<input class="button-primary" type="submit" name="update" value="<?php
esc_attr_e('Update', 'nggallery');
?>
"/>
<?php
if (nggGallery::current_user_can('NextGEN Edit album settings')) {
?>
<input class="button-secondary" type="submit" name="showThickbox" value="<?php
esc_attr_e('Edit album', 'nggallery');
?>
" onclick="showDialog(); return false;" />
<?php
}
?>
<?php
if (nggGallery::current_user_can('NextGEN Add/Delete album')) {
?>
<input class="button-secondary action "type="submit" name="delete" value="<?php
esc_attr_e('Delete', 'nggallery');
?>
" onclick="javascript:check=confirm('<?php
echo esc_js('Delete album ?', 'nggallery');
?>
');if(check==false) return false;"/>
<?php
}
?>
<?php
} else {
?>
<?php
if (nggGallery::current_user_can('NextGEN Add/Delete album')) {
?>
<span><?php
esc_html_e('Add new album', 'nggallery');
?>
</span>
<input class="search-input" id="newalbum" name="newalbum" type="text" value="" />
示例10: edit_current_screen
/**
* Add help and options to the correct screens
*
* @since 1.9.24
*
* @param object $screen The current screen.
*
* @return object $screen The current screen.
*/
function edit_current_screen($screen)
{
// menu title is localized, so we need to change the toplevel name
$i18n = strtolower(__('Galleries', 'nggallery'));
switch ($screen->id) {
case 'toplevel_page_' . NGGFOLDER:
//The tab content
$help = '<p>' . __('Welcome to your NextCellent Dashboard! This screen gives you all kinds of information about NextCellent at glance. You can get help for any screen by clicking the Help tab in the upper corner.') . '</p>';
//Add the tab
$screen->add_help_tab(array('id' => $screen->id . '-welcome', 'title' => 'Overview', 'content' => $help));
//The tab content
$help = '<p>' . __('The boxes on your overview screen are:', 'nggallery') . '</p>';
$help .= '<p><strong>' . __('At a Glance', 'nggallery') . '</strong> - ' . __('Shows some general information about your site, such as the number of pictures, albums and galleries.', 'nggallery') . '</p>';
$help .= '<p><strong>' . __('Latest News', 'nggallery') . '</strong> - ' . __('The latest NextCellent news.', 'nggallery') . '</p>';
if (!is_multisite() || is_super_admin()) {
$help .= '<p><strong>' . __('Related plugins', 'nggallery') . '</strong> - ' . __('Shows plugins that extend NextCellent.', 'nggallery') . ' <strong>' . __('Pay attention', 'nggallery') . '</strong>: ' . __('third parties plugins that are compatible with NGG may not be 100% compatible with NextCellent Gallery!', 'nggallery') . '</p>';
}
$help .= '<p><strong>' . __('Help me help YOU!', 'nggallery') . '</strong> - ' . __('Shows general information about he plugin and some links.', 'nggallery') . '</p>';
if (!(get_locale() == 'en_US')) {
$help .= '<p><strong>' . __('Translation', 'nggallery') . '</strong> - ' . __('View information about the current translation.') . '</p>';
}
if (!is_multisite() || is_super_admin()) {
$help .= '<p><strong>' . __('Server Settings', 'nggallery') . '</strong> - ' . __('Show all the server settings!.', 'nggallery') . '</p>';
$help .= '<p><strong>' . __('Plugin Check', 'nggallery') . '</strong> - ' . __('Check if there are known errors in your installation.', 'nggallery') . '</p>';
}
//Add the tab
$screen->add_help_tab(array('id' => $screen->id . '-content', 'title' => 'Content', 'content' => $help));
break;
case "{$i18n}_page_nggallery-add-gallery":
global $nggdb;
$gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
//look for galleries
$help = '<p>' . __('On this page you can add galleries and pictures to those galleries.', 'nggallery') . '</p>';
if (nggGallery::current_user_can('NextGEN Add new gallery')) {
$help .= '<p><strong>' . __('New gallery', 'nggallery') . '</strong> - ' . __('Add new galleries to NextCellent.', 'nggallery') . '</p>';
}
if (empty($gallerylist)) {
$help .= '<p><strong>' . __('You must add a gallery before adding images!', 'nggallery') . '</strong>';
} else {
$help .= '<p><strong>' . __('Images', 'nggallery') . '</strong> - ' . __('Add new images to a gallery.', 'nggallery') . '</p>';
}
if (wpmu_enable_function('wpmuZipUpload') && nggGallery::current_user_can('NextGEN Upload a zip') && !empty($gallerylist)) {
$help .= '<p><strong>' . __('ZIP file', 'nggallery') . '</strong> - ' . __('Add images from a ZIP file.', 'nggallery') . '</p>';
}
if (wpmu_enable_function('wpmuImportFolder') && nggGallery::current_user_can('NextGEN Import image folder')) {
$help .= '<p><strong>' . __('Import folder', 'nggallery') . '</strong> - ' . __('Import a folder from the server as a new gallery.', 'nggallery') . '</p>';
}
$screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Add things', 'content' => $help));
break;
case "{$i18n}_page_nggallery-manage-gallery":
// we would like to have screen option only at the manage images / gallery page
if (isset($_GET['mode']) && $_GET['mode'] == 'edit' || isset($_POST['backToGallery'])) {
$screen->base = $screen->id = 'nggallery-manage-images';
} else {
$screen->base = $screen->id = 'nggallery-manage-gallery';
}
$help = '<p>' . __('Manage your images and galleries.', 'nggallery') . '</p>';
$screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Manage everything', 'content' => $help));
break;
case "{$i18n}_page_nggallery-manage-album":
$help = '<p>' . __('Organize your galleries into albums.', 'nggallery') . '</p><p>' . __('First select an album from the dropdown and then drag the galleries you want to add or remove from the selected album.', 'nggallery') . '</p>';
$screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Organize everything', 'content' => $help));
break;
case "{$i18n}_page_nggallery-tags":
$help = '<p>' . __('Organize your pictures with tags.', 'nggallery') . '</p><p>' . __('Rename, delete and edit tags. Use the rename function to merge tags.', 'nggallery') . '</p>';
$screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Organize pictures', 'content' => $help));
break;
case "{$i18n}_page_nggallery-options":
$help = '<p>' . __('Edit all of NextCellent\'s options. The options are sorted in multiple categories.', 'nggallery') . '</p>';
$help .= '<p><strong>' . __('General', 'nggallery') . '</strong> - ' . __('General NextCellent options. Contains options for permalinks and related images.', 'nggallery') . '</p>';
$help .= '<p><strong>' . __('Images', 'nggallery') . '</strong> - ' . __('All image-related options. Also contains options for thumbnails.', 'nggallery') . '</p>';
$help .= '<p><strong>' . __('Gallery', 'nggallery') . '</strong> - ' . __('Everything about galleries. From sorting options to the number of images, it\'s all in here.', 'nggallery') . '</p>';
$help .= '<p><strong>' . __('Effects', 'nggallery') . '</strong> - ' . __('Make your gallery look beautiful.', 'nggallery') . '</p>';
$help .= '<p><strong>' . __('Watermark', 'nggallery') . '</strong> - ' . __('Who doesn\'t want theft-proof images?', 'nggallery') . '</p>';
$help .= '<p><strong>' . __('Slideshow', 'nggallery') . '</strong> - ' . __('Edit options for the slideshow.', 'nggallery') . '</p>';
$help .= '<p>' . __('Don\'t forget to press save!', 'nggallery') . '</p>';
$screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Edit options', 'content' => $help));
break;
case "{$i18n}_page_nggallery-style":
$help = '<p>' . __('You can edit the css file to adjust how your gallery looks.', 'nggallery') . '</p>';
$help .= '<p>' . __('When you save an edited file, NextCellent automatically saves it as a copy in the folder ngg_styles. This protects your changes from upgrades.', 'nggallery') . '</p>';
$screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Style your gallery', 'content' => $help));
break;
case "{$i18n}_page_nggallery-roles":
$help = '<p>' . __('You can assign the lowest user role that has access to a certain feature. Needless to say, all greater user roles will also have access to that feature.', 'nggallery') . '</p>';
$help .= '<p>' . __('NextCellent also works with various plugins that extend the default roles capabilities.', 'nggallery') . '</p>';
$screen->add_help_tab(array('id' => $screen->id . '-general', 'title' => 'Grant permissions', 'content' => $help));
break;
case "{$i18n}_page_nggallery-setup":
$help = '<p>' . __('If \'someone\' messed with your settings (yeah, definitely not you), you can reset them here.', 'nggallery') . '</p>';
$help .= '<p><b>' . __('Attention!', 'nggallery') . '</b> ' . __('You should not use the Uninstall Plugin button, unless you know what you\'re doing! It should never be necessary to press it.', 'nggallery') . '</p>';
//.........这里部分代码省略.........
示例11: deleteAlbum
/**
* Method "ngg.deleteAlbum"
* Delete a album from the database
*
* @since 1.7.0
*
* @param array $args Method parameters.
* - int blog_id
* - string username
* - string password
* - int album id
* @return true
*/
function deleteAlbum($args)
{
global $nggdb;
$this->escape($args);
$blog_ID = (int) $args[0];
$username = $args[1];
$password = $args[2];
$id = (int) $args[3];
if (!($user = $this->login($username, $password))) {
return $this->error;
}
if (!($album = nggdb::find_album($id))) {
return new IXR_Error(404, __("Invalid album ID"));
}
if (!current_user_can('NextGEN Edit album') && !nggGallery::current_user_can('NextGEN Add/Delete album')) {
return new IXR_Error(401, __('Sorry, you must be able to manage albums'));
}
$nggdb->delete_album($id);
return true;
}
示例12: output
//.........这里部分代码省略.........
</h2>
<form id="selectalbum" method="POST" onsubmit="ngg_serialize()" accept-charset="utf-8">
<?php
wp_nonce_field('ngg_album');
?>
<input name="sortorder" type="hidden" />
<div class="albumnav tablenav">
<div class="alignleft actions">
<?php
esc_html_e('Select album', 'nggallery');
?>
<select id="act_album" name="act_album" onchange="this.form.submit();">
<option value="0" ><?php
esc_html_e('No album selected', 'nggallery');
?>
</option>
<?php
if (is_array($this->albums)) {
foreach ($this->albums as $a) {
$selected = $this->currentID == $a->id ? 'selected="selected" ' : '';
echo '<option value="' . $a->id . '" ' . $selected . '>' . $a->id . ' - ' . esc_attr($a->name) . '</option>' . "\n";
}
}
?>
</select>
<?php
if ($album && $this->currentID) {
?>
<input class="button-primary" type="submit" name="update" value="<?php
esc_attr_e('Update', 'nggallery');
?>
"/>
<?php
if (nggGallery::current_user_can('NextGEN Edit album settings')) {
?>
<input class="button-secondary" type="submit" name="showThickbox" value="<?php
esc_attr_e('Edit Album', 'nggallery');
?>
" onclick="showDialog(); return false;" />
<?php
}
?>
<?php
if (nggGallery::current_user_can('NextGEN Add/Delete album')) {
?>
<input class="button-secondary action "type="submit" name="delete" value="<?php
esc_attr_e('Delete', 'nggallery');
?>
" onclick="javascript:check=confirm('<?php
echo esc_js('Delete album ?', 'nggallery');
?>
');if(check==false) return false;"/>
<?php
}
?>
<?php
} else {
?>
<?php
if (nggGallery::current_user_can('NextGEN Add/Delete album')) {
?>
<span><?php
esc_html_e('Add new album', 'nggallery');
?>
</span>
<input class="search-input" id="newalbum" name="newalbum" type="text" value="" />