-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://plugins.svn.wordpress.org/media-credit/tags/2.5.0@1176338 b8457f37-d9ea-0310-8a92-e5e31aec5664
- Loading branch information
0 parents
commit 4d83afe
Showing
20 changed files
with
3,631 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.media-credit-end { | ||
clear: both; | ||
} | ||
.media-credit { | ||
display: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
?> |
Oops, something went wrong.