Skip to content

Commit

Permalink
Version 2.5.0
Browse files Browse the repository at this point in the history
git-svn-id: http://plugins.svn.wordpress.org/media-credit/tags/2.5.0@1176338 b8457f37-d9ea-0310-8a92-e5e31aec5664
  • Loading branch information
mundschenk-at committed Jun 7, 2015
0 parents commit 4d83afe
Show file tree
Hide file tree
Showing 20 changed files with 3,631 additions and 0 deletions.
4 changes: 4 additions & 0 deletions css/jquery.autocomplete.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* New jquery-ui-autocomplete plugin */
.ui-selectmenu-menu {
z-index: 2000000 !important; /* to ensure visibility with media modal in WP >= 3.5 */
}
6 changes: 6 additions & 0 deletions css/media-credit-end.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.media-credit-end {
clear: both;
}
.media-credit {
display: none;
}
45 changes: 45 additions & 0 deletions css/media-credit-tinymce.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
span.mceMediaCreditTemp {
font-size: 11px;
font-family: Helvetica, Tahoma, Verdana, Arial, sans-serif;
position: absolute;
left: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.8);
width: 100%;
padding: 0;
margin: 0;
font-weight: normal;
}
span.mceMediaCreditTemp a {
color: blue;
font-weight: inherit;
font-size: inherit;
font-family: inherit;
}


dt.wp-caption-dt,
div.mceMediaCreditOuterTemp {
position: relative;
overflow:hidden;
}

.mceMediaCreditOuterTemp {
background: none repeat scroll 0 0 #fff;
border: 1px solid #aaa;
border-radius: 0;
margin-bottom: 6px;
text-align: center;
}

.mceMediaCreditOuterTemp a, .mceMediaCreditOuterTemp img {
border: 0 none;
padding: 0;
float: none;
margin: 0;
}

.mceMediaCreditOuterTemp.aligncenter img {
margin: auto;
margin-bottom: 6px;
}
32 changes: 32 additions & 0 deletions css/media-credit.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.media-credit {
font-size: 0.9em;
line-height: 1.2em; /*11px*/
text-align: right;
margin: 3px 5px;
display: block;
color: #909090;
}
.media-credit a {
font-weight: normal;
}
.media-credit-container {
text-align: center;
}
#recent-media-sidebar {
float: right;
text-align: center;
width: 150px;
margin-top: 10px;
padding: 10px 0;
border-top: 4px double #999;
border-bottom: 4px double #999;
}
#recent-media-sidebar .author-media {
margin-bottom: 10px;
}
#recent-media-inline .author-media {
float: left;
margin-right: 5px;
margin-bottom: 5px;
}

71 changes: 71 additions & 0 deletions display.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php

function display_author_media($author_id, $sidebar = true, $limit = 10, $link_without_parent = false, $header = "<h3>Recent Media</h3>", $exclude_unattached = true) {
$media = author_media($author_id, $limit, $exclude_unattached);
if (!$media)
return;

$id = "id = " . ($sidebar ? "recent-media-sidebar" : "recent-media-inline");
$container = "div";

echo "<div $id>$header";
foreach ($media as $post) {
setup_postdata($post);
// If media is attached to a post, link to the parent post. Otherwise, link to attachment page itself.
if ($post->post_parent > 0 || !$link_without_parent)
$image = wp_get_attachment_image($post->ID, 'thumbnail');
else
$image = wp_get_attachment_link($post->ID, 'thumbnail', true);
$image = preg_replace('/title=".*"/', '', $image); // remove title attribute from image
$link = $post->post_parent > 0 ? "<a href='" . get_permalink($post->post_parent) . "' title='" . get_the_title($post->post_parent) . "'>$image</a>" : $image;
echo "<$container class='author-media' id='attachment-$post->ID'>$link</$container>";
}
echo "</div>";
}

function author_media_and_posts($id, $include_posts = true, $limit = 0, $exclude_unattached = true) {
global $wpdb;
$posts_query = $attached = $date_query = $limit_query = "";

if ($include_posts)
$posts_query = "OR (post_type = 'post'
AND post_parent = '0'
AND post_status = 'publish')";
$posts_query .= ")";

if ($exclude_unattached)
$attached = " AND post_parent != '0'";
$attached .= ") ";

$options = get_option( MEDIA_CREDIT_OPTION );
$start_date = $options['install_date'];
if ($start_date)
$date_query = " AND post_date >= '$start_date'";

if ($limit > 0)
$limit_query = " LIMIT $limit";

$results = $wpdb->get_results( $wpdb->prepare( "
SELECT *
FROM $wpdb->posts
WHERE post_author = %d" . $date_query . "
AND ( (post_type = 'attachment' " .
$attached .
$posts_query . "
AND ID NOT IN (
SELECT post_id
FROM $wpdb->postmeta
WHERE meta_key = '" . MEDIA_CREDIT_POSTMETA_KEY . "'
)
GROUP BY ID
ORDER BY post_date DESC" . $limit_query,
$id ) );

return $results;
}

function author_media($id, $limit = 0, $exclude_unattached = true) {
return author_media_and_posts($id, false, $limit, $exclude_unattached);
}

?>
Loading

0 comments on commit 4d83afe

Please sign in to comment.