|
function popup_wysija_browse($errors){ |
|
} |
|
/* Add this code - begin */ |
|
function popup_ngg_browse($errors){ |
|
echo $this->messages(true); |
|
?><div id="overlay"><img id="loader" src="<?php echo WYSIJA_URL ?>img/wpspin_light.gif" /></div> |
|
<div class="popup_content media-ngg-browse"> |
|
<?php |
|
global $redir_tab, $type; |
|
|
|
$redir_tab = 'ngg_browse'; |
|
media_upload_header(); |
|
?> |
|
|
|
<form enctype="multipart/form-data" method="post" action="" class="media-upload-form validate" id="ngg-browse-form"> |
|
<?php |
|
$secure=array('action'=>"medias"); |
|
$this->secure($secure); ?> |
|
|
|
<div id="media-items" class="clearfix"><?php echo $this->_get_ngg_media_items(); ?></div> |
|
</form> |
|
<?php $this->_alt_close(); ?> |
|
</div> |
|
<?php |
|
} |
|
|
|
function _get_ngg_media_items() { |
|
$output = ''; |
|
global $nggdb; |
|
|
|
$galleryId = isset( $_POST['galleryId'] ) ? intval($_POST['galleryId']) : null; |
|
$galleryList = $nggdb->find_all_galleries(); |
|
if (! is_array($galleryList) || empty($galleryList)) |
|
return "<em>".__('No galleries have been yet created.', 'nggallery')."</em>"; |
|
|
|
// Display gallery selector |
|
$output .= '<div class="clearfix">'; |
|
$output .= '<select name="galleryId">'; |
|
foreach($galleryList as $gallery) { |
|
$selected = ($gallery->gid == $galleryId )? ' selected="selected"' : ""; |
|
$output .= '<option value="'.$gallery->gid.'"'.$selected.' >'.$gallery->title.'</option>'."\n"; |
|
} |
|
$output .= '</select>'; |
|
$output .= '<input type="submit" value="'.esc_attr( __('Select »','nggallery') ).'" class="button-secondary" />'; |
|
$output .= '</div>'; |
|
|
|
// Display image selector |
|
if ($galleryId != null) { |
|
$gallery = $nggdb->find_gallery($galleryId); |
|
$selectedImages=$this->_getSelectedImages(); |
|
|
|
foreach ( $nggdb->get_gallery($galleryId) as $image ) { |
|
$id = 'ngg-'.$image->pid; |
|
$thumbURL = $image->thumbURL; |
|
$imageURL = $image->imageURL; |
|
$alt = $image->alttext; |
|
$width = $image->meta_data['width']; |
|
$height = $image->meta_data['height']; |
|
|
|
// Use http scheme instead of https in case admin is forced to https but website isn't using https |
|
if (defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN && ! preg_match('@^https\://@i', home_url())) { |
|
$thumbURL = preg_replace('@^(http)s(\://)@i', '${1}${2}', $thumbURL); |
|
$imageURL = preg_replace('@^(http)s(\://)@i', '${1}${2}', $imageURL); |
|
} |
|
|
|
$classname=""; |
|
if(isset($selectedImages["wp-".$id])) $classname=" selected "; |
|
|
|
$output.='<div class="wysija-thumb'.$classname.'">'; |
|
$output .= '<img title="'.$alt.'" alt="'.$alt.'" src="'.$thumbURL.'" class="thumbnail" />'; |
|
$output.='<span class="identifier">'.$id.'</span> |
|
<span class="width">'.$width.'</span> |
|
<span class="height">'.$height.'</span> |
|
<span class="url">'.$imageURL.'</span> |
|
<span class="thumb_url">'.$thumbURL.'</span></div>'; |
|
} |
|
} |
|
|
|
return $output; |
|
} |
|
/* Add this code - end */ |