本文整理汇总了PHP中nggdb::add_album方法的典型用法代码示例。如果您正苦于以下问题:PHP nggdb::add_album方法的具体用法?PHP nggdb::add_album怎么用?PHP nggdb::add_album使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nggdb
的用法示例。
在下文中一共展示了nggdb::add_album方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processor
function processor()
{
global $wpdb;
check_admin_referer('ngg_album');
if (isset($_POST['add']) && isset($_POST['newalbum'])) {
if (!nggGallery::current_user_can('NextGEN Add/Delete album')) {
wp_die(__('Cheatin’ uh?'));
}
$result = nggdb::add_album($_POST['newalbum']);
$this->currentID = $result ? $result : 0;
//hook for other plugins
do_action('ngg_add_album', $this->currentID);
if ($result) {
nggGallery::show_message(__('Updated successfully', 'nggallery'));
}
}
if (isset($_POST['update']) && $this->currentID > 0) {
$gid = '';
// get variable galleryContainer
parse_str($_POST['sortorder']);
if (is_array($gid)) {
$serial_sort = serialize($gid);
$wpdb->query("UPDATE {$wpdb->nggalbum} SET sortorder = '{$serial_sort}' WHERE id = {$this->currentID} ");
} else {
$wpdb->query("UPDATE {$wpdb->nggalbum} SET sortorder = '0' WHERE id = {$this->currentID} ");
}
//hook for other plugins
do_action('ngg_update_album_sortorder', $this->currentID);
nggGallery::show_message(__('Updated successfully', 'nggallery'));
}
if (isset($_POST['delete'])) {
if (!nggGallery::current_user_can('NextGEN Add/Delete album')) {
wp_die(__('Cheatin’ uh?'));
}
$result = nggdb::delete_album($this->currentID);
//hook for other plugins
do_action('ngg_delete_album', $this->currentID);
// jump back to main selection
$this->currentID = 0;
if ($result) {
nggGallery::show_message(__('Album deleted', 'nggallery'));
}
}
}
示例2: newAlbum
/**
* Method "ngg.newAlbum"
* Create a new album
*
* @since 1.7.0
*
* @param array $args Method parameters.
* - int blog_id
* - string username
* - string password
* - string new album name
* - int id of preview image
* - string description
* - string serialized array of galleries
* @return int with new album ID
*/
function newAlbum($args)
{
global $ngg;
$this->escape($args);
$blog_ID = (int) $args[0];
$username = $args[1];
$password = $args[2];
$name = $args[3];
$preview = (int) $args[4];
$description = $args[5];
$galleries = $args[6];
$id = false;
if (!($user = $this->login($username, $password))) {
return $this->error;
}
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'));
}
if (!empty($name)) {
$id = $result = nggdb::add_album($name, $preview, $description, $galleries);
}
if (!$id) {
return new IXR_Error(500, __('Sorry, could not create the album'));
}
return $id;
}