function yoimg_print_media_templates() { ?> <script> jQuery(document).ready(function() { yoimgExtendMediaLightboxTemplate( '<?php echo yoimg_get_edit_image_anchor('{{ data.id }}', 'thumbnail', 'display:block;text-decoration:none;'); ?> ', '<?php echo yoimg_get_edit_image_anchor('{{ data.id }}', 'thumbnail', 'text-decoration:none;'); ?> ', '<?php echo yoimg_get_edit_image_anchor('{{ data.id }}', 'thumbnail', '', 'button'); ?> ', '<?php echo yoimg_get_edit_image_anchor('{{ data.attachment.id }}', 'thumbnail', '', 'button'); ?> ' ); }); </script> <?php }
function yoimg_media_row_actions($actions, $post, $detached) { if (wp_attachment_is_image($post->ID) && current_user_can('edit_post', $post->ID)) { $actions['yoimg_crop'] = yoimg_get_edit_image_anchor($post->ID); } return $actions; }
function yoimg_admin_post_thumbnail_html($content, $id) { if (!has_post_thumbnail($id)) { return $content; } $image_id = get_post_thumbnail_id($id); if (!current_user_can('edit_post', $image_id)) { return $content; } $edit_crops_content = '<p>' . yoimg_get_edit_image_anchor($image_id) . '</p>'; return $content . $edit_crops_content; }
function yoimg_get_edit_image_anchor_ajax() { $classes = empty($_POST['classes']) ? 'edit-attachment' : esc_html($_POST['classes']); echo yoimg_get_edit_image_anchor(esc_html($_POST['post']), 'thumbnail', 'margin-right:10px;', $classes); die; }