<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Patch on php-tips.com</title>
    <link>https://php-tips.com/tags/patch/</link>
    <description>Recent content in Patch on php-tips.com</description>
    <generator>Hugo</generator>
    <language>ja</language>
    <lastBuildDate>Thu, 20 Aug 2009 22:18:47 +0900</lastBuildDate>
    <atom:link href="https://php-tips.com/tags/patch/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>WPtoTwitterプラグインのテストとして長いタイトルのエントリーを投稿して見る</title>
      <link>https://php-tips.com/2009/08/20/wptotwitter%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3%E3%81%AE%E3%83%86%E3%82%B9%E3%83%88%E3%81%A8%E3%81%97%E3%81%A6%E9%95%B7%E3%81%84%E3%82%BF%E3%82%A4%E3%83%88%E3%83%AB%E3%81%AE%E3%82%A8%E3%83%B3/</link>
      <pubDate>Thu, 20 Aug 2009 22:18:47 +0900</pubDate>
      <guid>https://php-tips.com/2009/08/20/wptotwitter%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3%E3%81%AE%E3%83%86%E3%82%B9%E3%83%88%E3%81%A8%E3%81%97%E3%81%A6%E9%95%B7%E3%81%84%E3%82%BF%E3%82%A4%E3%83%88%E3%83%AB%E3%81%AE%E3%82%A8%E3%83%B3/</guid>
      <description>&lt;p&gt;適当すぎるけどこんな感じのパッチ。&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://php-tips.com/wp-content/uploads/2009/08/wp-to-twitter-mb.patch&#34;&gt;wp-to-twitter-mb.patch&lt;/a&gt;&lt;/p&gt;
&lt;pre class=&#34;brush: diff;&#34;&gt;*** wp-to-twitter.php	2009-08-20 22:04:29.000000000 +0900
--- wp-to-twitter-fixed.php	2009-08-20 22:36:38.000000000 +0900
***************
*** 206,227 ****
  	$sentence = $sentence . &#34; &#34; . get_option( &#39;jd_twit_append&#39; );
  	}

! 	$twit_length = strlen( $sentence );
! 	$title_length = strlen( $thisposttitle );
! 	$blog_length = strlen( $thisblogtitle );
  	if ( ( ( $twit_length + $title_length ) -  7 ) &amp;lt; 140 ) {
  	$sentence = str_ireplace( &#39;#title#&#39;, $thisposttitle, $sentence );
! 	$twit_length = strlen( $sentence );
  	} else {
! 	$thisposttitle = substr( $thisposttitle, 0, ( 140- ( $twit_length-3 ) ) ) . &#34;...&#34;;
  	$sentence = str_ireplace ( &#39;#title#&#39;, $thisposttitle, $sentence );
! 	$twit_length = strlen( $sentence );
  	}
  	if ( ( ( $twit_length + $blog_length ) -  6 ) &amp;lt; 140 ) {
  	$sentence = str_ireplace ( &#39;#blog#&#39;,$thisblogtitle,$sentence );
! 	$twit_length = strlen( $sentence );
  	} else {
! 	$thisblogtitle = substr( $thisblogtitle, 0, ( 140-( $twit_length-3 ) ) ) . &#34;...&#34;;
  	$sentence = str_ireplace ( &#39;#blog#&#39;,$thisblogtitle,$sentence );
  	}
  	return $sentence;
--- 206,230 ----
  	$sentence = $sentence . &#34; &#34; . get_option( &#39;jd_twit_append&#39; );
  	}

! 	mb_internal_encoding(&#39;UTF-8&#39;);
! 	$thisposttitle = urldecode($thisposttitle);
!   $thisblogtitle = urldecode($thisblogtitle);
! 	$twit_length = mb_strlen( $sentence );
! 	$title_length = mb_strlen( $thisposttitle );
! 	$blog_length = mb_strlen( $thisblogtitle );
  	if ( ( ( $twit_length + $title_length ) -  7 ) &amp;lt; 140 ) {
  	$sentence = str_ireplace( &#39;#title#&#39;, $thisposttitle, $sentence );
! 	$twit_length = mb_strlen( $sentence );
  	} else {
! 	$thisposttitle = mb_substr( $thisposttitle, 0, ( 140- ( $twit_length-3 ) ) ) . &#34;...&#34;;
  	$sentence = str_ireplace ( &#39;#title#&#39;, $thisposttitle, $sentence );
! 	$twit_length = mb_strlen( $sentence );
  	}
  	if ( ( ( $twit_length + $blog_length ) -  6 ) &amp;lt; 140 ) {
  	$sentence = str_ireplace ( &#39;#blog#&#39;,$thisblogtitle,$sentence );
! 	$twit_length = mb_strlen( $sentence );
  	} else {
! 	$thisblogtitle = mb_substr( $thisblogtitle, 0, ( 140-( $twit_length-3 ) ) ) . &#34;...&#34;;
  	$sentence = str_ireplace ( &#39;#blog#&#39;,$thisblogtitle,$sentence );
  	}
  	return $sentence;&lt;/pre&gt;</description>
    </item>
  </channel>
</rss>
