tdiary-contrib 5.0.11 → 5.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0343f9efacec380a06456385bb96de2919b3e530f31e04e1843183fe68c362be
4
- data.tar.gz: 1e45713addec8000837c6fe4dba4ea75d29ebd85126125704862f48e9b55afc5
3
+ metadata.gz: 077a15f87d9312e2fd05c48aecdb4ea89bfeb7ef8e73b197eea443a0b628f75e
4
+ data.tar.gz: c488339e3f3dd2d99ea88d06e0f2fe35cebc7aa24dd3b66e5557e43535c3a392
5
5
  SHA512:
6
- metadata.gz: bd2567180fbc3b3ead53b48e3563a94f669d8ebf8b827fb228518177d82666251b5702f341f70ad7e8233b303cb7de257a0d783ab004b63254b88aa3413bd5c0
7
- data.tar.gz: b5f8e36eb937d67a2db82c9bdb1d60fa7e8a2e2e9d50027ef8f30fa34235812313f96764961820dedaa5c370dd8b0c7f1744735f1e69f0a9e099b1b439ec191b
6
+ metadata.gz: 6e438aaf3632d87cc666fd3d7f54b56e7962959501652f825cdf027b043e1c64540d5c0b382a92e88bdc8fb16d0f5146262664afc94a78650028b9173071bd6f
7
+ data.tar.gz: 3a31c1283e905e1880fe15f991ffc50c65eedf22a4471dad95b2b68a9af47f5fc2e75162617f5a2195fb0de9c9e328dfb6af276f3e83beda5484a4af2b318875
@@ -1,5 +1,5 @@
1
1
  module TDiary
2
2
  class Contrib
3
- VERSION = "5.0.11"
3
+ VERSION = "5.1.2"
4
4
  end
5
5
  end
@@ -20,7 +20,7 @@ add_subtitle_proc do |date, index, subtitle|
20
20
  section_url = @conf.base_url + anchor(date.strftime('%Y%m%d')) + '#p' + ('%02d' % index)
21
21
 
22
22
  if @conf['add.bookmark.delicious'] == 't' then
23
- escaped_url = URI.escape(section_url, /[^-.!~*'()\w]/n)
23
+ escaped_url = CGI.escape(section_url)
24
24
  caption += %Q|<a href="http://delicious.com/save?url=#{escaped_url}" onclick="window.open('http://delicious.com/save?v=5;noui;jump=close;url=#{escaped_url};title='+encodeURIComponent(document.title), 'delicious', 'toolbar=no,width=550,height=550'); return false">|
25
25
  caption += %Q|<img src="http://static.delicious.com/img/delicious.small.gif" width="10" height="10" style="border: 0 none;vertical-align: middle;" alt="#{@caption_delicious}">|
26
26
  caption += %Q|</a> |
@@ -1,174 +1,186 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # google_map.rb - embeded Google Map for tDiary, use Google Maps JavaScript API V3.
4
- # http://code.google.com/intl/ja/apis/maps/documentation/v3/services.html
4
+ # https://developers.google.com/maps/documentation/javascript/tutorial
5
5
  #
6
6
  # Copyright (C) 2010, tamoot <tamoot+tdiary@gmail.com>
7
7
  # You can redistribute it and/or modify it under GPL2.
8
8
  #
9
9
 
10
10
  def google_map(lat, lon, params = {})
11
- params.merge!(:lat => lat, :lon => lon)
12
- google_map_common(params)
11
+ params.merge!(:lat => lat, :lon => lon)
12
+ google_map_common(params)
13
13
  end
14
14
 
15
15
  def google_geomap(address, params = {})
16
- params.merge!(:address => address)
17
- google_map_common(params)
16
+ params.merge!(:address => address)
17
+ google_map_common(params)
18
18
  end
19
19
 
20
20
  def google_map_common(params)
21
- params[:id] ||= ''
22
- params[:lat] ||= 0.0
23
- params[:lon] ||= 0.0
24
- params[:address] ||= nil
25
- params[:zoom] ||= 10
26
- params[:html] ||= nil
27
- params[:title] ||= nil
28
- params[:width] ||= 320
29
- params[:height] ||= 240
30
- params[:type] ||= :ROADMAP
31
- params[:overview]||= false
32
-
33
- if feed?
34
- require 'cgi'
35
-
36
- url = nil
37
- if params[:lat].nonzero? && params[:lon].nonzero?
38
- query = "#{params[:lat]},#{params[:lon]}"
39
- url = %Q|http://maps.google.com/maps?q=#{CGI::escape(query)}|
40
-
41
- elsif params[:address] != nil
42
- query = params[:address]
43
- url = %Q|http://maps.google.com/maps?q=#{CGI::escape(query)}|
44
-
45
- end
46
-
47
- return %Q|<a href="#{url}">#{url}</a>| if url
48
-
49
- end
50
-
51
- dom_id = "#{@gmap_date.strftime("%Y%m%d")}_#{@gmap_count}"
52
- params.merge!(:id => dom_id)
53
- @gmap_data << params
54
- @gmap_count += 1
55
-
56
- %Q|<div class="gmap" id="#{dom_id}" style="width : #{params[:width]}px; height : #{params[:height]}px;"></div>|
21
+ params[:id] ||= ''
22
+ params[:lat] ||= 0.0
23
+ params[:lon] ||= 0.0
24
+ params[:address] ||= nil
25
+ params[:zoom] ||= 10
26
+ params[:html] ||= nil
27
+ params[:title] ||= nil
28
+ params[:width] ||= 320
29
+ params[:height] ||= 240
30
+ params[:type] ||= :ROADMAP
31
+ params[:overview]||= false
32
+
33
+ if feed?
34
+ require 'cgi'
35
+
36
+ url = nil
37
+ if params[:lat].nonzero? && params[:lon].nonzero?
38
+ query = "#{params[:lat]},#{params[:lon]}"
39
+ url = %Q|https://maps.google.com/maps?q=#{CGI::escape(query)}|
40
+
41
+ elsif params[:address] != nil
42
+ query = params[:address]
43
+ url = %Q|https://maps.google.com/maps?q=#{CGI::escape(query)}|
44
+
45
+ end
46
+
47
+ return %Q|<a href="#{url}">#{url}</a>| if url
48
+
49
+ end
50
+
51
+ dom_id = "#{@gmap_date.strftime("%Y%m%d")}_#{@gmap_count}"
52
+ params.merge!(:id => dom_id)
53
+ @gmap_data << params
54
+ @gmap_count += 1
55
+
56
+ %Q|<div class="gmap" id="#{dom_id}" style="width : #{params[:width]}px; height : #{params[:height]}px;"></div>|
57
57
  end
58
58
 
59
59
  add_header_proc do
60
- if /\A(?:latest|day|month|nyear|preview)\z/ =~ @mode
61
- %Q|<script type="text/javascript" src="//maps.google.com/maps/api/js?sensor=true"></script>\n|
62
- end
60
+ if /\A(?:latest|day|month|nyear|preview)\z/ =~ @mode
61
+ %Q|<script type="text/javascript" src="//maps.google.com/maps/api/js?key=#{@conf['google_map.key']}"></script>\n|
62
+ end
63
63
  end
64
64
 
65
65
  add_body_enter_proc do |date|
66
- @gmap_data = []
67
- @gmap_date = date
68
- @gmap_count = 0
69
- ''
66
+ @gmap_data = []
67
+ @gmap_date = date
68
+ @gmap_count = 0
69
+ ''
70
70
  end
71
71
 
72
72
  add_body_leave_proc do |date|
73
- gmap_scripts = ''
74
- if !feed? && @gmap_data.any?
75
- gmap_scripts = %Q|<script type="text/javascript">\n<!--\n|
76
- @gmap_data.each do |data|
77
- if data[:address]
78
- gmap_scripts << google_geomap_script(data)
79
- else
80
- gmap_scripts << google_map_script(data)
81
- end
82
- end
83
- gmap_scripts << %Q|//-->\n</script>\n|
84
- end
85
- gmap_scripts
73
+ gmap_scripts = ''
74
+ if !feed? && @gmap_data.any?
75
+ gmap_scripts = %Q|<script type="text/javascript">\n<!--\n|
76
+ @gmap_data.each do |data|
77
+ if data[:address]
78
+ gmap_scripts << google_geomap_script(data)
79
+ else
80
+ gmap_scripts << google_map_script(data)
81
+ end
82
+ end
83
+ gmap_scripts << %Q|//-->\n</script>\n|
84
+ end
85
+ gmap_scripts
86
+ end
87
+
88
+ add_conf_proc('google_map', 'Google Maps', 'etc') do
89
+ if @mode == 'saveconf' then
90
+ @conf['google_map.key'], = @cgi.params['google_map.key']
91
+ end
92
+
93
+ <<-HTML
94
+ <h3 class="subtitle">Google Maps API Key</h3>
95
+ <p>API Key (see <a href="https://developers.google.com/maps/documentation/javascript/get-api-key">developers.google.com/maps</a>)</p>
96
+ <p><input name="google_map.key" value="#{h @conf['google_map.key']}" size="50"></p>
97
+ HTML
86
98
  end
87
99
 
88
100
  def google_map_script(hash)
89
- str = ''
90
- str << %Q|google.maps.event.addDomListener(window, 'load', function() {\n|
91
- str << %Q| var mapdiv = document.getElementById("#{hash[:id]}");\n|
92
- str << %Q| if(mapdiv){\n|
93
- str << %Q| var myOptions = {\n|
94
- str << %Q| zoom: #{hash[:zoom]},\n|
95
- str << %Q| overviewMapControl: #{hash[:overview]},\n|
96
- str << %Q| overviewMapControlOptions: {\n|
97
- str << %Q| opened: #{hash[:overview]}\n|
98
- str << %Q| },\n|
99
- str << %Q| center: new google.maps.LatLng(#{hash[:lat]}, #{hash[:lon]}),\n|
100
- str << %Q| mapTypeId: google.maps.MapTypeId.#{hash[:type]},\n|
101
- str << %Q| scaleControl: true\n|
102
- str << %Q| };\n|
103
- str << %Q| var gMap = new google.maps.Map(mapdiv, myOptions);\n|
104
- # set Marker
105
- if hash[:title]
106
- str << %Q| var marker = new google.maps.Marker({\n|
107
- str << %Q| position: new google.maps.LatLng(#{hash[:lat]}, #{hash[:lon]}),\n|
108
- str << %Q| map: gMap,\n|
109
- str << %Q| title: '#{hash[:title]}'\n|
110
- str << %Q| });\n|
111
- # set InfoWindow
112
- if hash[:html]
113
- str << %Q| var infowindow = new google.maps.InfoWindow({\n|
114
- str << %Q| content: '<span style="color: #000000;">#{hash[:html]}</span>',\n|
115
- str << %Q| size: new google.maps.Size(350, 200)\n|
116
- str << %Q| });\n|
117
- str << %Q| infowindow.open(gMap, marker);\n|
118
- end # :html
119
- end # :title
120
- str << %Q| };\n|
121
- str << %Q|});\n|
122
-
123
- str
101
+ str = ''
102
+ str << %Q|google.maps.event.addDomListener(window, 'load', function() {\n|
103
+ str << %Q| var mapdiv = document.getElementById("#{hash[:id]}");\n|
104
+ str << %Q| if(mapdiv){\n|
105
+ str << %Q| var myOptions = {\n|
106
+ str << %Q| zoom: #{hash[:zoom]},\n|
107
+ str << %Q| overviewMapControl: #{hash[:overview]},\n|
108
+ str << %Q| overviewMapControlOptions: {\n|
109
+ str << %Q| opened: #{hash[:overview]}\n|
110
+ str << %Q| },\n|
111
+ str << %Q| center: new google.maps.LatLng(#{hash[:lat]}, #{hash[:lon]}),\n|
112
+ str << %Q| mapTypeId: google.maps.MapTypeId.#{hash[:type]},\n|
113
+ str << %Q| scaleControl: true\n|
114
+ str << %Q| };\n|
115
+ str << %Q| var gMap = new google.maps.Map(mapdiv, myOptions);\n|
116
+ # set Marker
117
+ if hash[:title]
118
+ str << %Q| var marker = new google.maps.Marker({\n|
119
+ str << %Q| position: new google.maps.LatLng(#{hash[:lat]}, #{hash[:lon]}),\n|
120
+ str << %Q| map: gMap,\n|
121
+ str << %Q| title: '#{hash[:title]}'\n|
122
+ str << %Q| });\n|
123
+ # set InfoWindow
124
+ if hash[:html]
125
+ str << %Q| var infowindow = new google.maps.InfoWindow({\n|
126
+ str << %Q| content: '<span style="color: #000000;">#{hash[:html]}</span>',\n|
127
+ str << %Q| size: new google.maps.Size(350, 200)\n|
128
+ str << %Q| });\n|
129
+ str << %Q| infowindow.open(gMap, marker);\n|
130
+ end # :html
131
+ end # :title
132
+ str << %Q| };\n|
133
+ str << %Q|});\n|
134
+
135
+ str
124
136
  end
125
137
 
126
138
  def google_geomap_script(hash)
127
- str = ''
128
- str << %Q|google.maps.event.addDomListener(window, 'load', function() {\n|
129
- str << %Q| var mapdiv = document.getElementById("#{hash[:id]}");\n|
130
- str << %Q| if(mapdiv){\n|
131
- str << %Q| var geocoder = new google.maps.Geocoder();\n|
132
- str << %Q| if(geocoder) {\n|
133
- str << %Q| geocoder.geocode( { 'address': '#{hash[:address]}'}, function(results, status) {\n|
134
- str << %Q| if (status == google.maps.GeocoderStatus.OK) {\n|
135
- str << %Q| var geoLat = results[0].geometry.location;\n|
136
- str << %Q| var myOptions = {\n|
137
- str << %Q| zoom: #{hash[:zoom]},\n|
138
- str << %Q| overviewMapControl: #{hash[:overview]},\n|
139
- str << %Q| overviewMapControlOptions: {\n|
140
- str << %Q| opened: #{hash[:overview]}\n|
141
- str << %Q| },\n|
142
- str << %Q| center: geoLat,\n|
143
- str << %Q| mapTypeId: google.maps.MapTypeId.#{hash[:type]},\n|
144
- str << %Q| scaleControl: true\n|
145
- str << %Q| };\n|
146
- str << %Q| var gMap = new google.maps.Map(mapdiv, myOptions);\n|
147
- # set Marker
148
- if hash[:title]
149
- str << %Q| var marker = new google.maps.Marker({\n|
150
- str << %Q| position: geoLat,\n|
151
- str << %Q| map: gMap,\n|
152
- str << %Q| title: '#{hash[:title]}'\n|
153
- str << %Q| });\n|
154
- # set InfoWindow
155
- if hash[:html]
156
- str << %Q| var infowindow = new google.maps.InfoWindow({\n|
157
- str << %Q| content: '<span style="color: #000000;">#{hash[:html]}</span>',\n|
158
- str << %Q| size: new google.maps.Size(350, 200)\n|
159
- str << %Q| });\n|
160
- str << %Q| infowindow.open(gMap, marker);\n|
161
- end # :html
162
- end # :title
163
- str << %Q| }else{\n|
164
- str << %Q| alert("Geocode was not successful for the following reason: " + status)\n|
165
- str << %Q| }\n|
166
- str << %Q| });\n|
167
- str << %Q| }\n|
168
- str << %Q| }\n|
169
- str << %Q|});\n|
170
-
171
- str
139
+ str = ''
140
+ str << %Q|google.maps.event.addDomListener(window, 'load', function() {\n|
141
+ str << %Q| var mapdiv = document.getElementById("#{hash[:id]}");\n|
142
+ str << %Q| if(mapdiv){\n|
143
+ str << %Q| var geocoder = new google.maps.Geocoder();\n|
144
+ str << %Q| if(geocoder) {\n|
145
+ str << %Q| geocoder.geocode( { 'address': '#{hash[:address]}'}, function(results, status) {\n|
146
+ str << %Q| if (status == google.maps.GeocoderStatus.OK) {\n|
147
+ str << %Q| var geoLat = results[0].geometry.location;\n|
148
+ str << %Q| var myOptions = {\n|
149
+ str << %Q| zoom: #{hash[:zoom]},\n|
150
+ str << %Q| overviewMapControl: #{hash[:overview]},\n|
151
+ str << %Q| overviewMapControlOptions: {\n|
152
+ str << %Q| opened: #{hash[:overview]}\n|
153
+ str << %Q| },\n|
154
+ str << %Q| center: geoLat,\n|
155
+ str << %Q| mapTypeId: google.maps.MapTypeId.#{hash[:type]},\n|
156
+ str << %Q| scaleControl: true\n|
157
+ str << %Q| };\n|
158
+ str << %Q| var gMap = new google.maps.Map(mapdiv, myOptions);\n|
159
+ # set Marker
160
+ if hash[:title]
161
+ str << %Q| var marker = new google.maps.Marker({\n|
162
+ str << %Q| position: geoLat,\n|
163
+ str << %Q| map: gMap,\n|
164
+ str << %Q| title: '#{hash[:title]}'\n|
165
+ str << %Q| });\n|
166
+ # set InfoWindow
167
+ if hash[:html]
168
+ str << %Q| var infowindow = new google.maps.InfoWindow({\n|
169
+ str << %Q| content: '<span style="color: #000000;">#{hash[:html]}</span>',\n|
170
+ str << %Q| size: new google.maps.Size(350, 200)\n|
171
+ str << %Q| });\n|
172
+ str << %Q| infowindow.open(gMap, marker);\n|
173
+ end # :html
174
+ end # :title
175
+ str << %Q| }else{\n|
176
+ str << %Q| alert("Geocode was not successful for the following reason: " + status)\n|
177
+ str << %Q| }\n|
178
+ str << %Q| });\n|
179
+ str << %Q| }\n|
180
+ str << %Q| }\n|
181
+ str << %Q|});\n|
182
+
183
+ str
172
184
  end
173
185
 
174
186
  # Local Variables:
@@ -8,7 +8,7 @@
8
8
  # Author: ishinao <ishinao@ishinao.net>
9
9
  #
10
10
 
11
- add_body_leave_proc(Proc.new do |date|
11
+ add_body_leave_proc do |date|
12
12
  if @mode == 'day' or @mode == 'latest'
13
13
  diary = @diaries[date.strftime('%Y%m%d')]
14
14
  pnum = 1
@@ -33,7 +33,7 @@ add_body_leave_proc(Proc.new do |date|
33
33
  else
34
34
  ''
35
35
  end
36
- end)
36
+ end
37
37
 
38
38
  # rss-recent.rb: RSS recent plugin
39
39
  #
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  # image_plugin_ex.rb
2
3
  # version 0.3
3
4
  # -pv-
@@ -86,11 +87,11 @@
86
87
 
87
88
  enable_js("image_ex.js")
88
89
 
89
- add_body_enter_proc(Proc.new do |date|
90
+ add_body_enter_proc do |date|
90
91
  @image_date = date.strftime("%Y%m%d")
91
92
  @image_year = date.strftime("%Y")
92
93
  ""
93
- end)
94
+ end
94
95
 
95
96
 
96
97
  def image( id, alt = "image", id2 = nil, width = nil, place="none" )
@@ -199,7 +200,7 @@ add_form_proc do |date|
199
200
  imageex_convertedsize = %Q[#{imageex_convertedheight}x#{imageex_convertedwidth}]
200
201
  imageex_convertedsize
201
202
  end
202
- system(imageex_convertpath , "-geometry", imageex_convertedsize , orig, new)
203
+ system(imageex_convertpath , "-auto-orient", "-geometry", imageex_convertedsize , orig, new)
203
204
  if FileTest::size?( new ) == 0
204
205
  File::delete( new )
205
206
  end
@@ -10,7 +10,6 @@ require 'uri'
10
10
  require 'net/http'
11
11
  require 'open-uri'
12
12
 
13
-
14
13
  def instagram(*args)
15
14
  uri = URI::parse(args[0])
16
15
  return instagram_iframe(*args) if uri.scheme.nil?
@@ -19,7 +18,9 @@ end
19
18
 
20
19
  def instagram_iframe(code, width=612, height=700)
21
20
  return <<-BODY
22
- <iframe src="//instagram.com/p/#{code}/embed/" width="#{width}" height="#{height}" frameborder="0" scrolling="no" allowtransparency="true"></iframe>
21
+ <div class="embed embed-instagram">
22
+ <iframe src="//instagram.com/p/#{code}/embed/" width="#{width}" height="#{height}" frameborder="0" scrolling="no" allowtransparency="true"></iframe>
23
+ </div>
23
24
  BODY
24
25
  end
25
26
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  require 'nkf'
11
11
 
12
- add_body_leave_proc(Proc.new do |date|
12
+ add_body_leave_proc do |date|
13
13
 
14
14
  oldest_date = Time.local(2005, 1, 11)
15
15
  if date > oldest_date
@@ -38,7 +38,7 @@ add_body_leave_proc(Proc.new do |date|
38
38
  ''
39
39
  end
40
40
  end
41
- end)
41
+ end
42
42
 
43
43
  require "rss/rss"
44
44
 
@@ -39,7 +39,7 @@ class MyHotEntry
39
39
  # RSSを取得
40
40
  rss = nil
41
41
  rss_url = 'http://b.hatena.ne.jp/entrylist?mode=rss&url='
42
- rss_url << URI.escape(base_url, /[^-.!~*'()\w]/n)
42
+ rss_url << CGI.escape(base_url)
43
43
  rss_url << "&sort=#{options[:sort]}&threshold=#{options[:threshold]}"
44
44
  begin
45
45
  Timeout.timeout(5) do
@@ -53,7 +53,7 @@ def notify_miniblog
53
53
 
54
54
  # strip category
55
55
  sectitle.gsub!(/\[[^\]]+\] */, '')
56
- url = URI.encode(@conf.base_url + anchor("#{date}p%02d" % index), /[^-.!~*'()\w]/n)
56
+ url = CGI.escape(@conf.base_url + anchor("#{date}p%02d" % index))
57
57
  prefix = @conf['miniblog.notify.prefix']
58
58
  format = @conf['miniblog.notify.format']
59
59
  source = 'tdiary/notify_miniblog.rb'
@@ -52,9 +52,9 @@ end
52
52
  if @mode =~ /^(latest|day|month|nyear)$/
53
53
  socialbutton_footer = Proc.new { %Q|<div class="socialbuttons"></div>| }
54
54
  if respond_to?(:blogkit?) && blogkit?
55
- add_body_leave_proc(socialbutton_footer)
55
+ add_body_leave_proc(&socialbutton_footer)
56
56
  else
57
- add_section_leave_proc(socialbutton_footer)
57
+ add_section_leave_proc(&socialbutton_footer)
58
58
  end
59
59
 
60
60
  # load javascript
@@ -29,7 +29,6 @@ end
29
29
 
30
30
  def twitter_statuses_show_api( tweet_id )
31
31
  url = "https://api.twitter.com/1.1/statuses/show.json"
32
- unsafe = /[^a-zA-Z0-9\-\.\_\~]/
33
32
  parameters = {
34
33
  :id => tweet_id
35
34
  }
@@ -41,11 +40,11 @@ def twitter_statuses_show_api( tweet_id )
41
40
  :oauth_token => @conf["twitter_quote.oauth_token"],
42
41
  :oauth_version => "1.0"
43
42
  }
44
- data = "GET&#{URI.escape( url, unsafe )}&"
45
- data << URI.escape( oauth_parameters.merge( parameters ).sort.map{|k, v| "#{k}=#{v}" }.join( "&" ), unsafe )
43
+ data = "GET&#{CGI.escape( url )}&"
44
+ data << CGI.escape( oauth_parameters.merge( parameters ).sort.map{|k, v| "#{k}=#{v}" }.join( "&" ) )
46
45
  oauth_parameters[:oauth_signature] = [OpenSSL::HMAC.digest(
47
46
  OpenSSL::Digest::SHA1.new,
48
- URI.escape( "#{@conf["twitter_quote.oauth_consumer_secret"]}&#{@conf["twitter_quote.oauth_token_secret"]}" ),
47
+ CGI.escape( "#{@conf["twitter_quote.oauth_consumer_secret"]}&#{@conf["twitter_quote.oauth_token_secret"]}" ),
49
48
  data
50
49
  )].pack( "m" ).chomp
51
50
 
@@ -53,7 +52,7 @@ def twitter_statuses_show_api( tweet_id )
53
52
  proxy = 'http://' + proxy if proxy
54
53
 
55
54
  headers = {
56
- "Authorization" => %Q[OAuth #{oauth_parameters.map{|k ,v| "#{URI.escape( k.to_s, unsafe )}=\"#{URI.escape( v, unsafe )}\""}.join( "," )}],
55
+ "Authorization" => %Q[OAuth #{oauth_parameters.map{|k ,v| "#{CGI.escape( k.to_s )}=\"#{CGI.escape( v )}\""}.join( "," )}],
57
56
  :proxy => proxy
58
57
  }
59
58
  Timeout.timeout( 20 ) do
@@ -26,7 +26,7 @@ Net::HTTP.version_1_2
26
26
  def kousei_api( sentence )
27
27
  appid = @conf['yahoo_kousei.appid']
28
28
 
29
- query = "appid=#{appid}&sentence=#{URI.encode( sentence.gsub( /\n/, '' ) )}"
29
+ query = "appid=#{appid}&sentence=#{CGI.escape( sentence.gsub( /\n/, '' ) )}"
30
30
  query << "&filter_group=" + @conf['yahoo_kousei.filter_group'] if @conf['yahoo_kousei.filter_group']
31
31
  query << "&no_filter=" + @conf['yahoo_kousei.no_filter'] if @conf['yahoo_kousei.no_filter']
32
32
 
@@ -100,7 +100,7 @@ def yo_update_subscribers_count
100
100
  raise YoUpdateError, "Yo API Key is not set"
101
101
  end
102
102
  req = Net::HTTP::Get.new(
103
- URI("http://api.justyo.co/subscribers_count/?api_token=#{URI.escape(api_key)}")
103
+ URI("http://api.justyo.co/subscribers_count/?api_token=#{CGI.escape(api_key)}")
104
104
  )
105
105
  res = yo_update_access_api(req)
106
106
  data = res.body
@@ -49,19 +49,19 @@ class PluginFake
49
49
  @conf_procs << block
50
50
  end
51
51
 
52
- def add_edit_proc( block = Proc::new )
52
+ def add_edit_proc(&block)
53
53
  @edit_procs << block
54
54
  end
55
55
 
56
- def add_header_proc( block = Proc::new )
56
+ def add_header_proc(&block)
57
57
  @header_procs << block
58
58
  end
59
59
 
60
- def add_footer_proc( block = Proc::new )
60
+ def add_footer_proc(&block)
61
61
  @footer_procs << block
62
62
  end
63
63
 
64
- def add_update_proc( block = Proc::new )
64
+ def add_update_proc(&block)
65
65
  @update_procs << block
66
66
  end
67
67
 
@@ -89,7 +89,7 @@ class PluginFake
89
89
  r.join.chomp
90
90
  end
91
91
 
92
- def add_body_enter_proc( block = Proc::new )
92
+ def add_body_enter_proc(&block)
93
93
  @body_enter_procs << block
94
94
  end
95
95
 
@@ -101,7 +101,7 @@ class PluginFake
101
101
  r.join.chomp
102
102
  end
103
103
 
104
- def add_body_leave_proc( block = Proc::new )
104
+ def add_body_leave_proc(&block)
105
105
  @body_leave_procs << block
106
106
  end
107
107
 
@@ -844,7 +844,7 @@ class Hatena::Google
844
844
  end
845
845
 
846
846
  def convert(mode)
847
- uri = 'http://www.google.com/search?q=%s&amp;ie=euc-jp&amp;oe=euc-jp' % URI.escape(@str, /[^-_.!~*'()a-zA-Z0-9]/)
847
+ uri = 'http://www.google.com/search?q=%s&amp;ie=euc-jp&amp;oe=euc-jp' % CGI.escape(@str)
848
848
  return uri unless @tag_p
849
849
  template=nil
850
850
  if mode == :CHTML
@@ -889,7 +889,7 @@ class Hatena::Keyword
889
889
  end
890
890
 
891
891
  def convert(mode)
892
- uri = '%skeyword/%s' % [@group, URI.escape(@str, /[^-_.!~*'()a-zA-Z0-9]/)]
892
+ uri = '%skeyword/%s' % [@group, CGI.escape(@str)]
893
893
  return uri unless @tag_p
894
894
  template=nil
895
895
  if mode == :CHTML
@@ -958,7 +958,7 @@ class Hatena::AmazonSearch
958
958
  end
959
959
 
960
960
  def convert(mode)
961
- uri = 'http://www.amazon.co.jp/exec/obidos/external-search?mode=blended&amp;tag=%s&amp;encoding-string-jp=%%c6%%fc%%cb%%dc%%b8%%ec&amp;keyword=%s' % [Hatena.conf['amazon.aid'] || '', URI.escape(@str, /[^-_.!~*'()a-zA-Z0-9]/)]
961
+ uri = 'http://www.amazon.co.jp/exec/obidos/external-search?mode=blended&amp;tag=%s&amp;encoding-string-jp=%%c6%%fc%%cb%%dc%%b8%%ec&amp;keyword=%s' % [Hatena.conf['amazon.aid'] || '', CGI.escape(@str)]
962
962
  return uri unless @tag_p
963
963
  template=nil
964
964
  if mode == :CHTML
@@ -259,10 +259,10 @@ end
259
259
  # Callback Functions
260
260
 
261
261
  # this is for view_exif().
262
- add_body_enter_proc(Proc.new do |date|
262
+ add_body_enter_proc do |date|
263
263
  @image_date_exif = date.strftime("%Y%m%d")
264
264
  ""
265
- end)
265
+ end
266
266
 
267
267
  # Update Proc of the plugin
268
268
  add_update_proc do
@@ -49,7 +49,7 @@ end
49
49
 
50
50
  # Callback Functions
51
51
 
52
- add_body_enter_proc(Proc.new do |date|
52
+ add_body_enter_proc do |date|
53
53
  @image_date_exif = date.strftime("%Y%m%d")
54
54
  ""
55
- end)
55
+ end
@@ -439,7 +439,7 @@ def escape(str)
439
439
  end
440
440
 
441
441
  def escape_url(u)
442
- escape(URI.encode(u))
442
+ escape(CGI.escape(u))
443
443
  end
444
444
 
445
445
  main
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdiary-contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.11
4
+ version: 5.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - tDiary contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-29 00:00:00.000000000 Z
11
+ date: 2020-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tdiary
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pushbullet_ruby
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,16 +42,22 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.3'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '3.0'
48
51
  type: :development
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - "~>"
55
+ - - ">="
53
56
  - !ruby/object:Gem::Version
54
57
  version: '1.3'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rake
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -507,7 +513,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
507
513
  - !ruby/object:Gem::Version
508
514
  version: '0'
509
515
  requirements: []
510
- rubygems_version: 3.0.1
516
+ rubygems_version: 3.1.2
511
517
  signing_key:
512
518
  specification_version: 4
513
519
  summary: tDiary contributions package