Changeset 707792
- Timestamp:
- 05/04/2013 08:00:40 AM (13 years ago)
- Location:
- wp-hatena-notation/trunk
- Files:
-
- 4 edited
-
WP/Hatena/Notation/LinkTitle.php (modified) (4 diffs)
-
WP/Hatena/Notation/Renderer.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
wp-hatena-notation.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-hatena-notation/trunk/WP/Hatena/Notation/LinkTitle.php
r706689 r707792 21 21 */ 22 22 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 } 23 39 24 40 /** … … 46 62 * 47 63 * @param string $url 48 * @param int $expir es64 * @param int $expiryDays 49 65 * @return string 50 66 */ 51 public function get($url, $expir es = 90) {67 public function get($url, $expiryDays = 90) { 52 68 $key = sha1($url); 53 69 … … 57 73 58 74 $row = $this->find($url); 59 $modified = strtotime("+{$expires} day", strtotime($row->modified_at));60 75 61 if ( $row && !empty($expires) && $modified > time()) {76 if (!self::isExpired($row, $expiryDays)) { 62 77 return $row->title; 63 78 } … … 83 98 $response = wp_remote_get($url); 84 99 85 if ( empty($response['body'])) {100 if (is_wp_error($response) || empty($response['body'])) { 86 101 return $url; 87 102 } -
wp-hatena-notation/trunk/WP/Hatena/Notation/Renderer.php
r706689 r707792 59 59 $ret = parent::renderHttpLink($data); 60 60 if ($this->config['link_target_blank']) { 61 return strtr($ret, array('">' ,'" target="_blank">'));61 return strtr($ret, array('">' => '" target="_blank">')); 62 62 } 63 63 return $ret; -
wp-hatena-notation/trunk/readme.txt
r706689 r707792 42 42 == Changelog == 43 43 44 = 2.0.1 = 45 * 「リンクを別ウィンドウで開く」オプションの不具合を修正 46 * http記法のタイトル取得に失敗するとFatal errorが出る不具合を修正 47 44 48 = 2.0 = 45 49 * WP Hatena Notation 2.0 Released! -
wp-hatena-notation/trunk/wp-hatena-notation.php
r706689 r707792 4 4 Plugin URI: https://github.com/rewish/wp-hatena-notation 5 5 Description: あなたのWordPressに「はてな記法」を導入します。 6 Version: 2.0 6 Version: 2.0.1 7 7 Author: rewish 8 8 Author URI: https://github.com/rewish
Note: See TracChangeset
for help on using the changeset viewer.