/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @param string|object $screen Screen identifier
 * @param string $context box context
 * @param mixed $object gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function cmb_do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    $i = 0;
    do {
        // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
        if (!$already_sorted && ($sorted = get_user_option("meta-box-order_{$page}"))) {
            foreach ($sorted as $box_context => $ids) {
                foreach (explode(',', $ids) as $id) {
                    if ($id && 'dashboard_browser_nag' !== $id) {
                        add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                    }
                }
            }
        }
        $already_sorted = true;
        if (!isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context])) {
            break;
        }
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    ?>

					<div id="<?php 
                    esc_attr_e($box['id']);
                    ?>
" class="<?php 
                    esc_attr_e(postbox_classes($box['id'], $page) . $hidden_class);
                    ?>
">

						<?php 
                    call_user_func($box['callback'], $object, $box);
                    ?>

					</div>

				<?php 
                }
            }
        }
    } while (0);
    return $i;
}
function wpcf_admin_metabox_begin($title, $id = false, $table_id = false, $table_show = true)
{
    $screen = get_current_screen();
    $markup = sprintf('<div class="postbox %s" %s><div title="%s" class="handlediv"><br></div><h3 class="hndle">%s</h3><div class="inside">', postbox_classes($id, $screen->id), $id ? sprintf('id="%s"', $id) : '', __('Click to toggle'), $title);
    if ($table_show) {
        $markup .= sprintf('<table %s class="wpcf-types-form-table widefat"><tbody><tr><td>', $table_id ? sprintf('id="%s"', $table_id) : '');
    }
    return array('#type' => 'markup', '#markup' => $markup);
}
 function emulate_metabox($post)
 {
     $post_type = !empty($post) ? $post->post_type : get_current_screen()->post_type;
     if ('page' !== $post_type) {
         return;
     }
     $box = array('id' => $this->args['page_slug'], 'title' => $this->args['page_title'], 'callback' => array(&$this, 'builder_settings_show'));
     $page = get_current_screen()->id;
     echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . ' hidden" ' . '>' . "\n";
     echo '<div class="handlediv" title="' . esc_attr__('Click to toggle', 'circleflip-builder') . '"><br /></div>';
     echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
     echo '<div class="inside">' . "\n";
     call_user_func($box['callback'], $post, $box);
     echo "</div>\n";
     echo "</div>\n";
 }
function do_meta_boxes($page, $context, $object) {
	global $wp_meta_boxes;

	if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
		return;

	foreach ( (array) $wp_meta_boxes[$page][$context] as $box ) {
		echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n";
		echo "<h3>{$box['title']}</h3>\n";
		echo '<div class="inside">' . "\n";
		call_user_func($box['callback'], $object, $box);
		echo "</div>\n";
		echo "</div>\n";
	}
}
</label>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<p><?php 
_e('If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.');
?>
</p>
</div>
</div>

<div id="linkadvanceddiv" class="postbox <?php 
echo postbox_classes('linkadvanceddiv', 'link');
?>
">
<h3><?php 
_e('Advanced');
?>
</h3>
<div class="inside">
<table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
	<tr class="form-field">
		<th valign="top"  scope="row"><label for="link_image"><?php 
_e('Image Address');
?>
</label></th>
		<td><input type="text" name="link_image" id="link_image" size="50" value="<?php 
echo $link->link_image;
Example #6
0
function nggallery_picturelist()
{
    // *** show picture list
    global $wpdb, $user_ID, $ngg;
    // GET variables
    $act_gid = $ngg->manage_page->gid;
    $showTags = $ngg->manage_page->showTags;
    $hideThumbs = $ngg->manage_page->hideThumbs;
    // Load the gallery metadata
    $gallery = nggdb::find_gallery($act_gid);
    if (!$gallery) {
        nggGallery::show_error(__('Gallery not found.', 'nggallery'));
        return;
    }
    // get picture values
    $picturelist = nggdb::get_gallery($act_gid, $ngg->options['galSort'], $ngg->options['galSortDir'], false);
    // get the current author
    $act_author_user = get_userdata((int) $gallery->author);
    // list all galleries
    $gallerylist = nggdb::find_all_galleries();
    ?>

<script type="text/javascript"> 
	function showDialog( windowId ) {
		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);
		// console.log (jQuery("#TB_imagelist").val());
		tb_show("", "#TB_inline?width=640&height=120&inlineId=" + windowId + "&modal=true", false);
	}
</script>
<script type="text/javascript">
<!--
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(numchecked < 1) { 
		alert('<?php 
    echo js_escape(__("No images selected", 'nggallery'));
    ?>
');
		return false; 
	} 
	//TODO: For copy to and move to we need some better way around
	if (jQuery('#bulkaction').val() == 'copy_to') {
		showDialog('selectgallery');
		return false;
	}
	
	if (jQuery('#bulkaction').val() == 'move_to') {
		showDialog('selectgallery');
		return false;
	}
		
	return confirm('<?php 
    echo sprintf(js_escape(__("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() {
	// close postboxes that should be closed
	jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');

	if (typeof postboxes != "undefined")
		postboxes.add_postbox_toggles('ngg-manage-gallery'); // WP 2.7
	else
		add_postbox_toggles('ngg-manage-gallery'); 	// WP 2.6

});
//-->
</script>

<div class="wrap">

<h2><?php 
    echo __ngettext('Gallery', 'Galleries', 1, 'nggallery');
    ?>
 : <?php 
    echo $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;
    ?>
" accept-charset="utf-8">
<?php 
    wp_nonce_field('ngg_updategallery');
    ?>

<?php 
    if ($showTags) {
        ?>
<input type="hidden" name="showTags" value="true" /><?php 
    }
    if ($hideThumbs) {
        ?>
<input type="hidden" name="hideThumbs" value="true" /><?php 
    }
    ?>
<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 type="text" size="50" name="title" value="<?php 
    echo $gallery->title;
    ?>
"  /></th>
					<th align="right"><?php 
    _e('Page Link to', 'nggallery');
    ?>
:</th>
					<th align="left">
					<select name="pageid" style="width:95%">
						<option value="0" ><?php 
    _e('Not linked', 'nggallery');
    ?>
</option>
						<?php 
    parent_dropdown($gallery->pageid);
    ?>
					</select>
					</th>
				</tr>
				<tr>
					<th align="left"><?php 
    _e('Description');
    ?>
:</th> 
					<th align="left"><textarea name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php 
    echo $gallery->galdesc;
    ?>
</textarea></th>
					<th align="right"><?php 
    _e('Preview image', 'nggallery');
    ?>
:</th>
					<th align="left">
						<select name="previewpic" style="width:95%" >
							<option value="0" ><?php 
    _e('No Picture', 'nggallery');
    ?>
</option>
							<?php 
    if (is_array($picturelist)) {
        foreach ($picturelist as $picture) {
            $selected = $picture->pid == $gallery->previewpic ? 'selected="selected" ' : '';
            echo '<option value="' . $picture->pid . '" ' . $selected . '>' . $picture->pid . ' - ' . $picture->filename . '</option>' . "\n";
        }
    }
    ?>
						</select>
					</th>
				</tr>
				<tr>
					<th align="left"><?php 
    _e('Path', 'nggallery');
    ?>
:</th> 
					<th align="left"><input <?php 
    if (IS_WPMU) {
        echo '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) {
        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>
				<tr>
					<th align="left">&nbsp;</th>
					<th align="left">&nbsp;</th>				
					<th align="right"><?php 
    _e('Create new page', 'nggallery');
    ?>
:</th>
					<th align="left"> 
					<select name="parent_id" style="width:95%">
						<option value="0"><?php 
    _e('Main page (No parent)', 'nggallery');
    ?>
</option>
						<?php 
    parent_dropdown();
    ?>
					</select>
					<input class="button-secondary action" type="submit" name="addnewpage" value="<?php 
    _e('Add page', 'nggallery');
    ?>
" id="group"/>
					</th>
				</tr>
			</table>
			
			<div class="submit">
				<input type="submit" class="button-secondary" name="scanfolder" value="<?php 
    _e("Scan Folder for new images", 'nggallery');
    ?>
 " />
				<input type="submit" class="button-primary action" name="updatepictures" value="<?php 
    _e("Save Changes", 'nggallery');
    ?>
" />
			</div>

		</div>
	</div>
</div> <!-- poststuff -->

<div class="tablenav ngg-tablenav">
	<div class="alignleft actions" style="float: left;">
	<select id="bulkaction" name="bulkaction">
		<option value="no_action" ><?php 
    _e("No action", 'nggallery');
    ?>
</option>
	<?php 
    if (!$showTags) {
        ?>
		<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="delete_images" ><?php 
        _e("Delete images", 'nggallery');
        ?>
</option>
		<option value="import_meta" ><?php 
        _e("Import metadata", 'nggallery');
        ?>
</option>
		<option value="copy_to" ><?php 
        _e("Copy to...", 'nggallery');
        ?>
</option>
		<option value="move_to"><?php 
        _e("Move to...", 'nggallery');
        ?>
</option>
	<?php 
    } else {
        ?>
	
		<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>
	<?php 
    }
    ?>
	
	</select>
	
	<?php 
    if (!$showTags) {
        ?>
 
		<input class="button-secondary" type="submit" name="doaction" value="<?php 
        _e("OK", 'nggallery');
        ?>
" onclick="if ( !checkSelected() ) return false;" />
	<?php 
    } else {
        ?>
		<input class="button-secondary" type="submit" name="showThickbox" value="<?php 
        _e("OK", 'nggallery');
        ?>
" onclick="showDialog('tags'); return false;" />
	<?php 
    }
    ?>
	
	<?php 
    if (!$hideThumbs) {
        ?>
 
		<input class="button-secondary" type="submit" name="togglethumbs" value="<?php 
        _e("Hide thumbnails ", 'nggallery');
        ?>
" /> 
	<?php 
    } else {
        ?>
		<input class="button-secondary" type="submit" name="togglethumbs" value="<?php 
        _e("Show thumbnails ", 'nggallery');
        ?>
" />
	<?php 
    }
    ?>
	
	<?php 
    if (!$showTags) {
        ?>
		<input class="button-secondary" type="submit" name="toggletags" value="<?php 
        _e("Show tags", 'nggallery');
        ?>
" /> 
	<?php 
    } else {
        ?>
		<input class="button-secondary" type="submit" name="toggletags" value="<?php 
        _e("Hide tags", 'nggallery');
        ?>
" />
	<?php 
    }
    ?>
	
	<?php 
    if ($ngg->options['galSort'] == "sortorder") {
        ?>
		<input class="button-secondary" type="submit" name="sortGallery" value="<?php 
        _e("Sort gallery", 'nggallery');
        ?>
" />
	<?php 
    }
    ?>

	</div>
	<span style="float:right; padding:2px 8px 0 0;"><input type="submit" name="updatepictures" class="button-primary action"  value="<?php 
    _e("Save Changes", 'nggallery');
    ?>
" /></span>
</div>

<table id="ngg-listimages" class="widefat" >
	<thead>
	<tr>
		<?php 
    $gallery_columns = ngg_manage_gallery_columns();
    ?>
		<?php 
    foreach ($gallery_columns as $gallery_column_key => $column_display_name) {
        switch ($gallery_column_key) {
            case 'cb':
                $class = ' class="check-column;"';
                break;
            case 'tags':
                $class = ' style="width:70%;"';
                break;
            case 'action':
                $class = ' colspan="3" style="text-align: center;"';
                break;
            default:
                $class = ' style="text-align: center;"';
        }
        ?>
			<th scope="col"<?php 
        echo $class;
        ?>
><?php 
        echo $column_display_name;
        ?>
</th>
		<?php 
    }
    ?>
	</tr>
	</thead>
	<tfoot>
	<tr>
		<?php 
    foreach ($gallery_columns as $gallery_column_key => $column_display_name) {
        switch ($gallery_column_key) {
            case 'cb':
                $class = ' class="check-column;"';
                break;
            case 'tags':
                $class = ' style="width:70%;"';
                break;
            case 'action':
                $class = ' colspan="3" style="text-align: center;"';
                break;
            default:
                $class = ' style="text-align: center;"';
        }
        ?>
			<th scope="col"<?php 
        echo $class;
        ?>
><?php 
        echo $column_display_name;
        ?>
</th>
		<?php 
    }
    ?>
	</tr>
	</tfoot>
	<tbody>
<?php 
    if ($picturelist) {
        $thumbsize = "";
        if ($ngg->options['thumbfix']) {
            $thumbsize = 'width="' . $ngg->options['thumbwidth'] . '" height="' . $ngg->options['thumbheight'] . '"';
        }
        if ($ngg->options['thumbcrop']) {
            $thumbsize = 'width="' . $ngg->options['thumbwidth'] . '" height="' . $ngg->options['thumbwidth'] . '"';
        }
        foreach ($picturelist as $picture) {
            $pid = (int) $picture->pid;
            $class = $class == 'class="alternate"' ? '' : 'class="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;
            ?>
" <?php 
            echo $class;
            ?>
 style="text-align:center">
			<?php 
            foreach ($gallery_columns as $gallery_column_key => $column_display_name) {
                switch ($gallery_column_key) {
                    case 'cb':
                        ?>
 
						<td class="check-column" scope="row"><input name="doaction[]" type="checkbox" value="<?php 
                        echo $pid;
                        ?>
" /></td>
						<?php 
                        break;
                    case 'id':
                        ?>
						<td class="id column-id" scope="row" style="text-align: center"><?php 
                        echo $pid;
                        ?>
</td>
						<?php 
                        break;
                    case 'filename':
                        ?>
						<td class="media-icon" style="text-align: left;">
							<a href="<?php 
                        echo $picture->imageURL;
                        ?>
" class="thickbox" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<?php 
                        echo $picture->filename;
                        ?>
							</a>
							<br /><?php 
                        echo $date;
                        ?>
						</td>
						<?php 
                        break;
                    case 'thumbnail':
                        ?>
						<td class="thumbnail column-thumbnail"><a href="<?php 
                        echo $picture->imageURL;
                        ?>
" class="thickbox" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<img class="thumb" src="<?php 
                        echo $picture->thumbURL;
                        ?>
" <?php 
                        echo $thumbsize;
                        ?>
 />
							</a>
							<br /><?php 
                        echo $date;
                        ?>
						</td>
						<?php 
                        break;
                    case 'alt_title_desc':
                        ?>
						<td class="altdesc column-altdesc" style="width:500px">
							<input name="alttext[<?php 
                        echo $pid;
                        ?>
]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php 
                        echo stripslashes($picture->alttext);
                        ?>
" /><br/>
							<textarea name="description[<?php 
                        echo $pid;
                        ?>
]" style="width:95%; margin-top: 2px;" rows="2" ><?php 
                        echo stripslashes($picture->description);
                        ?>
</textarea>
						</td>
						<?php 
                        break;
                    case 'description':
                        ?>
						<td class="description column-description"><textarea name="description[<?php 
                        echo $pid;
                        ?>
]" class="textarea1" cols="42" rows="2" ><?php 
                        echo stripslashes($picture->description);
                        ?>
</textarea></td>
						<?php 
                        break;
                    case 'alt_title_text':
                        ?>
						<td class="alttext column-alttext"><input name="alttext[<?php 
                        echo $pid;
                        ?>
]" type="text" size="30" value="<?php 
                        echo stripslashes($picture->alttext);
                        ?>
" /></td>
						<?php 
                        break;
                    case 'exclude':
                        ?>
						<td class="exclude column-exclude"><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 class="tags column-tags" style="width:500px;"><textarea name="tags[<?php 
                        echo $pid;
                        ?>
]" style="width:95%;" rows="2"><?php 
                        echo $picture->tags;
                        ?>
</textarea></td>
						<?php 
                        break;
                    case 'action':
                        ?>
						<td><a href="<?php 
                        echo NGGALLERY_URLPATH . "admin/showmeta.php?id=" . $pid;
                        ?>
" class="thickbox" title="<?php 
                        _e("Show Meta data", 'nggallery');
                        ?>
" ><?php 
                        _e('Meta');
                        ?>
</a></td>
						<td><a href="<?php 
                        echo wp_nonce_url("admin.php?page=nggallery-manage-gallery&amp;mode=delpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'ngg_delpicture');
                        ?>
" class="delete" onclick="javascript:check=confirm( '<?php 
                        _e("Delete this file ?", 'nggallery');
                        ?>
');if(check==false) return false;" ><?php 
                        _e('Delete');
                        ?>
</a></td>
						<?php 
                        break;
                    default:
                        ?>
						<td><?php 
                        do_action('ngg_manage_gallery_custom_column', $gallery_column_key, $pid);
                        ?>
</td>
						<?php 
                        break;
                }
                ?>
			<?php 
            }
            ?>
		</tr>
		<?php 
        }
    } else {
        echo '<tr><td colspan="8" align="center"><strong>' . __('No entries found', 'nggallery') . '</strong></td></tr>';
    }
    ?>
	
		</tbody>
	</table>
	<p class="submit"><input type="submit" class="button-primary action" name="updatepictures" value="<?php 
    _e("Save Changes", 'nggallery');
    ?>
" /></p>
	</form>	
	<br class="clear"/>
	</div><!-- /#wrap -->

	<!-- #entertags -->
	<div id="tags" style="display: none;" >
		<form id="form-tags" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<?php 
    if ($showTags) {
        ?>
<input type="hidden" name="showTags" value="true" /><?php 
    }
    ?>
		<?php 
    if ($hideThumbs) {
        ?>
<input type="hidden" name="hideThumbs" value="true" /><?php 
    }
    ?>
		<input type="hidden" id="tags_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="tags_bulkaction" name="TB_bulkaction" value="" />
		<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');
    ?>
" onclick="var numchecked = getNumChecked(document.getElementById('updategallery')); if(numchecked < 1) { alert('<?php 
    echo js_escape(__("No images selected", 'nggallery'));
    ?>
'); tb_remove(); return false } return confirm('<?php 
    echo sprintf(js_escape(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '");
    ?>
')" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="&nbsp;<?php 
    _e("Cancel", 'nggallery');
    ?>
&nbsp;" onclick="tb_remove()"/>
		    	</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');
    ?>
		<?php 
    if ($showTags) {
        ?>
<input type="hidden" name="showTags" value="true" /><?php 
    }
    ?>
		<?php 
    if ($hideThumbs) {
        ?>
<input type="hidden" name="hideThumbs" value="true" /><?php 
    }
    ?>
		<input type="hidden" id="selectgallery_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="selectgallery_bulkaction" name="TB_bulkaction" value="" />
		<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 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');
    ?>
" onclick="var numchecked = getNumChecked(document.getElementById('updategallery')); if(numchecked < 1) { alert('<?php 
    echo js_escape(__("No images selected", 'nggallery'));
    ?>
'); tb_remove(); return false } return confirm('<?php 
    echo sprintf(js_escape(__("You are about to copy or move %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '");
    ?>
')" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="<?php 
    _e("Cancel", 'nggallery');
    ?>
" onclick="tb_remove()"/>
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#selectgallery -->
	<?php 
}
Example #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 
}
Example #8
0
/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @param string|object $screen Screen identifier
 * @param string $context box context
 * @param mixed $object gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
    $i = 0;
    do {
        // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
        if (!$already_sorted && ($sorted = get_user_option("meta-box-order_{$page}"))) {
            foreach ($sorted as $box_context => $ids) {
                foreach (explode(',', $ids) as $id) {
                    if ($id && 'dashboard_browser_nag' !== $id) {
                        add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                    }
                }
            }
        }
        $already_sorted = true;
        if (!isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context])) {
            break;
        }
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $style = '';
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        echo '<div class="handlediv" title="' . esc_attr__('Click to toggle') . '"><br /></div>';
                    }
                    echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
                    echo '<div class="inside">' . "\n";
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    } while (0);
    echo "</div>";
    return $i;
}
echo attribute_escape($post->post_name);
?>
" />
</div>
</div>

<?php 
$authors = get_editable_user_ids($current_user->id);
// TODO: ROLE SYSTEM
if ($post->post_author && !in_array($post->post_author, $authors)) {
    $authors[] = $post->post_author;
}
if ($authors && count($authors) > 1) {
    ?>
<div id="authordiv" class="postbox <?php 
    echo postbox_classes('authordiv', 'post');
    ?>
">
<h3><?php 
    _e('Post Author');
    ?>
</h3>
<div class="inside">
<?php 
    wp_dropdown_users(array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author));
    ?>
</div>
</div>
<?php 
}
?>
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $page
 * @param unknown_type $context
 * @param unknown_type $object
 * @return int number of meta_boxes
 */
function do_meta_boxes($page, $context, $object) {
	global $wp_meta_boxes;
	static $already_sorted = false;

	//do_action('do_meta_boxes', $page, $context, $object);

	$hidden = get_hidden_meta_boxes($page);

	echo "<div id='$context-sortables' class='meta-box-sortables'>\n";

	$i = 0;
	do {
		// Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
		if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page", 0, false ) ) {
			foreach ( $sorted as $box_context => $ids )
				foreach ( explode(',', $ids) as $id )
					if ( $id )
						add_meta_box( $id, null, null, $page, $box_context, 'sorted' );
		}
		$already_sorted = true;

		if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
			break;

		foreach ( array('high', 'sorted', 'core', 'default', 'low') as $priority ) {
			if ( isset($wp_meta_boxes[$page][$context][$priority]) ) {
				foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
					if ( false == $box || ! $box['title'] )
						continue;
					$i++;
					$style = '';
					if ( in_array($box['id'], $hidden) )
						$style = 'style="display:none;"';
					echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '" ' . $style . '>' . "\n";
					echo '<div class="handlediv" title="' . __('Click to toggle') . '"><br /></div>';
					echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
					echo '<div class="inside">' . "\n";
					call_user_func($box['callback'], $object, $box);
					echo "</div>\n";
					echo "</div>\n";
				}
			}
		}
	} while(0);

	echo "</div>";

	return $i;

}
Example #11
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;
    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
        if (!isset($_GET['paged']) || $_GET['paged'] < 1) {
            $_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);
        // build pagination
        $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'), 'total' => $nggdb->paged['max_objects_per_page'], 'current' => $_GET['paged']));
        // get the current author
        $act_author_user = get_userdata((int) $gallery->author);
    }
    // list all galleries
    $gallerylist = $nggdb->find_all_galleries();
    //get the columns
    $gallery_columns = ngg_manage_gallery_columns();
    $hidden_columns = get_hidden_columns('nggallery-manage-images');
    $num_columns = count($gallery_columns) - count($hidden_columns);
    ?>
<!--[if IE]>
	<style type="text/css">
		.custom_thumb {
			display : none;
		}
	</style>
<![endif]-->

<script type="text/javascript"> 
<!--

function showDialog( windowId, height ) {
	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);
	// console.log (jQuery("#TB_imagelist").val());
	tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", 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(numchecked < 1) { 
		alert('<?php 
    echo js_escape(__('No images selected', 'nggallery'));
    ?>
');
		return false; 
	} 
	
	actionId = jQuery('#bulkaction').val();
	
	switch (actionId) {
		case "copy_to":
		case "move_to":
			showDialog('selectgallery', 120);
			return false;
			break;
		case "add_tags":
		case "delete_tags":
		case "overwrite_tags":
			showDialog('entertags', 120);
			return false;
			break;
		case "resize_images":
			showDialog('resize_images', 120);
			return false;
			break;
		case "new_thumbnail":
			showDialog('new_thumbnail', 160);
			return false;
			break;			
	}
	
	return confirm('<?php 
    echo sprintf(js_escape(__("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() {
	// close postboxes that should be closed
	jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
	postboxes.add_postbox_toggles('ngg-manage-gallery');

});

//-->
</script>

<div class="wrap">

<?php 
    if ($is_search) {
        ?>
<h2><?php 
        printf(__('Search results for &#8220;%s&#8221;', 'nggallery'), wp_specialchars(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['s'];
        ?>
" 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 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" />

<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 type="text" size="50" name="title" value="<?php 
        echo $gallery->title;
        ?>
"  /></th>
					<th align="right"><?php 
        _e('Page Link to', 'nggallery');
        ?>
:</th>
					<th align="left">
					<select name="pageid" style="width:95%">
						<option value="0" ><?php 
        _e('Not linked', 'nggallery');
        ?>
</option>
						<?php 
        parent_dropdown($gallery->pageid);
        ?>
					</select>
					</th>
				</tr>
				<tr>
					<th align="left"><?php 
        _e('Description');
        ?>
:</th> 
					<th align="left"><textarea name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php 
        echo $gallery->galdesc;
        ?>
</textarea></th>
					<th align="right"><?php 
        _e('Preview image', 'nggallery');
        ?>
:</th>
					<th align="left">
						<select name="previewpic" style="width:95%" >
							<option value="0" ><?php 
        _e('No Picture', 'nggallery');
        ?>
</option>
							<?php 
        if (is_array($picturelist)) {
            foreach ($picturelist as $picture) {
                $selected = $picture->pid == $gallery->previewpic ? 'selected="selected" ' : '';
                echo '<option value="' . $picture->pid . '" ' . $selected . '>' . $picture->pid . ' - ' . $picture->filename . '</option>' . "\n";
            }
        }
        ?>
						</select>
					</th>
				</tr>
				<tr>
					<th align="left"><?php 
        _e('Path', 'nggallery');
        ?>
:</th> 
					<th align="left"><input <?php 
        if (IS_WPMU) {
            echo '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) {
            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"><?php 
            _e('Create new page', 'nggallery');
            ?>
:</th>
					<th align="left"> 
					<select name="parent_id" style="width:95%">
						<option value="0"><?php 
            _e('Main page (No parent)', 'nggallery');
            ?>
</option>
						<?php 
            parent_dropdown();
            ?>
					</select>
					<input class="button-secondary action" type="submit" name="addnewpage" value="<?php 
            _e('Add page', 'nggallery');
            ?>
" id="group"/>
					</th>
				</tr>
				<?php 
        }
        ?>
			</table>
			
			<div class="submit">
				<input type="submit" class="button-secondary" name="scanfolder" value="<?php 
        _e("Scan Folder for new images", 'nggallery');
        ?>
 " />
				<input type="submit" class="button-primary action" name="updatepictures" value="<?php 
        _e("Save Changes", 'nggallery');
        ?>
" />
			</div>

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

<div class="tablenav ngg-tablenav">
	<?php 
    if ($page_links) {
        ?>
	<div class="tablenav-pages"><?php 
        $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%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 class="alignleft actions">
	<select id="bulkaction" name="bulkaction">
		<option value="no_action" ><?php 
    _e("No action", '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="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 
    print_column_headers('nggallery-manage-images');
    ?>
	</tr>
	</thead>
	<tfoot>
	<tr>
<?php 
    print_column_headers('nggallery-manage-images', false);
    ?>
	</tr>
	</tfoot>
	<tbody>
<?php 
    if ($picturelist) {
        $thumbsize = '';
        $counter = 0;
        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 ($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 <?php 
                        echo $attributes;
                        ?>
 scope="row"><input name="doaction[]" type="checkbox" value="<?php 
                        echo $pid;
                        ?>
" /></th>
						<?php 
                        break;
                    case 'id':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
 scope="row" style=""><?php 
                        echo $pid;
                        ?>
							<input type="hidden" name="pid[]" value="<?php 
                        echo $pid;
                        ?>
" />
						</td>
						<?php 
                        break;
                    case 'filename':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<strong><a href="<?php 
                        echo $picture->imageURL;
                        ?>
" class="thickbox" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<?php 
                        echo empty($picture->alttext) ? $picture->filename : 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();
                        //TODO:Add a JS edit option
                        //$actions['edit']   = '<a class="editinline" href="#">' . __('Edit') . '</a>';
                        $actions['view'] = '<a class="thickbox" href="' . $picture->imageURL . '" title="' . esc_attr(sprintf(__('View "%s"'), $picture->filename)) . '">' . __('View', 'nggallery') . '</a>';
                        $actions['meta'] = '<a class="thickbox" href="' . NGGALLERY_URLPATH . 'admin/showmeta.php?id=' . $pid . '" title="' . __('Show Meta data', 'nggallery') . '">' . __('Meta', 'nggallery') . '</a>';
                        $actions['custom_thumb'] = '<a class="thickbox" href="' . NGGALLERY_URLPATH . 'admin/edit-thumbnail.php?id=' . $pid . '" title="' . __('Customize thumbnail', 'nggallery') . '">' . __('Edit thumb', 'nggallery') . '</a>';
                        $actions['rotate'] = '<a class="thickbox" href="' . NGGALLERY_URLPATH . 'admin/rotate.php?id=' . $pid . '" title="' . __('Rotate', 'nggallery') . '">' . __('Rotate', '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':
                        // generate the thumbnail size if the meta data available
                        if (is_array($size = $picture->meta_data['thumbnail'])) {
                            $thumbsize = 'width="' . $size['width'] . '" height="' . $size['height'] . '"';
                        }
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><a href="<?php 
                        echo $picture->imageURL . '?' . mt_rand();
                        ?>
" class="thickbox" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<img class="thumb" src="<?php 
                        echo $picture->thumbURL . '?' . mt_rand();
                        ?>
" <?php 
                        echo $thumbsize;
                        ?>
 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 stripslashes($picture->alttext);
                        ?>
" /><br/>
							<textarea name="description[<?php 
                        echo $pid;
                        ?>
]" style="width:95%; margin-top: 2px;" rows="2" ><?php 
                        echo 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_gallery_custom_column', $gallery_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>
	<p class="submit"><input type="submit" class="button-primary action" name="updatepictures" value="<?php 
    _e("Save Changes", 'nggallery');
    ?>
" /></p>
	</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" type="reset" value="&nbsp;<?php 
    _e("Cancel", 'nggallery');
    ?>
&nbsp;" onclick="tb_remove()"/>
		    	</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 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" type="reset" value="<?php 
    _e("Cancel", 'nggallery');
    ?>
" onclick="tb_remove()"/>
		    	</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" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" onclick="tb_remove()"/>
		    	</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><input type="text" size="5" maxlength="5" name="thumbwidth" value="<?php 
    echo $ngg->options['thumbwidth'];
    ?>
" /> x <input type="text" size="5" maxlength="5" name="thumbheight" value="<?php 
    echo $ngg->options['thumbheight'];
    ?>
" />
				<br /><small><?php 
    _e('These values are maximum values ', 'nggallery');
    ?>
</small></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" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" onclick="tb_remove()"/>
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#new_thumbnail -->	

	<script type="text/javascript">
	/* <![CDATA[ */
	jQuery(document).ready(function(){columns.init('nggallery-manage-images');});	
	/* ]]> */
	</script>
	<?php 
}
<div id="pageorderdiv" class="postbox <?php echo postbox_classes('pageorderdiv', 'page'); ?>">
<h3><?php _e('Page Order') ?></h3>
<div class="inside">
<p><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p>
<p><?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it&#8217;ll be better in future releases.)'); ?></p>
</div>
</div>

<?php
$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
if ( $post->post_author && !in_array($post->post_author, $authors) )
	$authors[] = $post->post_author;
if ( $authors && count( $authors ) > 1 ) :
?>
<div id="pageauthordiv" class="postbox <?php echo postbox_classes('pageauthordiv', 'page'); ?>">
<h3><?php _e('Page Author'); ?></h3>
<div class="inside">
<?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
</div>
</div>
<?php endif; ?>

<?php do_meta_boxes('page', 'advanced', $post); ?>

</div>
</div>

</div>

</form>
			<li><a href="<?php 
    printf('#%s', $meta_box['id']);
    ?>
"><?php 
    echo $meta_box['title'];
    ?>
</a></li>
		<?php 
}
?>
	</ul>
	<?php 
foreach ($view_args['meta_boxes'] as $meta_box) {
    ?>
		<div id="<?php 
    echo $meta_box['id'];
    ?>
" class="postbox <?php 
    echo postbox_classes($meta_box['id'], 'campaign');
    ?>
">
			<div class="inside">
				<?php 
    call_user_func($meta_box['callback'], $post, $meta_box);
    ?>
			</div>
		</div>
	<?php 
}
?>
</div>
						<input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
						<?php _e('date') ?></label>
						<label for="romantic">
						<input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
						<?php _e('sweetheart') ?></label>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<p><?php _e('If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.'); ?></p>
</div>
</div>

<div id="linkadvanceddiv" class="postbox <?php echo postbox_classes('linkadvanceddiv', 'link'); ?>">
<h3><?php _e('Advanced') ?></h3>
<div class="inside">
<table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
	<tr class="form-field">
		<th valign="top"  scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
		<td><input type="text" name="link_image" id="link_image" size="50" value="<?php echo $link->link_image; ?>" style="width: 95%" /></td>
	</tr>
	<tr class="form-field">
		<th valign="top"  scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>
		<td><input name="link_rss" type="text" id="rss_uri" value="<?php echo $link->link_rss; ?>" size="50" style="width: 95%" /></td>
	</tr>
	<tr class="form-field">
		<th valign="top"  scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>
		<td><textarea name="link_notes" id="link_notes" cols="50" rows="10" style="width: 95%"><?php echo $link->link_notes; ?></textarea></td>
	</tr>
Example #15
0
 /**
  *	Get saved postbox states
  */
 function postbox_classes($css_id)
 {
     if (function_exists('postbox_classes')) {
         return postbox_classes($css_id, $this->page);
     } else {
         return "";
     }
 }
Example #16
0
function lici_wp_add_bottom_post() {
	global $wpdb;
	$options_table = $wpdb->prefix."lici_options";


	echo '
	<div id="licipost" class="postbox ' . postbox_classes("licipost", "post") . '" style="margin: 0px; background: #fff">
<h3><a class="togbox">+</a> LIci Crossposter - Параметры</h3>
<div class="inside">';
	echo '<h4>В какие журналы постить?</h4><ul>';
	// begin

	$logins = $wpdb->get_results("SELECT * FROM $options_table ORDER BY `id`;");
	foreach($logins as $login) {
		$sel = ($login->autocheck === "yes")? " checked='checked'" : "";
		print "<li><label><input type='checkbox' name='lici-".$login->id."' value='".$login->id."'$sel /> ".$login->login."</label></li>";
	}
	// end
	print "</ul><p>&nbsp;</p><h4>Опции журнала</h4>";

	// begin
	$logins = $wpdb->get_results("SELECT * FROM $options_table ORDER BY `id`;");
	print "
	<select id='sellici' onChange='javascript:licioptions();'>
	";
	foreach ($logins as $login) {
		print "<option value='".$login->id."'$sel>".$login->login."</option>\n";
	}
	print "
	</select>
	";
	$show = true;
	foreach ($logins as $login) {
		if ($show) { print "<div id='lici-".$login->id."'><script type='text/javascript'> licinow = 'lici-".$login->id."';</script>"; $show = !$show; } else {
			print "<div id='lici-".$login->id."' style='display: none;'>";
		}
		print "<br />
		<label><input type='checkbox' name='lici-".$login->id."-comments' ";
        if ($login->comments === "yes") { print "checked='checked'";}
		print " /> Разрешить комментарии</label><br />
		<label><input type='checkbox' name='lici-".$login->id."-closerec' ";
		if ($login->closerec === "yes") { print "checked='checked'";}
		print " /> Закрыть запись</label><br />
		<label><input type='checkbox' name='lici-".$login->id."-original' ";
		if ($login->original === "yes") { print "checked='checked'";}
		print " /> Ссылка на оригинал</label><br />
		<label><input type='checkbox' name='lici-".$login->id."-onlymore'  ";
		if ($login->onlymore === "yes") { print "checked='checked'";}
		print " /> Кросспостить только до &lt;!--more--&gt;</label><br /><br />";
		print "
		<table width='100%'>
		 <tr>
		  <td><label>Я сейчас нахожусь<br /><input type='text' value='".$login->whereiam."' name='lici-".$login->id."-whereiam' /></label></td>
		 </tr>
		 <tr>
		  <td><label>Мой настрой<br /><input type='text' value='".$login->mood."' name='lici-".$login->id."-mood' /></label></td>
		 </tr>
		 <tr>
		  <td><label>Я слушаю<br /><input type='text' value='".$login->listening."' name='lici-".$login->id."-listening' /></label></td>
		  </tr>
		</table>
		";
		print "</div>";
	}
	// end
	echo '</div></div>';
	?>

	<script type="text/javascript">
	jQuery(document).ready(function(){
		jQuery(".side-info").before("<div style='display: block; background: white; width: 100%; height: 10px;'></div>");
		jQuery(".side-info").before(jQuery("#licipost"));
	});
	</script>
	<?
}
Example #17
0
function do_meta_boxes($page, $context, $object)
{
    global $wp_meta_boxes;
    do_action('do_meta_boxes', $page, $context, $object);
    if (!isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context])) {
        return;
    }
    foreach (array('high', 'core', 'default', 'low') as $priority) {
        foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
            if (false === $box) {
                continue;
            }
            echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n";
            echo "<h3>{$box['title']}</h3>\n";
            echo '<div class="inside">' . "\n";
            call_user_func($box['callback'], $object, $box);
            echo "</div>\n";
            echo "</div>\n";
        }
    }
}
	/**
	 * Suggested tags
	 *
	 */
	function helperSuggestTags() {
		?>
		<div id="suggestedtags" class="postbox <?php echo postbox_classes('suggestedtags', 'post'); ?>">
			<h3>
				<img style="float:right; display:none;" id="st_ajax_loading" src="<?php echo $this->info['install_url']; ?>/inc/images/ajax-loader.gif" alt="Ajax loading" />
				<?php _e('Suggested tags from :', 'simpletags'); ?>&nbsp;&nbsp;
				<a class="local_db" href="#suggestedtags"><?php _e('Local tags', 'simpletags'); ?></a>&nbsp;&nbsp;-&nbsp;&nbsp;
				<a class="yahoo_api" href="#suggestedtags"><?php _e('Yahoo', 'simpletags'); ?></a>&nbsp;&nbsp;-&nbsp;&nbsp;
				<a class="ttn_api" href="#suggestedtags"><?php _e('Tag The Net', 'simpletags'); ?></a>
			</h3>
			<div class="inside container_clicktags">
				<?php _e('Choose a provider to get suggested tags (local, yahoo or tag the net).', 'simpletags'); ?>
				<div class="clear"></div>
			</div>
		</div>
	   	<script type="text/javascript">
	    // <![CDATA[
			var site_url = '<?php echo $this->info['siteurl']; ?>';
		// ]]>
	    </script>
	    <script type="text/javascript" src="<?php echo $this->info['install_url'] ?>/inc/js/helper-suggested-tags.js?ver=<?php echo $this->version; ?>""></script>
    <?php
	}
Example #19
0
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);
	    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');

	jQuery('.iedit').mouseover(
		function(e){
			jQuery(this).parent().find('.row-actions').css('visibility', 'hidden');
			jQuery(this).next('.row_actions:first').find('.row-actions:first').css('visibility', 'visible');
		}
	);

	$(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=' . esc_attr($_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">
			<?php 
            $controller->render_gallery_fields();
            ?>

			<div class="submit">
				<?php 
            if (wpmu_enable_function('wpmuImportFolder') && nggGallery::current_user_can('NextGEN Import image 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'], $total_number_of_images, $items_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>
		<?php 
    $controller->render_image_row_header();
    ?>
	</thead>
	<tfoot>
		<?php 
    $controller->render_image_row_header();
    ?>
	</tfoot>
	<tbody id="the-list">
<?php 
    if ($picturelist) {
        $thumbsize = '';
        $storage = C_Gallery_Storage::get_instance();
        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($gallery->author) && $is_search) {
                continue;
            }
            $counter++;
            $picture->imageURL = $storage->get_image_url($picture);
            $picture->thumbURL = $storage->get_thumb_url($picture);
            $picture->imagePath = $storage->get_image_abspath($picture);
            $picture->thumbPath = $storage->get_thumb_abspath($picture);
            echo apply_filters('ngg_manage_images_row', $picture, $counter);
        }
    }
    // 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'], $total_number_of_images, $items_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 
}
Example #20
0
</label>                              
		                                
		                                <?php 
do_action('fa_extra_image_fields', $options);
?>
		                        	</div> 
	                            </div>
							</div>
						</div>
	                    <?php 
$plugin_options = FA_plugin_options();
if (1 == $plugin_options['auto_insert']) {
    ?>
	                    <!-- Automatic display options panel -->
	                    <div id="fa-autoplacement-options" class="postbox <?php 
    echo postbox_classes('fa-autoplacement-options', $page_hook);
    ?>
">
	                        <div title="<?php 
    _e('Click to toggle', 'falite');
    ?>
" class="handlediv"><br></div><h3 class="hndle"><span><?php 
    _e('Automatic placement Options', 'falite');
    ?>
</span></h3>
	                        <div class="inside">
	                            <div class="section">
	                                <p class="info">
	                                	<?php 
    _e('Automatic placement works by placing the slider before the first loop it find into the pages you selected the slider to be displayed.', 'falite');
    ?>
    /**
     * Fallback for WP < 3.6
     */
    public static function do_accordion_sections($screen, $context, $object)
    {
        if (function_exists('do_accordion_sections')) {
            return do_accordion_sections($screen, $context, $object);
        }
        global $wp_meta_boxes;
        $screen = 'formidable_page_formidable-styles';
        $screen = convert_to_screen($screen);
        $page = $screen->id;
        $hidden = get_hidden_meta_boxes($screen);
        ?>
    	<div id="side-sortables" class="accordion-container">
    	<?php 
        $i = 0;
        $first_open = false;
        do {
            if (!isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context])) {
                break;
            }
            foreach (array('high', 'core', 'default', 'low') as $priority) {
                if (isset($wp_meta_boxes[$page][$context][$priority])) {
                    foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
                        if (false == $box || !$box['title']) {
                            continue;
                        }
                        $i++;
                        $hidden_class = in_array($box['id'], $hidden) ? 'hide-if-js' : '';
                        if (!$first_open && empty($hidden_class)) {
                            $first_open = true;
                        }
                        ?>
						<div class="postbox <?php 
                        echo esc_attr($box['id']);
                        ?>
">
						<div class="handlediv" title="<?php 
                        esc_attr_e('Click to toggle', 'formidable');
                        ?>
"><br/></div>
                        <h3 class='hndle'><span><?php 
                        echo esc_html($box['title']);
                        ?>
</span></h3>
                            <div class="accordion-section-content <?php 
                        postbox_classes($box['id'], $page);
                        ?>
">
                                <div class="inside">
    								<?php 
                        call_user_func($box['callback'], $object, $box);
                        ?>
    							</div><!-- .inside -->
    						</div><!-- .accordion-section-content -->
    					</div><!-- .postbox -->
    					<?php 
                    }
                }
            }
        } while (0);
        ?>
    	</div><!-- .accordion-container -->
    	<?php 
        return $i;
    }
</div>

<div id="slugdiv" class="postbox <?php echo postbox_classes('slugdiv', 'post'); ?>">
<h3><?php _e('Post Slug') ?></h3>
<div class="inside">
<input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
</div>
</div>

<?php
$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
if ( $post->post_author && !in_array($post->post_author, $authors) )
	$authors[] = $post->post_author;
if ( $authors && count( $authors ) > 1 ) :
?>
<div id="authordiv" class="postbox <?php echo postbox_classes('authordiv', 'post'); ?>">
<h3><?php _e('Post Author'); ?></h3>
<div class="inside">
<?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
</div>
</div>
<?php endif; ?>

<?php do_meta_boxes('post', 'advanced', $post); ?>

<?php do_action('dbx_post_sidebar'); ?>
</div>
</div>

</div>
function flag_picturelist()
{
    // *** show picture list
    global $wpdb, $flagdb, $user_ID, $flag;
    // Look if its a search result
    $is_search = isset($_GET['s']) ? true : false;
    if ($is_search) {
        // fetch the imagelist
        $picturelist = $flag->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 = $flag->manage_page->gid;
        // Load the gallery metadata
        $gallery = $flagdb->find_gallery($act_gid);
        if (!$gallery) {
            flagGallery::show_error(__('Gallery not found.', 'flash-album-gallery'));
            return;
        }
        // Check if you have the correct capability
        if (!flagAdmin::can_manage_this_gallery($gallery->author)) {
            flagGallery::show_error(__('Sorry, you have no access here', 'flash-album-gallery'));
            return;
        }
        // look for pagination
        if (!isset($_GET['paged']) || intval($_GET['paged']) < 1) {
            $_GET['paged'] = 1;
        }
        $_GET['paged'] = intval($_GET['paged']);
        $start = ($_GET['paged'] - 1) * 50;
        // get picture values
        $picturelist = $flagdb->get_gallery($act_gid, $flag->options['galSort'], $flag->options['galSortDir'], false, 50, $start);
        // build pagination
        $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'), 'total' => $flagdb->paged['max_objects_per_page'], 'current' => $_GET['paged']));
        // get the current author
        $act_author_user = get_userdata((int) $gallery->author);
    }
    // list all galleries
    $gallerylist = $flagdb->find_all_galleries();
    //get the columns
    $gallery_columns = flag_manage_gallery_columns();
    $hidden_columns = get_hidden_columns('flag-manage-images');
    $hidden_columns = array_filter($hidden_columns);
    if ($picturelist) {
        $a_hits = array();
        foreach ($picturelist as $p) {
            $a_hits[] = $p->hitcounter;
        }
        if (!array_sum($a_hits)) {
            $hidden_columns[] = 'views_likes';
            $hidden_columns[] = 'rating';
        }
    } else {
        $hidden_columns[] = 'views_likes';
        $hidden_columns[] = 'rating';
    }
    $num_columns = count($gallery_columns) - count($hidden_columns);
    ?>
<!--[if lt IE 8]>
	<style type="text/css">
		.custom_thumb {
			display : none;
		}
	</style>
<![endif]-->

<script type="text/javascript"> 
//<![CDATA[
function showDialog( windowId, height ) {
	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);
	// console.log (jQuery("#TB_imagelist").val());
	tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", 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(numchecked < 1) { 
		alert('<?php 
    echo esc_js(__("No images selected", "flash-album-gallery"));
    ?>
');
		return false; 
	} 
	
	actionId = jQuery('#bulkaction').val();
	
	switch (actionId) {
		case "copy_to":
		case "move_to":
			showDialog('selectgallery', 120);
			return false;
			break;
		case "resize_images":
			showDialog('resize_images', 120);
			return false;
			break;
		case "new_thumbnail":
			showDialog('new_thumbnail', 160);
			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.", 'flash-album-gallery')), "' + numchecked + '");
    ?>
');
}

jQuery(document).ready( function() {
	// close postboxes that should be closed
	jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
	postboxes.add_postbox_toggles('flag-manage-gallery'); 

});
//]]>
</script>

<div class="flag-wrap">

<?php 
    if ($is_search) {
        ?>
<h2><?php 
        printf(__('Search results for &#8220;%s&#8221;', 'flash-album-gallery'), esc_html(stripslashes(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', 'flash-album-gallery');
        ?>
:</label>
	<input type="hidden" id="page-name" name="page" value="flag-manage-gallery" />
	<input type="text" id="media-search-input" name="s" value="<?php 
        the_search_query();
        ?>
" />
	<input type="submit" value="<?php 
        _e('Search Images', 'flash-album-gallery');
        ?>
" class="button" />
</p>
</form>

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

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

<?php 
    } else {
        ?>

<h2><?php 
        echo _n('Gallery', 'Galleries', 1, 'flash-album-gallery');
        ?>
 : <?php 
        echo esc_html($gallery->title);
        ?>
</h2>
<select name="select_gid" style="width:180px; float: right; margin: -20px 3px 0 0;" onchange="window.location.href=this.options[this.selectedIndex].value">
	<option selected="selected"><?php 
        _e('Choose another gallery', 'flash-album-gallery');
        ?>
</option>
<?php 
        foreach ($gallerylist as $gal) {
            if ($gal->gid != $act_gid) {
                ?>
	<option value="<?php 
                echo wp_nonce_url($flag->manage_page->base_page . "&amp;mode=edit&amp;gid=" . $gal->gid, 'flag_editgallery');
                ?>
" ><?php 
                if ($flag->options['albSort'] == 'gid') {
                    echo $gal->gid . ' - ';
                }
                echo esc_html(stripslashes($gal->title));
                if ($flag->options['albSort'] == 'title') {
                    echo ' (' . $gal->gid . ')';
                }
                ?>
</option>
<?php 
            }
        }
        ?>
</select>

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

<div id="poststuff" class="metabox-holder">
	<?php 
        wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
        ?>
<div id="post-body"><div id="post-body-content"><div id="normal-sortables" class="meta-box-sortables ui-sortable" style="position: relative;">
	<div id="flagalleryset" class="postbox <?php 
        echo postbox_classes('flagalleryset', 'flag-manage-gallery');
        ?>
" >
		<div class="handlediv" title="Click to toggle"><br/></div>
		<h3 class="hndle"><span><?php 
        _e('Gallery settings', 'flash-album-gallery');
        ?>
</span></h3>
		<div class="inside">
			<table class="flag-form-table" >
				<tr>
					<th align="right" scope="row"><?php 
        _e('Title', 'flash-album-gallery');
        ?>
:</th>
					<td> </td>
					<td align="left"><input type="text" size="50" name="title" value="<?php 
        echo esc_html($gallery->title);
        ?>
"  /></td>
				</tr>
				<tr>
					<th align="right" valign="top" scope="row"><?php 
        _e('Description', 'flash-album-gallery');
        ?>
:</th>
					<td> </td>
					<td align="left"><textarea name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php 
        echo esc_html($gallery->galdesc);
        ?>
</textarea></td>
				</tr>
				<tr>
					<th align="right" scope="row"><?php 
        _e('Path', 'flash-album-gallery');
        ?>
:</th>
					<td> </td>
					<td align="left"><input <?php 
        if (IS_WPMU) {
            echo 'readonly = "readonly"';
        }
        ?>
 type="text" size="50" name="path" value="<?php 
        echo esc_attr($gallery->path);
        ?>
"  /></td>
				</tr>
				<tr>
					<th align="right" scope="row"><?php 
        _e('Author', 'flash-album-gallery');
        ?>
:</th>
					<td> </td>
					<td align="left">
					<?php 
        $editable_ids = $flag->manage_page->get_editable_user_ids($user_ID);
        if ($editable_ids && count($editable_ids) > 1) {
            wp_dropdown_users(array('include' => $editable_ids, 'name' => 'author', 'selected' => empty($gallery->author) ? 0 : $gallery->author));
        } else {
            echo $act_author_user->display_name;
        }
        ?>
						<input type="hidden" name="previewpic" value="<?php 
        if (is_array($picturelist)) {
            echo $picturelist[0]->pid;
        }
        ?>
" />
					</td>
				</tr>
			</table>
			
			<div class="submit">
				<input type="submit" class="button-secondary" name="scanfolder" value="<?php 
        _e("Scan Folder for new images", 'flash-album-gallery');
        ?>
 " />
				<input type="submit" class="button-primary action" name="updatepictures" value="<?php 
        _e("Save Changes", 'flash-album-gallery');
        ?>
" />
			</div>
			<div class="clear"></div>
		</div>
	</div>
</div></div></div>
</div> <!-- poststuff -->
<?php 
    }
    ?>

<div class="tablenav flag-tablenav">
	<?php 
    if ($page_links) {
        ?>
	<div class="tablenav-pages"><?php 
        $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $flagdb->paged['objects_per_page'] + 1), number_format_i18n(min($_GET['paged'] * $flagdb->paged['objects_per_page'], $flagdb->paged['total_objects'])), number_format_i18n($flagdb->paged['total_objects']), $page_links);
        echo $page_links_text;
        ?>
</div>
	<?php 
    }
    ?>
	<div class="alignleft actions">
	<select id="bulkaction" name="bulkaction" class="alignleft">
		<option value="no_action" ><?php 
    _e("No action", 'flash-album-gallery');
    ?>
</option>
		<option value="webview_images" ><?php 
    _e("Create images optimized for web", 'flash-album-gallery');
    ?>
</option>
		<option value="new_thumbnail" ><?php 
    _e("Create new thumbnails", 'flash-album-gallery');
    ?>
</option>
		<option value="resize_images" ><?php 
    _e("Resize images", 'flash-album-gallery');
    ?>
</option>
		<option value="delete_images" ><?php 
    _e("Delete images", 'flash-album-gallery');
    ?>
</option>
		<option value="import_meta" ><?php 
    _e("Import metadata", 'flash-album-gallery');
    ?>
</option>
		<option value="copy_meta" ><?php 
    _e("Metadata to description", 'flash-album-gallery');
    ?>
</option>
		<option value="copy_to" ><?php 
    _e("Copy to...", 'flash-album-gallery');
    ?>
</option>
		<option value="move_to"><?php 
    _e("Move to...", 'flash-album-gallery');
    ?>
</option>
		<option value="reset_counters"><?php 
    _e("Reset Views & Likes counters", 'flash-album-gallery');
    ?>
</option>
		<?php 
    do_action('flag_manage_images_bulkaction');
    ?>
	</select>
	<input class="button-secondary alignleft" style="margin-right:10px;" type="submit" name="showThickbox" value="<?php 
    _e("OK", 'flash-album-gallery');
    ?>
" onclick="if ( !checkSelected() ) return false;" />
	
<?php 
    if ($flag->options['galSort'] == "sortorder" && !$is_search) {
        ?>
	<a href="<?php 
        echo wp_nonce_url($flag->manage_page->base_page . "&amp;mode=sort&amp;gid=" . $act_gid, 'flag_sortgallery');
        ?>
" class="button-secondary alignleft" style="margin:1px 10px 0 0;"><?php 
        _e("Sort gallery", 'flash-album-gallery');
        ?>
</a>
<?php 
    }
    if (current_user_can('FlAG Upload images') && !$is_search) {
        ?>
	<a href="<?php 
        echo wp_nonce_url($flag->manage_page->base_page . "&amp;gid=" . $act_gid . "&amp;tabs=1", 'flag_addimages');
        ?>
" class="button-secondary alignleft" style="margin:1px 10px 0 0;"><?php 
        _e("Add Images", 'flash-album-gallery');
        ?>
</a>
<?php 
    }
    ?>
	<input type="submit" name="updatepictures" class="button-primary action alignleft"  value="<?php 
    _e("Save Changes", 'flash-album-gallery');
    ?>
" />
	</div>
</div>

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

	<thead>
	<tr>
<?php 
    foreach ($gallery_columns as $key => $value) {
        if (in_array($key, $hidden_columns)) {
            continue;
        }
        echo $cols = '<th class="manage-column column-' . $key . '">' . $value . '</td>';
    }
    ?>
	</tr>
	</thead>
	<tfoot>
	<tr>
<?php 
    foreach ($gallery_columns as $key => $value) {
        if (in_array($key, $hidden_columns)) {
            continue;
        }
        if ($key == 'cb') {
            $value = '';
        }
        echo $cols = '<th class="manage-column column-' . $key . '">' . $value . '</td>';
    }
    ?>
	</tr>
	</tfoot>
	<tbody>
<?php 
    $counter = 0;
    if ($picturelist) {
        $rt = array(24.5, 45.7, 54.8, 59.3, 64.7, 68.90000000000001, 71.5, 73.7, 75.90000000000001, 77.09999999999999);
        foreach ($picturelist as $picture) {
            //for search result we need to check the capatibiliy
            if (!flagAdmin::can_manage_this_gallery($picture->author) && $is_search) {
                continue;
            }
            $hits = intval($picture->hitcounter);
            $votes = intval($picture->total_votes);
            $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 ($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)) {
                    continue;
                }
                $attributes = "{$class}{$style}";
                switch ($gallery_column_key) {
                    case 'cb':
                        ?>
 
						<th <?php 
                        echo $attributes;
                        ?>
 scope="row"><input name="doaction[]" type="checkbox" value="<?php 
                        echo $pid;
                        ?>
" /></th>
						<?php 
                        break;
                    case 'id':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        echo $pid;
                        ?>
							<input type="hidden" name="pid[]" value="<?php 
                        echo $pid;
                        ?>
" />
						</td>
						<?php 
                        break;
                    case 'thumbnail':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><a href="<?php 
                        echo $picture->imageURL;
                        ?>
" class="thickbox" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<img class="thumb" src="<?php 
                        echo $picture->thumbURL;
                        ?>
" id="thumb-<?php 
                        echo $pid;
                        ?>
" />
							</a>
						</td>
						<?php 
                        break;
                    case 'filename':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<strong><a href="<?php 
                        echo $picture->imageURL;
                        ?>
" class="thickbox" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<?php 
                        echo $picture->filename;
                        ?>
							</a></strong>
							<br /><?php 
                        echo $date;
                        ?>
							<?php 
                        if (!empty($picture->meta_data['width'])) {
                            echo '<br />' . __('Image size: ', 'flash-album-gallery') . $picture->meta_data['width'] . 'x' . $picture->meta_data['height'];
                        } else {
                            $imgpath = WINABSPATH . $picture->path . "/" . $picture->filename;
                            $img = @getimagesize($imgpath);
                            if ($img) {
                                echo '<br />' . __('Image size: ', 'flash-album-gallery') . $img[0] . 'x' . $img[1];
                            }
                        }
                        ?>
							<?php 
                        if (!empty($picture->meta_data['thumbnail'])) {
                            echo '<br />' . __('Thumbnail size: ', 'flash-album-gallery') . $picture->meta_data['thumbnail']['width'] . 'x' . $picture->meta_data['thumbnail']['height'];
                        }
                        ?>
							<?php 
                        if (!empty($picture->meta_data['webview'])) {
                            echo '<br />' . __('Optimized size: ', 'flash-album-gallery') . $picture->meta_data['webview'][0] . 'x' . $picture->meta_data['webview'][1];
                        } else {
                            echo '<br />' . __('Optimized size: ', 'flash-album-gallery') . __('not optimized ', 'flash-album-gallery');
                        }
                        ?>
							<p>
							<?php 
                        $actions = array();
                        $actions['view'] = '<a class="thickbox" href="' . $picture->imageURL . '" title="' . esc_attr(sprintf(__('View "%s"'), $picture->filename)) . '">' . __('View', 'flash-album-gallery') . '</a>';
                        $actions['meta'] = '<a class="thickbox" href="' . FLAG_URLPATH . 'admin/showmeta.php?id=' . $pid . '" title="' . __('Show Meta data', 'flash-album-gallery') . '">' . __('Meta', 'flash-album-gallery') . '</a>';
                        $actions['custom_thumb'] = '<a class="thickbox" href="' . FLAG_URLPATH . 'admin/manage_thumbnail.php?id=' . $pid . '" title="' . __('Customize thumbnail', 'flash-album-gallery') . '">' . __('Edit thumb', 'flash-album-gallery') . '</a>';
                        $actions['delete'] = '<a class="submitdelete" href="' . wp_nonce_url("admin.php?page=flag-manage-gallery&amp;mode=delpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'flag_delpicture') . '" class="delete column-delete" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Delete "%s"', 'flash-album-gallery'), $picture->filename)) . '\');if(check==false) return false;">' . __('Delete', 'flash-album-gallery') . '</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 'views_likes':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<input name="hitcounter[<?php 
                        echo $pid;
                        ?>
]" type="text" value="<?php 
                        echo stripslashes($picture->hitcounter);
                        ?>
" /> /
							<input name="total_votes[<?php 
                        echo $pid;
                        ?>
]" type="text" value="<?php 
                        echo stripslashes($picture->total_votes);
                        ?>
" />
						</td>
						<?php 
                        break;
                    case 'rating':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<?php 
                        if ($votes == 0) {
                            $like = '0.0';
                        } else {
                            if ($votes < 11) {
                                $like = $rt[$votes - 1];
                            } else {
                                $like = round((100 - $rt[count($rt) - 1]) / ($hits > 0 ? $hits : 1) * ($votes <= $hits ? $votes : $hits), 1) + $rt[count($rt) - 1];
                            }
                        }
                        echo $like . '%';
                        ?>
						</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_html(stripslashes($picture->alttext));
                        ?>
" /><br/>
							<textarea name="description[<?php 
                        echo $pid;
                        ?>
]" style="width:95%; margin-top: 2px;" rows="2" ><?php 
                        echo esc_html(stripslashes($picture->description));
                        ?>
</textarea>
							<input name="link[<?php 
                        echo $pid;
                        ?>
]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php 
                        echo esc_attr(stripslashes($picture->link));
                        ?>
" placeholder="(optional for skin) URL for linked button" /><br/>
						</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 'views' :
                        						?>
                        						<td <?php echo $attributes; ?>><?php echo $picture->hitcounter; ?></td>
                        						<?php						
                        					break;
                        */
                    /* 
                    case 'views' :
                    						?>
                    						<td <?php echo $attributes; ?>><?php echo $picture->hitcounter; ?></td>
                    						<?php						
                    					break;
                    */
                    default:
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        do_action('flag_manage_gallery_custom_column', $gallery_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', 'flash-album-gallery') . '</strong></td></tr>';
    }
    ?>
	
		</tbody>
	</table>
	<p class="submit"><input type="submit" class="button-primary action" name="updatepictures" value="<?php 
    _e("Save Changes", 'flash-album-gallery');
    ?>
" /></p>
	</form>	
	<br class="clear"/>
	</div><!-- /#wrap -->

	<!-- #selectgallery -->
	<div id="selectgallery" style="display: none;" >
		<form id="form-select-gallery" method="POST" action="<?php 
    echo admin_url('admin.php?page=flag-manage-gallery&mode=edit&gid=' . $act_gid . '&paged=1');
    ?>
" accept-charset="utf-8">
		<?php 
    wp_nonce_field('flag_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:', 'flash-album-gallery');
    ?>
&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_html($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", 'flash-album-gallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="<?php 
    _e("Cancel", 'flash-album-gallery');
    ?>
" onclick="tb_remove()"/>
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#selectgallery -->

	<!-- #resize_images -->
	<div id="resize_images" style="display: none;" >
		<form id="form-resize-images" method="POST" action="<?php 
    echo admin_url('admin.php?page=flag-manage-gallery&mode=edit&gid=' . $act_gid . '&paged=1');
    ?>
" accept-charset="utf-8">
		<?php 
    wp_nonce_field('flag_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', 'flash-album-gallery');
    ?>
:</strong>
				</td>
				<td>
					<input type="text" size="5" name="imgWidth" value="<?php 
    echo $flag->options['imgWidth'];
    ?>
" /> x <input type="text" size="5" name="imgHeight" value="<?php 
    echo $flag->options['imgHeight'];
    ?>
" />
					<br /><small><?php 
    _e('Width x height (in pixel). Grand Flagallery will keep ratio size', 'flash-album-gallery');
    ?>
</small>
				</td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php 
    _e('OK', 'flash-album-gallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'flash-album-gallery');
    ?>
&nbsp;" onclick="tb_remove()"/>
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#resize_images -->

	<!-- #new_thumbnail -->
	<div id="new_thumbnail" style="display: none;" >
		<form id="form-new-thumbnail" method="POST" action="<?php 
    echo admin_url('admin.php?page=flag-manage-gallery&mode=edit&gid=' . $act_gid . '&paged=1');
    ?>
" accept-charset="utf-8">
		<?php 
    wp_nonce_field('flag_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)', 'flash-album-gallery');
    ?>
</th>
				<td><input type="text" size="5" maxlength="5" name="thumbWidth" value="<?php 
    echo $flag->options['thumbWidth'];
    ?>
" /> x <input type="text" size="5" maxlength="5" name="thumbHeight" value="<?php 
    echo $flag->options['thumbHeight'];
    ?>
" />
				<br /><small><?php 
    _e('These values are maximum values ', 'flash-album-gallery');
    ?>
</small></td>
			</tr>
			<tr valign="top">
				<th align="left"><?php 
    _e('Set fix dimension', 'flash-album-gallery');
    ?>
</th>
				<td><input type="checkbox" name="thumbFix" value="1" <?php 
    checked('1', $flag->options['thumbFix']);
    ?>
 />
				<br /><small><?php 
    _e('Ignore the aspect ratio, no portrait thumbnails', 'flash-album-gallery');
    ?>
</small></td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php 
    _e('OK', 'flash-album-gallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'flash-album-gallery');
    ?>
&nbsp;" onclick="tb_remove()"/>
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#new_thumbnail -->	

	<script type="text/javascript">
	/* <![CDATA[ */
	jQuery(document).ready(function(){columns.init('flag-manage-images');});	
	/* ]]> */
	</script>
	<?php 
}
_e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it&#8217;ll be better in future releases.)');
?>
</p>
</div>
</div>

<?php 
$authors = get_editable_user_ids($current_user->id);
// TODO: ROLE SYSTEM
if ($post->post_author && !in_array($post->post_author, $authors)) {
    $authors[] = $post->post_author;
}
if ($authors && count($authors) > 1) {
    ?>
<div id="pageauthordiv" class="postbox <?php 
    echo postbox_classes('pageauthordiv', 'page');
    ?>
">
<h3><?php 
    _e('Page Author');
    ?>
</h3>
<div class="inside">
<?php 
    wp_dropdown_users(array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author));
    ?>
</div>
</div>
<?php 
}
?>
Example #25
0
/**
 * Meta Box Accordion Template Function
 *
 * Largely made up of abstracted code from do_meta_boxes(), this
 * function serves to build meta boxes as list items for display as
 * a collapsible accordion.
 *
 * @since 3.6.0
 *
 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
 *
 * @param string|object $screen  The screen identifier.
 * @param string        $context The meta box context.
 * @param mixed         $object  gets passed to the section callback function as first parameter.
 * @return int number of meta boxes as accordion sections.
 */
function do_accordion_sections($screen, $context, $object)
{
    global $wp_meta_boxes;
    wp_enqueue_script('accordion');
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    ?>
	<div id="side-sortables" class="accordion-container">
		<ul class="outer-border">
	<?php 
    $i = 0;
    $first_open = false;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? 'hide-if-js' : '';
                    $open_class = '';
                    if (!$first_open && empty($hidden_class)) {
                        $first_open = true;
                        $open_class = 'open';
                    }
                    ?>
					<li class="control-section accordion-section <?php 
                    echo $hidden_class;
                    ?>
 <?php 
                    echo $open_class;
                    ?>
 <?php 
                    echo esc_attr($box['id']);
                    ?>
" id="<?php 
                    echo esc_attr($box['id']);
                    ?>
">
						<h3 class="accordion-section-title hndle" tabindex="0">
							<?php 
                    echo esc_html($box['title']);
                    ?>
							<span class="screen-reader-text"><?php 
                    _e('Press return or enter to open this section');
                    ?>
</span>
						</h3>
						<div class="accordion-section-content <?php 
                    postbox_classes($box['id'], $page);
                    ?>
">
							<div class="inside">
								<?php 
                    call_user_func($box['callback'], $object, $box);
                    ?>
							</div><!-- .inside -->
						</div><!-- .accordion-section-content -->
					</li><!-- .accordion-section -->
					<?php 
                }
            }
        }
    }
    ?>
		</ul><!-- .outer-border -->
	</div><!-- .accordion-container -->
	<?php 
    return $i;
}
/**
 * Meta Box Accordion Template Function
 *
 * Largely made up of abstracted code from {@link do_meta_boxes()}, this
 * function serves to build meta boxes as list items for display as
 * a collapsible accordion.
 *
 * @since 3.6.0
 *
 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
 *
 * @param string|object $screen The screen identifier.
 * @param string $context The meta box context.
 * @param mixed $object gets passed to the section callback function as first parameter.
 * @return int number of meta boxes as accordion sections.
 */
function do_accordion_sections($screen, $context, $object)
{
    global $wp_meta_boxes;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    ?>
	<div id="side-sortables" class="accordion-container">
		<ul class="outer-border">
	<?php 
    $i = 0;
    do {
        if (!isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context])) {
            break;
        }
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? 'hide-if-js' : '';
                    ?>
					<li class="control-section accordion-section <?php 
                    echo $hidden_class;
                    ?>
 <?php 
                    echo esc_attr($box['id']);
                    ?>
" id="<?php 
                    echo esc_attr($box['id']);
                    ?>
">
						<h3 class="accordion-section-title hndle" tabindex="0" title="<?php 
                    echo esc_attr($box['title']);
                    ?>
"><?php 
                    echo esc_html($box['title']);
                    ?>
</h3>
						<div class="accordion-section-content <?php 
                    postbox_classes($box['id'], $page);
                    ?>
">
							<div class="inside">
								<?php 
                    call_user_func($box['callback'], $object, $box);
                    ?>
							</div><!-- .inside -->
						</div><!-- .accordion-section-content -->
					</li><!-- .accordion-section -->
					<?php 
                }
            }
        }
    } while (0);
    ?>
		</ul><!-- .outer-border -->
	</div><!-- .accordion-container -->
	<?php 
    return $i;
}