Plugin Directory

Changeset 707792


Ignore:
Timestamp:
05/04/2013 08:00:40 AM (13 years ago)
Author:
rewish
Message:

WP Hatena Notation 2.0.1 released

Location:
wp-hatena-notation/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-hatena-notation/trunk/WP/Hatena/Notation/LinkTitle.php

    r706689 r707792  
    2121     */
    2222    protected $titles;
     23
     24    /**
     25     * Expired
     26     *
     27     * @param stdClass $row
     28     * @param int $expiryDays
     29     * @return bool
     30     * @TODO Kirei Kirei
     31     */
     32    public static function isExpired($row, $expiryDays) {
     33        if ($expiryDays <= 0 || !$row || empty($row->modified_at)) {
     34            return true;
     35        }
     36
     37        return time() < strtotime("+{$expiryDays} day", strtotime($row->modified_at));
     38    }
    2339
    2440    /**
     
    4662     *
    4763     * @param string $url
    48      * @param int $expires
     64     * @param int $expiryDays
    4965     * @return string
    5066     */
    51     public function get($url, $expires = 90) {
     67    public function get($url, $expiryDays = 90) {
    5268        $key = sha1($url);
    5369
     
    5773
    5874        $row = $this->find($url);
    59         $modified = strtotime("+{$expires} day", strtotime($row->modified_at));
    6075
    61         if ($row && !empty($expires) && $modified > time()) {
     76        if (!self::isExpired($row, $expiryDays)) {
    6277            return $row->title;
    6378        }
     
    8398        $response = wp_remote_get($url);
    8499
    85         if (empty($response['body'])) {
     100        if (is_wp_error($response) || empty($response['body'])) {
    86101            return $url;
    87102        }
  • wp-hatena-notation/trunk/WP/Hatena/Notation/Renderer.php

    r706689 r707792  
    5959        $ret = parent::renderHttpLink($data);
    6060        if ($this->config['link_target_blank']) {
    61             return strtr($ret, array('">', '" target="_blank">'));
     61            return strtr($ret, array('">' => '" target="_blank">'));
    6262        }
    6363        return $ret;
  • wp-hatena-notation/trunk/readme.txt

    r706689 r707792  
    4242== Changelog ==
    4343
     44= 2.0.1 =
     45* 「リンクを別ウィンドウで開く」オプションの不具合を修正
     46* http記法のタイトル取得に失敗するとFatal errorが出る不具合を修正
     47
    4448= 2.0 =
    4549* WP Hatena Notation 2.0 Released!
  • wp-hatena-notation/trunk/wp-hatena-notation.php

    r706689 r707792  
    44Plugin URI: https://github.com/rewish/wp-hatena-notation
    55Description: あなたのWordPressに「はてな記法」を導入します。
    6 Version: 2.0
     6Version: 2.0.1
    77Author: rewish
    88Author URI: https://github.com/rewish
Note: See TracChangeset for help on using the changeset viewer.