XPressME Integration Kit

Trac


Ignore:
Timestamp:
Apr 2, 2009, 6:37:19 PM (16 years ago)
Author:
toemon
Message:

bump Ver0.22 #85 トラックバックリスト表示実装 #80 デフォルトテーマデザイン完了

Location:
trunk/wp-content/plugins/xpressme
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/plugins/xpressme/include/custom_functions.php

    r147 r150  
    11<?php 
    22         
    3 function xpress_list_pings($comment, $args, $depth) { 
    4        $GLOBALS['comment'] = $comment; 
     3function xpress_list_pings($trackback, $args, $depth) { 
     4       $GLOBALS['comment'] = $trackback; 
    55        echo '<li id="comment-<?php comment_ID(); ?>">'; 
    66        comment_author_link(); 
     
    374374} 
    375375 
     376function xpress_pings_list($show = false){ 
     377         
     378        $trackbacks = xpress_get_pings(); 
     379        $output = '<ol id="xpress_pingslist"> '; 
     380 
     381        foreach ($trackbacks as $trackback){ 
     382                $list = date(get_settings('date_format'),$trackback['date']) . ' <a target="_blank" href="' . $trackback['site_url'] . '" rel="external nofollow">' . sprintf(__('From %1$s on site %2$s','xpressme'),$trackback['title'],$trackback['site_name']) . "</a>\n" ; 
     383 
     384                $output .=  '<li>'; 
     385                $output .=  $list ; 
     386                $output .=  '</li>'; 
     387 
     388        } 
     389        $output .= '</ol>' ; 
     390        if ($show) echo $output; else return $output; 
     391} 
     392 
     393function xpress_pings_number( $zero = false, $one = false, $more = false, $deprecated = '' ) { 
     394        $pings = xpress_get_pings(); 
     395        if (empty($pings)){ 
     396                $number = 0; 
     397        }else { 
     398                $number = count($pings); 
     399        } 
     400        if ( $number > 1 ) 
     401                $output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% TrackBack/Pingback', 'xpressme') : $more); 
     402        elseif ( $number == 0 ) 
     403                $output = ( false === $zero ) ? __('No Trackback/Pingback', 'xpressme') : $zero; 
     404        else // must be one 
     405                $output = ( false === $one ) ? __('One Trackback/Pingback', 'xpressme') : $one; 
     406 
     407        echo $output; 
     408} 
     409 
     410 
     411function xpress_get_pings() 
     412{ 
     413        global $withcomments, $post, $wpdb, $id, $trackback, $user_login, $user_ID, $user_identity; 
     414 
     415        if ( ! (is_single() || is_page() || $withcomments) ) 
     416                return; 
     417 
     418        /** @todo Use API instead of SELECTs. */ 
     419        if ( $user_ID) { 
     420                $trackbacks = $wpdb->get_results(sprintf("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND (comment_approved = '1' OR ( user_id = %d AND comment_approved = '0' ) ) AND ( comment_type = 'trackback' OR comment_type = 'pingback' ) ORDER BY comment_date", $post->ID, $user_ID)); 
     421        } else if ( empty($trackback_author) ) { 
     422                $trackbacks = $wpdb->get_results(sprintf("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' AND ( comment_type = 'trackback' OR comment_type = 'pingback' ) ORDER BY comment_date", $post->ID)); 
     423        } else { 
     424                $trackbacks = $wpdb->get_results(sprintf("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND ( comment_approved = '1' OR ( comment_author = %s AND comment_author_email = %s AND comment_approved = '0' ) ) AND ( comment_type = 'trackback' OR comment_type = 'pingback' ) ORDER BY comment_date", $post->ID, $trackback_author, $trackback_author_email)); 
     425        } 
     426 
     427        if ($trackbacks){ 
     428                $ret = array(); 
     429                foreach ($trackbacks as $trackback){ 
     430 
     431                        $pattern = '<strong>(.*)<\/strong>(.*)'; 
     432                        if ( preg_match ( "/".$pattern."/i", $trackback->comment_content , $match ) ){ 
     433                                $title = $match[1]; 
     434                                $content = $match[2]; 
     435                        } 
     436                        if (empty($title)) $title = $trackback->comment_author; 
     437 
     438 
     439                        $row_data = array( 
     440                                'ID'            => $trackback->comment_ID , 
     441                                'post_ID'       => $trackback->comment_post_ID , 
     442                                'site_name' => $trackback->comment_author , 
     443                                'site_url' => $trackback->comment_author_url , 
     444                                'title' => $title , 
     445                                'content' => $content , 
     446                                'date'          => $trackback->comment_date , 
     447                                'date_gmt'              => $trackback->comment_date_gmt , 
     448                                'agent'         => $trackback->comment_agent , 
     449                                'type'          => $trackback->comment_type , 
     450                                'IP'            => $trackback->comment_author_IP , 
     451                        ); 
     452                        array_push($ret,$row_data); 
     453                } 
     454                return $ret; 
     455        } 
     456                        return false; 
     457} 
    376458?> 
  • trunk/wp-content/plugins/xpressme/language/xpressme-ja.po

    r147 r150  
    33"Project-Id-Version: XPressME Plugin\n" 
    44"POT-Creation-Date: \n" 
    5 "PO-Revision-Date: 2009-04-01 16:42+0900\n" 
     5"PO-Revision-Date: 2009-04-02 14:04+0900\n" 
    66"Last-Translator: toemon <toychee@toemon.com>\n" 
    77"Language-Team: \n" 
     
    342342msgstr "&#8216;%s&#8217; の検索結果" 
    343343 
     344#: include/custom_functions.php:382 
     345#, php-format 
     346msgid "From %1$s on site %2$s" 
     347msgstr "サイト %2$s の %1$s より" 
     348 
     349#: include/custom_functions.php:398 
     350#, fuzzy 
     351msgid "% TrackBack/Pingback" 
     352msgstr "トラックバック・ピンバック % 件" 
     353 
     354#: include/custom_functions.php:400 
     355msgid "No Trackback/Pingback" 
     356msgstr "トラックバック・ピンバックはありません" 
     357 
     358#: include/custom_functions.php:402 
     359msgid "One Trackback/Pingback" 
     360msgstr "トラックバック・ピンバック 1 件" 
     361 
    344362#: include/xpress_common_functions.php:202 
    345363msgid "Themes" 
Note: See TracChangeset for help on using the changeset viewer.