本文整理汇总了PHP中C_Image_Mapper::get_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP C_Image_Mapper::get_instance方法的具体用法?PHP C_Image_Mapper::get_instance怎么用?PHP C_Image_Mapper::get_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_Image_Mapper
的用法示例。
在下文中一共展示了C_Image_Mapper::get_instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Parses the nggMeta data only if needed
* @param int $image path to a image
* @param bool $onlyEXIF parse only exif if needed
* @return
*/
function __construct($image_or_id, $onlyEXIF = false)
{
if (is_int($image_or_id)) {
//get the path and other data about the image
$this->image = C_Image_Mapper::get_instance()->find($image_or_id);
} else {
$this->image = $image_or_id;
}
$imagePath = C_Gallery_Storage::get_instance()->get_image_abspath($this->image);
if (!file_exists($imagePath)) {
return false;
}
$this->size = @getimagesize($imagePath, $metadata);
if ($this->size && is_array($metadata)) {
// get exif - data
if (is_callable('exif_read_data')) {
$this->exif_data = @exif_read_data($imagePath, NULL, TRUE);
}
// stop here if we didn't need other meta data
if ($onlyEXIF) {
return true;
}
// get the iptc data - should be in APP13
if (is_callable('iptcparse') && isset($metadata['APP13'])) {
$this->iptc_data = @iptcparse($metadata['APP13']);
}
// get the xmp data in a XML format
if (is_callable('xml_parser_create')) {
$this->xmp_data = $this->extract_XMP($imagePath);
}
return true;
}
return false;
}
示例2: index_action
function index_action()
{
$this->enqueue_static_resources();
$settings = C_NextGen_Settings::get_instance();
$retval = $settings->proofing_user_confirmation_not_found;
if ($proof = C_NextGen_Pro_Proofing_Mapper::get_instance()->find_by_hash($this->param('proof'), TRUE)) {
$image_mapper = C_Image_Mapper::get_instance();
$images = array();
foreach ($proof->proofed_gallery['image_list'] as $image_id) {
$images[] = $image_mapper->find($image_id);
}
$message = $settings->proofing_user_confirmation_template;
if (preg_match_all('/%%(\\w+)%%/', $settings->proofing_user_confirmation_template, $matches, PREG_SET_ORDER) > 0) {
foreach ($matches as $match) {
switch ($match[1]) {
case 'user_name':
$message = str_replace('%%user_name%%', $proof->customer_name, $message);
break;
case 'user_email':
$message = str_replace('%%user_email%%', $proof->email, $message);
break;
case 'proof_link':
$message = str_replace('%%proof_link%%', $proof->referer, $message);
break;
case 'proof_details':
$imagehtml = $this->object->render_partial('photocrati-nextgen_pro_proofing#confirmation', array('images' => $images, 'storage' => C_Gallery_Storage::get_instance()), TRUE);
$message = str_replace('%%proof_details%%', $imagehtml, $message);
break;
}
}
$retval = $message;
}
}
return $retval;
}
示例3: get_digital_downloads
/**
* Gets all digital downloads for the pricelist
* @param null $image_id
* @return mixed
*/
function get_digital_downloads($image_id = NULL)
{
// Find digital download items
$mapper = C_Pricelist_Item_Mapper::get_instance();
$conditions = array(array("pricelist_id = %d", $this->object->id()), array("source IN %s", array(NGG_PRO_DIGITAL_DOWNLOADS_SOURCE)));
$items = $mapper->select()->where($conditions)->order_by('ID', 'ASC')->run_query();
// Filter by image resolutions
if ($image_id) {
$image = is_object($image_id) ? $image_id : C_Image_Mapper::get_instance()->find($image_id);
if ($image) {
$retval = array();
$storage = C_Gallery_Storage::get_instance();
foreach ($items as $item) {
$source_width = $image->meta_data['width'];
$source_height = $image->meta_data['height'];
// the downloads themselves come from the backup as source so if possible only filter images
// whose backup file doesn't have sufficient dimensions
$backup_abspath = $storage->get_backup_abspath($image);
if (@file_exists($backup_abspath)) {
$dimensions = @getimagesize($backup_abspath);
$source_width = $dimensions[0];
$source_height = $dimensions[1];
}
if (isset($item->resolution) && $item->resolution >= 0 && ($source_height >= $item->resolution or $source_width >= $item->resolution)) {
$retval[] = $item;
}
}
$items = $retval;
}
}
return $items;
}
示例4: ngg_ajax_operation
/**
* Image edit functions via AJAX
*
* @author Alex Rabe
*
*
* @return void
*/
function ngg_ajax_operation()
{
global $wpdb;
// if nonce is not correct it returns -1
check_ajax_referer("ngg-ajax");
// check for correct capability
if (!is_user_logged_in()) {
die('-1');
}
// check for correct NextGEN capability
if (!current_user_can('NextGEN Upload images') && !current_user_can('NextGEN Manage gallery')) {
die('-1');
}
// include the ngg function
include_once dirname(__FILE__) . '/functions.php';
// Get the image id
if (isset($_POST['image'])) {
$id = (int) $_POST['image'];
// let's get the image data
$picture = nggdb::find_image($id);
// what do you want to do ?
switch ($_POST['operation']) {
case 'create_thumbnail':
$result = nggAdmin::create_thumbnail($picture);
break;
case 'resize_image':
$result = nggAdmin::resize_image($picture);
break;
case 'rotate_cw':
$result = nggAdmin::rotate_image($picture, 'CW');
nggAdmin::create_thumbnail($picture);
break;
case 'rotate_ccw':
$result = nggAdmin::rotate_image($picture, 'CCW');
nggAdmin::create_thumbnail($picture);
break;
case 'set_watermark':
$result = nggAdmin::set_watermark($picture);
break;
case 'recover_image':
$result = nggAdmin::recover_image($id) ? '1' : '0';
break;
case 'import_metadata':
$result = C_Image_Mapper::get_instance()->reimport_metadata($id) ? '1' : '0';
break;
case 'get_image_ids':
$result = nggAdmin::get_image_ids($id);
break;
default:
do_action('ngg_ajax_' . $_POST['operation']);
die('-1');
break;
}
// A success should return a '1'
die($result);
}
// The script should never stop here
die('0');
}
示例5: cheque_checkout_action
function cheque_checkout_action()
{
$retval = array();
$items = $this->param('items');
if (!$items) {
return array('error' => __('Your cart is empty', 'nggallery'));
}
$customer = array('name' => $this->param('customer_name'), 'email' => $this->param('customer_email'), 'address' => $this->param('customer_address'), 'city' => $this->param('customer_city'), 'state' => $this->param('customer_state'), 'postal' => $this->param('customer_postal'), 'country' => $this->param('customer_country'));
$retval['customer'] = $customer;
// Presently we only do basic field validation: ensure that each field is filled and that
// the country selected exists in C_NextGen_Pro_Currencies::$countries
foreach ($customer as $key => $val) {
if (empty($val)) {
$retval['error'] = __('Please fill all fields and try again', 'nggallery');
break;
}
}
// No error yet?
if (!isset($retval['error'])) {
if (empty(C_NextGen_Pro_Currencies::$countries[$customer['country']])) {
return array('error' => __('Invalid country selected, please try again.', 'nggallery'));
} else {
$customer['country'] = C_NextGen_Pro_Currencies::$countries[$customer['country']]['name'];
}
$checkout = new C_NextGen_Pro_Checkout();
$cart = new C_NextGen_Pro_Cart();
$settings = C_NextGen_Settings::get_instance();
$currency = C_NextGen_Pro_Currencies::$currencies[$settings->ecommerce_currency];
foreach ($items as $image_id => $image_items) {
if ($image = C_Image_Mapper::get_instance()->find($image_id)) {
$cart->add_image($image_id, $image);
foreach ($image_items as $item_id => $quantity) {
if ($item = C_Pricelist_Item_Mapper::get_instance()->find($item_id)) {
$item->quantity = $quantity;
$cart->add_item($image_id, $item_id, $item);
}
}
}
}
// Calculate the total
$use_home_country = intval($this->param('use_home_country'));
$order_total = $cart->get_total($use_home_country);
// Create the order
if (!$cart->has_items()) {
return array('error' => __('Your cart is empty', 'nggallery'));
}
$order = $checkout->create_order($cart->to_array(), $customer['name'], $customer['email'], $order_total, 'cheque', $customer['address'], $customer['city'], $customer['state'], $customer['postal'], $customer['country'], $use_home_country, 'unverified');
$order->status = 'unverified';
$order->gateway_admin_note = __('Payment was successfully made via Check. Once you have received payment, you can click “Verify” in the View Orders page and a confirmation email will be sent to the user.');
C_Order_Mapper::get_instance()->save($order);
$checkout->send_email_notification($order->hash);
$retval['order'] = $order->hash;
$retval['redirect'] = $checkout->get_thank_you_page_url($order->hash, TRUE);
}
return $retval;
}
示例6: index_action
function index_action()
{
wp_dequeue_script('photocrati_ajax');
wp_dequeue_script('frame_event_publisher');
wp_dequeue_script('jquery');
wp_dequeue_style('nextgen_gallery_related_images');
$img_mapper = C_Image_Mapper::get_instance();
$image_id = $this->param('image_id');
if ($image = $img_mapper->find($image_id)) {
$displayed_gallery_id = $this->param('displayed_gallery_id');
// Template parameters
$params = array('img' => $image);
// Get the url & dimensions
$named_size = $this->param('named_size');
$storage = C_Gallery_Storage::get_instance();
$dimensions = $storage->get_image_dimensions($image, $named_size);
$image->url = $storage->get_image_url($image, $named_size, TRUE);
$image->width = $dimensions['width'];
$image->height = $dimensions['height'];
// Generate the lightbox url
$router = $this->get_router();
$lightboxes = C_Lightbox_Library_Manager::get_instance();
$lightbox = $lightboxes->get(NGG_PRO_LIGHTBOX);
$uri = urldecode($this->param('uri'));
$lightbox_slug = $lightbox->values['nplModalSettings']['router_slug'];
$qs = $this->get_querystring();
if ($qs) {
$lightbox_url = $router->get_url('/', FALSE, 'root');
$lightbox_url .= "?" . $qs;
} else {
$lightbox_url = $router->get_url($uri, FALSE, 'root');
$lightbox_url .= '/';
}
// widget galleries shouldn't have a url specific to one image
if (FALSE !== strpos($displayed_gallery_id, 'widget-ngg-images-')) {
$image_id = '!';
}
$params['lightbox_url'] = "{$lightbox_url}#{$lightbox_slug}/{$displayed_gallery_id}/{$image_id}";
// Add the blog name
$params['blog_name'] = get_bloginfo('name');
if ($lightbox->values['nplModalSettings']['enable_twitter_cards']) {
$params['enable_twitter_cards'] = $lightbox->values['nplModalSettings']['enable_twitter_cards'];
$params['twitter_username'] = $lightbox->values['nplModalSettings']['twitter_username'];
}
// Add routed url
$protocol = $router->is_https() ? 'https://' : 'http://';
$params['routed_url'] = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
// Render the opengraph metadata
$this->expires('+1 day');
$this->render_view("photocrati-nextgen_pro_lightbox#opengraph", $params);
} else {
header(__('Status: 404 Image not found', 'nextgen-gallery-pro'));
echo __('Image not found', 'nextgen-gallery-pro');
}
}
示例7: upload_images
function upload_images()
{
$storage = C_Gallery_Storage::get_instance();
$image_mapper = C_Image_Mapper::get_instance();
$gallery_mapper = C_Gallery_Mapper::get_instance();
// Get Gallery ID
$galleryID = absint($_POST['galleryselect']);
if (0 == $galleryID) {
$galleryID = get_option('npu_default_gallery');
if (empty($galleryID)) {
self::show_error(__('No gallery selected.', 'nextgen-public-uploader'));
return;
}
}
// Get the Gallery
$gallery = $gallery_mapper->find($galleryID);
if (!$gallery->path) {
self::show_error(__('Failure in database, no gallery path set.', 'nextgen-public-uploader'));
return;
}
// Read Image List
foreach ($_FILES as $key => $value) {
if (0 == $_FILES[$key]['error']) {
try {
if ($storage->is_image_file($_FILES[$key]['tmp_name'])) {
$image = $storage->object->upload_base64_image($gallery, file_get_contents($_FILES[$key]['tmp_name']), $_FILES[$key]['name']);
if (get_option('npu_exclude_select')) {
$image->exclude = 1;
$image_mapper->save($image);
}
// Add to Image and Dir List
$this->arrImgNames[] = $image->filename;
$this->arrImageIds[] = $image->id();
$this->strGalleryPath = $gallery->path;
} else {
unlink($_FILES[$key]['tmp_name']);
$error_msg = sprintf(__('<strong>%s</strong> is not a valid file.', 'nextgen-public-uploader'), $_FILES[$key]['name']);
self::show_error($error_msg);
continue;
}
} catch (E_NggErrorException $ex) {
self::show_error('<strong>' . $ex->getMessage() . '</strong>');
continue;
} catch (Exception $ex) {
self::show_error('<strong>' . $ex->getMessage() . '</strong>');
continue;
}
}
}
}
示例8: get_image_file_action
/**
* Read an image file into memory and display it
*
* This is necessary for htaccess or server-side protection that blocks access to filenames ending with "_backup"
* At the moment it only supports the backup or full size image.
*/
function get_image_file_action()
{
$order_id = $this->param('order_id', FALSE);
$image_id = $this->param('image_id', FALSE);
$bail = FALSE;
if (!$order_id || !$image_id) {
$bail = TRUE;
}
$order = C_Order_Mapper::get_instance()->find_by_hash($order_id);
if (!in_array($image_id, $order->cart['image_ids'])) {
$bail = TRUE;
}
if ($order->status != 'verified') {
$bail = TRUE;
}
if ($bail) {
header('HTTP/1.1 404 Not found');
exit;
}
$storage = C_Gallery_Storage::get_instance();
if (version_compare(NGG_PLUGIN_VERSION, '2.0.66.99') <= 0) {
// Pre 2.0.67 didn't fallback to the original path if the backup file didn't exist
$imagemapper = C_Image_Mapper::get_instance();
$fs = C_Fs::get_instance();
$image = $imagemapper->find($image_id);
$gallery_path = $storage->get_gallery_abspath($image->galleryid);
$abspath = $fs->join_paths($gallery_path, $image->filename . '_backup');
if (!@file_exists($abspath)) {
$abspath = $storage->get_image_abspath($image_id, 'full');
}
} else {
$abspath = $storage->get_image_abspath($image_id, 'backup');
}
$mimetype = 'application/octet';
if (function_exists('finfo_buffer')) {
$finfo = new finfo(FILEINFO_MIME);
$mimetype = @$finfo->file($abspath);
} elseif (function_exists('mime_content_type')) {
$mimetype = @mime_content_type($abspath);
}
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename=' . basename($storage->get_image_abspath($image_id, 'full')));
header("Content-type: " . $mimetype);
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . @filesize($abspath));
readfile($abspath);
exit;
}
示例9: processor
function processor()
{
global $wpdb, $ngg, $nggdb;
// Delete a picture
if ($this->mode == 'delpic') {
//TODO:Remove also Tag reference
check_admin_referer('ngg_delpicture');
$image = $nggdb->find_image($this->pid);
if ($image) {
if ($ngg->options['deleteImg']) {
@unlink($image->imagePath);
@unlink($image->thumbPath);
@unlink($image->imagePath . '_backup');
}
$mapper = C_Image_Mapper::get_instance();
$result = $mapper->destroy($this->pid);
do_action('ngg_delete_picture', $this->pid);
if ($result) {
nggGallery::show_message(__('Picture', 'nggallery') . ' \'' . $this->pid . '\' ' . __('deleted successfully', 'nggallery'));
}
}
$this->mode = 'edit';
// show pictures
}
// Recover picture from backup
if ($this->mode == 'recoverpic') {
check_admin_referer('ngg_recoverpicture');
$image = $nggdb->find_image($this->pid);
// bring back the old image
nggAdmin::recover_image($image);
nggAdmin::create_thumbnail($image);
nggGallery::show_message(__('Operation successful. Please clear your browser cache.', "nggallery"));
$this->mode = 'edit';
// show pictures
}
// will be called after a ajax operation
if (isset($_POST['ajax_callback'])) {
if ($_POST['ajax_callback'] == 1) {
nggGallery::show_message(__('Operation successful. Please clear your browser cache.', "nggallery"));
}
}
// show sort order
if (isset($_POST['sortGallery'])) {
$this->mode = 'sort';
}
if (isset($_GET['s'])) {
$this->search_images();
}
}
示例10: set_custom_post_link
function set_custom_post_link($post_link, $post)
{
if (is_int($post)) {
$post = get_post($post);
}
if ($post->post_type == 'photocrati-comments') {
if (preg_match("/^http(s)?/", $post->post_excerpt)) {
$post_link = $post->post_excerpt;
} else {
$image_id = intval(str_replace('nextgen-comment-link-image-', '', $post->post_name));
if ($image = C_Image_Mapper::get_instance()->find($image_id)) {
$post_link = wp_nonce_url('admin.php?page=nggallery-manage-gallery&mode=edit&gid=' . $image->galleryid);
}
}
}
return $post_link;
}
示例11: add_item
function add_item($image_id, $item_id, $item_props = array())
{
// Treat an object as if it were an array
if (is_object($item_props)) {
$item_props = get_object_vars($item_props);
}
// Find the item
$item = C_Pricelist_Item_Mapper::get_instance()->find($item_id);
// Find the image
if ($image = C_Image_Mapper::get_instance()->find($image_id) and $item) {
// Ensure that the image has been added
if (!isset($this->_state[$image_id])) {
$image->items = array();
$this->_state[$image_id] = $image;
} else {
$image = $this->_state[$image_id];
}
// Ensure that the image has an items array
if (!isset($image->items)) {
$image->items = array();
}
// Ensure that the items source key exists as an array
if (!isset($image->items[$item->source])) {
$image->items[$item->source] = array();
}
// Ensure that the item's pricelist id exists as a key in the array
if (!isset($image->items[$item->source][$item->pricelist_id])) {
$image->items[$item->source][$item->pricelist_id] = array();
}
// Has the item already been added? If so, increment it's quantity
if (isset($image->items[$item->source][$item->pricelist_id][$item_id])) {
$previous_quantity = intval($image->items[$item->source][$item->pricelist_id][$item_id]->quantity);
$image->items[$item->source][$item->pricelist_id][$item_id]->quantity = $previous_quantity + intval($item_props['quantity']);
} else {
$item->quantity = isset($item_props['quantity']) ? intval($item_props['quantity']) : 1;
$image->items[$item->source][$item->pricelist_id][$item_id] = $item;
}
} else {
unset($this->_state[$image_id]);
}
}
示例12: add_gallery
/**
* Parse the gallery/imagebrowser/slideshow shortcode and return all images into an array
*
* @param string $atts
* @return
*/
function add_gallery($atts)
{
global $wpdb;
extract(shortcode_atts(array('id' => 0), $atts));
$gallery_mapper = C_Gallery_Mapper::get_instance();
if (!is_numeric($id)) {
if ($gallery = array_shift($gallery_mapper->select()->where(array('name = %s', $id))->limit(1)->run_query())) {
$id = $gallery->{$gallery->id_field};
} else {
$id = NULL;
}
}
if ($id) {
$gallery_storage = C_Gallery_Storage::get_instance();
$image_mapper = C_Image_Mapper::get_instance();
foreach ($image_mapper->find_all_for_gallery($id) as $image) {
$this->images[] = array('src' => $gallery_storage->get_image_url($image), 'title' => $image->title, 'alt' => $image->alttext);
}
}
return '';
}
示例13: paypal_standard_order_action
function paypal_standard_order_action()
{
$retval = array();
if ($items = $this->param('items')) {
$checkout = new C_NextGen_Pro_Checkout();
$cart = new C_NextGen_Pro_Cart();
$settings = C_NextGen_Settings::get_instance();
$currency = C_NextGen_Pro_Currencies::$currencies[$settings->ecommerce_currency];
foreach ($items as $image_id => $image_items) {
if ($image = C_Image_Mapper::get_instance()->find($image_id)) {
$cart->add_image($image_id, $image);
foreach ($image_items as $item_id => $quantity) {
if ($item = C_Pricelist_Item_Mapper::get_instance()->find($item_id)) {
$item->quantity = $quantity;
$cart->add_item($image_id, $item_id, $item);
}
}
}
}
// Calculate the total
$use_home_country = intval($this->param('use_home_country'));
$order_total = $cart->get_total($use_home_country);
// Create the order
if ($cart->has_items()) {
$order = $checkout->create_order($cart->to_array(), __('PayPal Customer', 'nggallery'), 'Unknown', $order_total, 'paypal_standard');
$order->status = 'unverified';
$order->use_home_country = $use_home_country;
$order->gateway_admin_note = __('Payment was successfully made via PayPal Standard, with no further payment action required.');
C_Order_Mapper::get_instance()->save($order);
$retval['order'] = $order->hash;
} else {
$retval['error'] = __('Your cart is empty', 'nggallery');
}
}
return $retval;
}
示例14: _prepare_entities
function _prepare_entities($displayed_gallery, $thumbnail_size_name)
{
$current_url = $this->object->get_routed_url(TRUE);
$storage = C_Gallery_Storage::get_instance();
$mapper = C_Image_Mapper::get_instance();
$entities = $displayed_gallery->get_included_entities();
foreach ($entities as &$entity) {
$entity_type = intval($entity->is_gallery) ? 'gallery' : 'album';
// Is the gallery actually a link to a page? Stupid feature...
if (isset($entity->pageid) && $entity->pageid > 0) {
$entity->link = get_page_link($entity->pageid);
} else {
$page_url = $current_url;
if (intval($entity->is_gallery) && !$this->param('album')) {
$page_url = $this->object->set_param_for($page_url, 'album', 'galleries');
}
$entity->link = $this->object->set_param_for($page_url, $entity_type, $entity->slug);
}
$preview_img = $mapper->find($entity->previewpic);
$entity->thumb_size = $storage->get_image_dimensions($preview_img, $thumbnail_size_name);
$entity->url = $storage->get_image_url($preview_img, $thumbnail_size_name, TRUE);
}
return $entities;
}
示例15: nggallery_manage_gallery_main
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($_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;
}
//.........这里部分代码省略.........