Ejemplo n.º 1
0
 /**
  * Refreshes the attachments/embed list based on the user selection.
  */
 static function ajax_refresh_attachments()
 {
     if (!check_ajax_referer('app_mm_nonce_' . $_POST['mm_id'], 'mm_nonce')) {
         die;
     }
     extract($_POST);
     $attachment_ids = $embed_attach_ids = array();
     // retrieve the options for the current media manager
     $media_manager_options = appthemes_get_media_manager_options($mm_id);
     if (isset($_POST['attachments'])) {
         $attachment_ids = array_merge($attachment_ids, $_POST['attachments']);
         $attachment_ids = array_map('intval', $attachment_ids);
         $attachment_ids = array_unique($attachment_ids);
     }
     if (!empty($_POST['embed_urls'])) {
         $posted_embed_urls = sanitize_text_field($_POST['embed_urls']);
         $embed_urls = explode(',', $posted_embed_urls);
     }
     if (!empty($attachment_ids)) {
         $attachments = appthemes_output_attachments($attachment_ids, $media_manager_options['attributes']['attachment_params'], $echo = false);
         echo json_encode(array('output' => $attachments));
     }
     if (!empty($embed_urls)) {
         $embeds = appthemes_output_embed_urls($embed_urls, $media_manager_options['attributes']['embed_params'], $echo = false);
         echo json_encode(array('url' => $posted_embed_urls, 'output' => $embeds));
     }
     die;
 }
Ejemplo n.º 2
0
if (empty($atts['attachment_ids']) && empty($atts['embed_urls'])) {
    ?>

				<div class="no-media">
					<?php 
    echo $atts['no_media_text'];
    ?>
				</div>

			<?php 
}
?>

			<div class="media-attachments">
				<?php 
appthemes_output_attachments($atts['attachment_ids'], $atts['attachment_params']);
?>
			</div>
			<div class="media-embeds">
				<?php 
appthemes_output_embed_urls($atts['embed_urls'], $atts['embed_params']);
?>
			</div>
		</div>

		<input type="button" group_id="<?php 
echo esc_attr($atts['id']);
?>
" class="button small upload_button" upload_text="<?php 
echo esc_attr($atts['upload_text']);
?>