Plugin Directory

Changeset 759170


Ignore:
Timestamp:
08/20/2013 11:47:44 AM (13 years ago)
Author:
sydcode
Message:

Added support for "Automatic YouTube Video Posts" plugin. Fixed bug in comments display. Remove "Show More" button when no more comments. Fixed CSS problems in some themes. Updated FAQ.

Location:
youtube-comments/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • youtube-comments/trunk/class-admin.php

    r743953 r759170  
    159159        $value = empty($settings['api_key']) ? '' : $settings['api_key'];
    160160        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;
    162164    }   
    163165
  • youtube-comments/trunk/class-comments.php

    r743953 r759170  
    66   
    77    protected static $instance = null;
    8     const PLUGIN_VERSION = '1.0.0';
    9     private $start_index = 1;
     8    const PLUGIN_VERSION = '1.1.0';
    109    private $client = null;
    1110    private $youtube = null;
     
    102101        if (is_single() || is_page()) {
    103102            $settings = get_option('yc_settings');
    104             $results = empty($settings['results']) ? '10' : $settings['results'];
     103            $results = empty($settings['max_results']) ? '10' : $settings['max_results'];
    105104            wp_enqueue_style('youtube-comments', plugins_url('style.css', __FILE__), array(), self::PLUGIN_VERSION);   
    106105            wp_enqueue_script('youtube-comments', plugins_url('script.js', __FILE__), array('jquery'), self::PLUGIN_VERSION, true);
     
    121120    public function ajax_get_comments() {
    122121        $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);
    125124        exit;
    126125    }   
     
    207206    */
    208207    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   
    209214        $pattern = '%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i';
    210215        preg_match($pattern, $content, $match);
     
    221226    * @return array
    222227    */
    223     public function get_video_comments($video_id) {
     228    public function get_video_comments($video_id, $start_index = 1) {
    224229        $settings = get_option('yc_settings');
    225230        $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;
    227232        $uri = 'http://gdata.youtube.com/feeds/api/videos/' . $video_id . '/comments' . $query;
    228233        $comments = simplexml_load_file($uri);
    229         $openSearch = $comments->children('openSearch', true);
    230         $count = $openSearch->totalResults;
     234        $open_search = $comments->children('openSearch', true);
     235        $total_results = $open_search->totalResults;
    231236        include('template-comments.php');
    232237    }       
  • youtube-comments/trunk/readme.txt

    r743953 r759170  
    55Requires at least: 3.3
    66Tested up to: 3.5.2
    7 Stable tag: 1.0.0
     7Stable tag: 1.1.0
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    3636Posted comments are often delayed by a short time, even though they appear immediantly on YouTube.
    3737
    38 = 2. Why am I still logged into YouTube after signing out =
     38= 2. Why am I still logged into YouTube after signing out? =
    3939
    4040Sign 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
     44A 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
     48The redirect URI must exactly match your site's URL. An extra trailing slash is enough to cause that error.
    4149
    4250== Upgrade Notice ==
     
    4654== Changelog ==
    4755
    48 = 1.0 =
     56= 1.0.0 =
    4957* 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  
    44
    55#youtube-comments {
     6    -moz-box-sizing: content-box !important;
    67    border: 1px solid #d3d3d3;
    78    color: #333;
    89    font-size: 13px;
    910    padding: 20px;
     11}
     12
     13#youtube-comments ul.comments-list {
     14    margin: 0;
     15    overflow: hidden;
     16    padding: 0;
    1017}
    1118
     
    1926}
    2027
     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
    2138#youtube-comments .post-comment-login {
    2239    background: #eee;
    2340    border: 1px solid #ccc;
    2441    height: 48px;
    25     margin: 0 0 30px 0;
    2642    padding: 0 6px;
    2743}
     
    2945#youtube-comments .post-comment-form {
    3046    margin-bottom: 10px;
    31     position: relative;
    3247}
    3348
     
    5873
    5974#youtube-comments .comments-loading {
     75    line-height: 26px;
    6076    text-align: center;
    6177}
     
    7692#youtube-comments li.comment-item {
    7793    list-style-type: none;
    78     position: relative;
     94    overflow: hidden;
    7995    margin: 0 0 30px 0;
    8096}
    8197
    8298#youtube-comments .comment-content {
     99    float: none;
    83100    margin-left: 60px;
     101    width: auto;
    84102}
    85103   
     
    101119
    102120#youtube-comments .author-thumbnail {
    103     position: absolute;
     121    float: left;
     122    height: 48px;
    104123    width: 48px;
    105124}
     
    111130#youtube-comments .author-thumbnail img {
    112131    display: block;
     132    height: 48px;
    113133    width: 48px;
    114134}
     
    123143}
    124144
    125 #youtube-comments .show-more {
     145#youtube-comments button.show-more {
    126146    padding: 0 80px;
    127147}
     
    131151}
    132152
    133 #youtube-comments .youtube-button {
     153#youtube-comments button.youtube-button {
     154    background-color: #f8f8f8;
    134155    background-image: linear-gradient(to bottom, #fcfcfc 0px, #f8f8f8 100%);
    135156    border: 1px solid #d3d3d3;
     
    142163}
    143164
    144 #youtube-comments .youtube-button:hover {
     165#youtube-comments button.youtube-button:hover {
     166    background-color: #eee;
    145167    background-image: linear-gradient(to bottom, #f8f8f8 0px, #eee 100%);
    146168    border-color: #c6c6c6;
  • youtube-comments/trunk/template-comments.php

    r743953 r759170  
    44*/
    55
    6 $settings = get_option('yc_settings');
    7 if ($this->start_index == 1) {
     6if (1 == $start_index) {
    87?>
    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>
    109    <?php if (!empty($settings['post_comments'])) { ?>
    1110    <div class='post-comment'>
     
    7574<?php } ?>
    7675    </ul>
     76<?php   if ($total_results > ($start_index + $max_results)) { ?>
    7777    <div class='comments-pagination'>
    7878        <button type='button' class='show-more youtube-button'>Show more</button>
    7979    </div>
     80<?php } // END
  • youtube-comments/trunk/youtube-comments.php

    r743953 r759170  
    44Plugin Name: YouTube Comments
    55Description: This plugin finds YouTube links in post content and imports the video comments.
    6 Version: 1.0.0
     6Version: 1.1.0
    77Author: sydcode
    88Author URI: http://profiles.wordpress.org/sydcode
Note: See TracChangeset for help on using the changeset viewer.