Plugin Directory

Changeset 401951


Ignore:
Timestamp:
06/28/2011 04:51:59 AM (15 years ago)
Author:
nemooon
Message:

Support OGP option.
Replaced 'Button-5' with transparent images.

Location:
mixi-check/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • mixi-check/trunk/languages/mixi-check-ja.po

    r297185 r401951  
    99"Report-Msgid-Bugs-To: http://wordpress.org/tag/mixi-check\n"
    1010"POT-Creation-Date: 2010-10-03 10:57+0000\n"
    11 "PO-Revision-Date: 2010-10-06 15:58+0900\n"
     11"PO-Revision-Date: 2011-06-28 13:47+0900\n"
    1212"Last-Translator: Keisuke Nemoto <[email protected]>\n"
    1313"Language-Team: \n"
     
    4545msgstr "ボタン5"
    4646
    47 msgid "Button type"
    48 msgstr "ボタンタイプ"
     47msgid "Button"
     48msgstr "ボタン"
     49
     50msgid "OGP meta to output"
     51msgstr "OGPメタタグを出力"
     52
     53msgid "Namespace"
     54msgstr "名前空間"
    4955
    5056msgid "Not set mixi check key"
  • mixi-check/trunk/mixi-check.php

    r394435 r401951  
    33Plugin Name: mixi Check for Sharedaddy
    44Description: Sharing to mixi Check.
    5 Version: 1.0.1
     5Version: 1.1
    66Author: nemooon
    77Author URI: http://nemooon.jp/
  • mixi-check/trunk/readme.txt

    r394435 r401951  
    11=== mixi Check for Sharedaddy ===
    22Contributors: nemooon
    3 Donate link: http://nemooon.jp/
    43Tags: mixi, Sharedaddy
    54Requires at least: 2.8
    6 Tested up to: 3.1.3
    7 Stable tag: 1.0.1
     5Tested up to: 3.2
     6Stable tag: 1.1
    87
    98Add to Sharedaddy support service.
     
    1514Sharedaddyプラグインにmixiチェックを追加します。
    1615
    17 PHP5 Require.
     16**PHP5 REQUIRE**
    1817
    1918== Installation ==
     
    3130== Changelog ==
    3231
     32= 1.1 =
     33* Support OGP option.
     34* Replaced 'Button-5' with transparent images.
     35
    3336= 1.0.1 =
    3437* Support Jetpack plugin
  • mixi-check/trunk/sharing-sources.php

    r394435 r401951  
    1818    private $button = 'button-1';
    1919    private $check_key = null;
     20    private $ogp_use = false;
     21    private $ogp_ns = 'og';
    2022   
    2123    public function __construct( $id, array $settings ) {
     
    3032        if ( isset( $settings['check_key'] ) )
    3133            $this->check_key = $settings['check_key'];
     34       
     35        if ( isset( $settings['ogp_use'] ) )
     36            $this->ogp_use = $settings['ogp_use'];
     37       
     38        if ( isset( $settings['ogp_ns'] ) )
     39            $this->ogp_ns = $settings['ogp_ns'];
    3240    }
    3341   
     
    4149   
    4250    public function display_header(){
    43        
    44         //オプションでここの出力を変える感じ。 名前空間には  "mixi" -> "og" ->  無し の優先順位
    45         echo '<meta property="og:title" content="' . get_the_title() . '" />'.PHP_EOL; //タイトル
    46         //echo '<meta property="og:description" content="' . get_the_excerpt() . '" />'.PHP_EOL; //本文
    47         //echo '<meta property="mixi:content-rating" content="1" />'.PHP_EOL; //18禁
    48        
    49         //デバイス別URLの指定 linkでもmetaでも
    50         //echo '<link rel="mixi-check-alternate" type="text/html" media="mixi-device-(smartphone|mobile|docomo|au|softbank)" href="[記事URL]" />'.PHP_EOL;
    51         //echo '<meta property="mixi:device-(smartphone|mobile|docomo|au|softbank)" content="[記事URL]" />'.PHP_EOL;
    52        
    53         //サムネイル画像 link or meta 5枚まで JPEG,PNG,GIF 1KB〜400KB 76px〜必須 180px〜推奨
    54         //echo '<link rel="mixi-check-image" type="image/jpeg" href="[画像URL]">'.PHP_EOL;
    55         //echo '<meta property="mixi:image" content="[画像URL]" />'.PHP_EOL;
    56         echo '<meta name="mixi-check-robots" CONTENT="notitle, nodescription, noimage">'.PHP_EOL;
     51        if ( $this->ogp_use ) {
     52            $ns = $this->ogp_ns;
     53            if ( is_home() ) {
     54                echo '<meta property="'.$ns.':title" content="' . get_bloginfo( 'title' ) . '" />'.PHP_EOL;
     55                echo '<meta property="'.$ns.':description" content="' . get_bloginfo( 'description' ) . '" />'.PHP_EOL;
     56                echo '<meta property="'.$ns.':type" content="blog" />'.PHP_EOL;
     57                echo '<meta property="'.$ns.':url" content="' . home_url( '/', 'http' ) . '" />'.PHP_EOL;
     58            }
     59            elseif ( is_singular() ) {
     60                the_post();
     61                $post = get_post( get_the_ID() );
     62                echo '<meta property="'.$ns.':title" content="' . $post->post_title . '" />'.PHP_EOL;
     63                echo '<meta property="'.$ns.':description" content="' . $post->post_excerpt . '" />'.PHP_EOL;
     64                echo '<meta property="'.$ns.':type" content="article" />'.PHP_EOL;
     65                echo '<meta property="'.$ns.':url" content="' . get_permalink() . '" />'.PHP_EOL;
     66               
     67                //成年コンテンツ
     68                //echo '<meta property="mixi:content-rating" content="1" />'.PHP_EOL;
     69               
     70                //サムネイル画像
     71                $images = array();
     72                if ( has_post_thumbnail() ) {
     73                    list( $src ) = wp_get_attachment_image_src( get_post_thumbnail_id() );
     74                    $images[] = $src;
     75                }
     76                preg_match_all( "/\<img[^\>]*[src] *= *[\"\']{0,1}([^\"\'\ >]*)/i", $post->post_title, $matches );
     77                $images = array_merge( $images, $matches[1] );
     78                foreach ( $images as $image ) {
     79                    echo '<meta property="'.$ns.':image" content="'.$image.'" />'.PHP_EOL;
     80                }
     81               
     82                //自動取得の制御
     83                //echo '<meta name="mixi-check-robots" CONTENT="notitle, nodescription, noimage">'.PHP_EOL;
     84               
     85                //デバイス別URLの指定 linkでもmetaでも
     86                //echo '<link rel="mixi-check-alternate" type="text/html" media="mixi-device-(smartphone|mobile|docomo|au|softbank)" href="[記事URL]" />'.PHP_EOL;
     87                //echo '<meta property="mixi:device-(smartphone|mobile|docomo|au|softbank)" content="[記事URL]" />'.PHP_EOL;
     88               
     89                rewind_posts();
     90            }
     91            else {
     92                $title = rtrim( wp_title( '|', false, 'right' ), ' |' );
     93                $parse_url = parse_url( home_url( '/' ) );
     94                $url = home_url( preg_replace( '|^'.$parse_url[ 'path' ].'|', '', $_SERVER[ 'REQUEST_URI' ] ), 'http' );
     95                echo '<meta property="'.$ns.':title" content="' . $title . '" />'.PHP_EOL;
     96                echo '<meta property="'.$ns.':type" content="blog" />'.PHP_EOL;
     97                echo '<meta property="'.$ns.':url" content="' . $url . '" />'.PHP_EOL;
     98            }
     99        }
    57100    }
    58101   
    59102    public function get_display( $post ) {
    60103        if ( !$this->check_key ) return __( 'Not set mixi check key.', 'mixi-check' );
    61         if ( $this->smart ) {
     104        if ( $this->smart )
    62105            return '<a href="http://mixi.jp/share.pl" class="mixi-check-button" data-key="'.$this->check_key.'" data-url="'.get_permalink( $post->ID ).'" data-button="'.$this->button.'">Check</a><script type="text/javascript" src="http://static.mixi.jp/js/share.js"></script>';
    63         }
    64         else {
     106        else
    65107            return $this->get_link( get_permalink( $post->ID ), __( 'mixi Check', 'mixi-check' ), __( 'Click to share on mixi Check', 'mixi-check' ), 'share=mixi-check' );
    66         }
    67        
    68108    }
    69109   
     
    113153        $this->button = 'button-1';
    114154        $this->check_key = null;
     155        $this->ogp_use = false;
     156        $this->ogp_ns = 'og';
    115157       
    116158        if ( isset( $data['smart'] ) )
     
    122164        if ( isset( $data['check_key'] ) )
    123165            $this->check_key = $data['check_key'];
     166       
     167        if ( isset( $data['ogp_use'] ) )
     168            $this->ogp_use = true;
     169       
     170        if ( isset( $data['ogp_ns'] ) )
     171            $this->ogp_ns = $data['ogp_ns'];
    124172    }
    125173   
    126174    public function get_options() {
    127175        return array(
    128             'smart' => $this->smart,
    129             'button' => $this->button,
    130             'check_key' => $this->check_key
     176            'smart'     => $this->smart,
     177            'button'    => $this->button,
     178            'check_key' => $this->check_key,
     179            'ogp_use'   => $this->ogp_use,
     180            'ogp_ns'    => $this->ogp_ns,
    131181        );
    132182    }
     
    143193        <label><input name="smart" type="checkbox"<?php if ( $this->smart ) echo ' checked="checked"'; ?>/>
    144194        <?php _e( 'Use smart button', $sharedaddy_textdomain ); ?></label><br />
    145         <label><?php _e( 'Button type', 'mixi-check' ); ?></label><br />
     195        <label><?php _e( 'Button', 'mixi-check' ); ?></label>
    146196        <select name="button">
    147197            <option value="button-1"<?php if ( $this->button == 'button-1' ) echo ' selected="selected"'; ?>><?php _e( 'button-1', 'mixi-check' ); ?></option>
     
    150200            <option value="button-4"<?php if ( $this->button == 'button-4' ) echo ' selected="selected"'; ?>><?php _e( 'button-4', 'mixi-check' ); ?></option>
    151201            <option value="button-5"<?php if ( $this->button == 'button-5' ) echo ' selected="selected"'; ?>><?php _e( 'button-5', 'mixi-check' ); ?></option>
     202        </select>
     203    </div>
     204    <div class="input">
     205        <label><input name="ogp_use" type="checkbox"<?php if ( $this->ogp_use ) echo ' checked="checked"'; ?>/>
     206        <?php _e( 'OGP meta to output', 'mixi-check' ); ?></label><br />
     207        <label><?php _e( 'Namespace', 'mixi-check' ); ?></label>
     208        <select name="ogp_ns">
     209            <option value="og"<?php if ( $this->ogp_ns == 'og' ) echo ' selected="selected"'; ?>><?php _e( 'og', 'mixi-check' ); ?></option>
     210            <option value="mixi"<?php if ( $this->ogp_ns == 'mixi' ) echo ' selected="selected"'; ?>><?php _e( 'mixi', 'mixi-check' ); ?></option>
    152211        </select>
    153212    </div>
Note: See TracChangeset for help on using the changeset viewer.