Changeset 759170
- Timestamp:
- 08/20/2013 11:47:44 AM (13 years ago)
- Location:
- youtube-comments/trunk
- Files:
-
- 6 edited
-
class-admin.php (modified) (1 diff)
-
class-comments.php (modified) (5 diffs)
-
readme.txt (modified) (3 diffs)
-
style.css (modified) (10 diffs)
-
template-comments.php (modified) (2 diffs)
-
youtube-comments.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
youtube-comments/trunk/class-admin.php
r743953 r759170 159 159 $value = empty($settings['api_key']) ? '' : $settings['api_key']; 160 160 echo "<input type='text' name='yc_settings[api_key]' class='regular-text' value='" . $value . "' />" . PHP_EOL; 161 echo "<p class='description'>Enter your credentials for the YouTube API.<br />Register <a href='https://developers.google.com/youtube/registering_an_application' target='_blank'>here</a> to create credentials.</p>" . PHP_EOL; 161 echo "<p class='description'>Enter your credentials for the YouTube API.<br />"; 162 echo "Register <a href='https://developers.google.com/youtube/registering_an_application' target='_blank'>here</a> to get credentials.<br />"; 163 echo "Credentials are only used to post comments.</p>" . PHP_EOL; 162 164 } 163 165 -
youtube-comments/trunk/class-comments.php
r743953 r759170 6 6 7 7 protected static $instance = null; 8 const PLUGIN_VERSION = '1.0.0'; 9 private $start_index = 1; 8 const PLUGIN_VERSION = '1.1.0'; 10 9 private $client = null; 11 10 private $youtube = null; … … 102 101 if (is_single() || is_page()) { 103 102 $settings = get_option('yc_settings'); 104 $results = empty($settings[' results']) ? '10' : $settings['results'];103 $results = empty($settings['max_results']) ? '10' : $settings['max_results']; 105 104 wp_enqueue_style('youtube-comments', plugins_url('style.css', __FILE__), array(), self::PLUGIN_VERSION); 106 105 wp_enqueue_script('youtube-comments', plugins_url('script.js', __FILE__), array('jquery'), self::PLUGIN_VERSION, true); … … 121 120 public function ajax_get_comments() { 122 121 $video_id = $_POST['videoID']; 123 $ this->start_index = $_POST['startIndex'];124 $this->get_video_comments($video_id );122 $start_index = $_POST['startIndex']; 123 $this->get_video_comments($video_id, $start_index); 125 124 exit; 126 125 } … … 207 206 */ 208 207 public function get_first_video($content) { 208 global $post; 209 // Check for "Automatic YouTube Video Posts" plugin 210 $video_id = get_post_meta($post->ID, '_tern_wp_youtube_video', true); 211 if (!empty($video_id)) 212 return $video_id; 213 // Otherwise, search content for link 209 214 $pattern = '%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i'; 210 215 preg_match($pattern, $content, $match); … … 221 226 * @return array 222 227 */ 223 public function get_video_comments($video_id ) {228 public function get_video_comments($video_id, $start_index = 1) { 224 229 $settings = get_option('yc_settings'); 225 230 $max_results = empty($settings['max_results']) ? '10' : $settings['max_results']; 226 $query = '?start-index=' . $ this->start_index . '&max-results=' . $max_results;231 $query = '?start-index=' . $start_index . '&max-results=' . $max_results; 227 232 $uri = 'http://gdata.youtube.com/feeds/api/videos/' . $video_id . '/comments' . $query; 228 233 $comments = simplexml_load_file($uri); 229 $open Search = $comments->children('openSearch', true);230 $ count = $openSearch->totalResults;234 $open_search = $comments->children('openSearch', true); 235 $total_results = $open_search->totalResults; 231 236 include('template-comments.php'); 232 237 } -
youtube-comments/trunk/readme.txt
r743953 r759170 5 5 Requires at least: 3.3 6 6 Tested up to: 3.5.2 7 Stable tag: 1. 0.07 Stable tag: 1.1.0 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 36 36 Posted comments are often delayed by a short time, even though they appear immediantly on YouTube. 37 37 38 = 2. Why am I still logged into YouTube after signing out =38 = 2. Why am I still logged into YouTube after signing out? = 39 39 40 40 Sign out only cancels the ability to post comments. Users can only sign out completely from YouTube/Google. 41 42 = 3. Do I need to signup for a developer account? = 43 44 A developer account is only required to post comments. You can show comments without a developer account. 45 46 = 4. Why do I get an error message "redirect_uri_mismatch" when signing in? = 47 48 The redirect URI must exactly match your site's URL. An extra trailing slash is enough to cause that error. 41 49 42 50 == Upgrade Notice == … … 46 54 == Changelog == 47 55 48 = 1.0 =56 = 1.0.0 = 49 57 * First release 58 59 = 1.1.0 = 60 * Added support for "Automatic YouTube Video Posts" plugin. 61 * Fixed bug in comment display. 62 * Updated the readme. -
youtube-comments/trunk/style.css
r743953 r759170 4 4 5 5 #youtube-comments { 6 -moz-box-sizing: content-box !important; 6 7 border: 1px solid #d3d3d3; 7 8 color: #333; 8 9 font-size: 13px; 9 10 padding: 20px; 11 } 12 13 #youtube-comments ul.comments-list { 14 margin: 0; 15 overflow: hidden; 16 padding: 0; 10 17 } 11 18 … … 19 26 } 20 27 28 #youtube-comments img { 29 border: none; 30 margin: 0; 31 padding: 0; 32 } 33 34 #youtube-comments .post-comment { 35 margin: 0 0 25px 0; 36 } 37 21 38 #youtube-comments .post-comment-login { 22 39 background: #eee; 23 40 border: 1px solid #ccc; 24 41 height: 48px; 25 margin: 0 0 30px 0;26 42 padding: 0 6px; 27 43 } … … 29 45 #youtube-comments .post-comment-form { 30 46 margin-bottom: 10px; 31 position: relative;32 47 } 33 48 … … 58 73 59 74 #youtube-comments .comments-loading { 75 line-height: 26px; 60 76 text-align: center; 61 77 } … … 76 92 #youtube-comments li.comment-item { 77 93 list-style-type: none; 78 position: relative;94 overflow: hidden; 79 95 margin: 0 0 30px 0; 80 96 } 81 97 82 98 #youtube-comments .comment-content { 99 float: none; 83 100 margin-left: 60px; 101 width: auto; 84 102 } 85 103 … … 101 119 102 120 #youtube-comments .author-thumbnail { 103 position: absolute; 121 float: left; 122 height: 48px; 104 123 width: 48px; 105 124 } … … 111 130 #youtube-comments .author-thumbnail img { 112 131 display: block; 132 height: 48px; 113 133 width: 48px; 114 134 } … … 123 143 } 124 144 125 #youtube-comments .show-more {145 #youtube-comments button.show-more { 126 146 padding: 0 80px; 127 147 } … … 131 151 } 132 152 133 #youtube-comments .youtube-button { 153 #youtube-comments button.youtube-button { 154 background-color: #f8f8f8; 134 155 background-image: linear-gradient(to bottom, #fcfcfc 0px, #f8f8f8 100%); 135 156 border: 1px solid #d3d3d3; … … 142 163 } 143 164 144 #youtube-comments .youtube-button:hover { 165 #youtube-comments button.youtube-button:hover { 166 background-color: #eee; 145 167 background-image: linear-gradient(to bottom, #f8f8f8 0px, #eee 100%); 146 168 border-color: #c6c6c6; -
youtube-comments/trunk/template-comments.php
r743953 r759170 4 4 */ 5 5 6 $settings = get_option('yc_settings'); 7 if ($this->start_index == 1) { 6 if (1 == $start_index) { 8 7 ?> 9 <h4 class='comments-heading'><strong>All Comments</strong> (<?php echo $ count; ?>)</h4>8 <h4 class='comments-heading'><strong>All Comments</strong> (<?php echo $total_results; ?>)</h4> 10 9 <?php if (!empty($settings['post_comments'])) { ?> 11 10 <div class='post-comment'> … … 75 74 <?php } ?> 76 75 </ul> 76 <?php if ($total_results > ($start_index + $max_results)) { ?> 77 77 <div class='comments-pagination'> 78 78 <button type='button' class='show-more youtube-button'>Show more</button> 79 79 </div> 80 <?php } // END -
youtube-comments/trunk/youtube-comments.php
r743953 r759170 4 4 Plugin Name: YouTube Comments 5 5 Description: This plugin finds YouTube links in post content and imports the video comments. 6 Version: 1. 0.06 Version: 1.1.0 7 7 Author: sydcode 8 8 Author URI: http://profiles.wordpress.org/sydcode
Note: See TracChangeset
for help on using the changeset viewer.