Amazon JS - Version 0.8

Version Description

  • Supported Transients API for cache (file cache is no longer in use)
  • Improved to start rendering
  • Fixed to use get_locale() instead of WPLANG
Download this release

Release Info

Developer makoto_kw
Plugin Icon 128x128 Amazon JS
Version 0.8
Comparing to
See all releases

Version 0.8

README.md ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AmazonJS (WordPress Plugin)
2
+ ========
3
+
4
+ This repository is in progress and unstable version. Do not install except latest version dose not work.
5
+
6
+ You can install stable version from: [WordPress.org](http://wordpress.org/plugins/amazonjs/)
7
+
8
+ ## Development
9
+
10
+ ### Requirement
11
+
12
+ * Grunt
13
+ * Compass
14
+
15
+ ### Build css
16
+
17
+
18
+ for debug
19
+
20
+ ```
21
+ grunt debug
22
+ ```
23
+
24
+ for production
25
+
26
+ ```
27
+ grunt
28
+ ```
29
+
30
+
31
+ ### Translation
32
+
33
+ 1. Execute ``grunt update-po``
34
+ 1. Edit ``languages/amazonjs-*.po``
35
+ 1. Execute ``grunt update-mo``
36
+
37
+ ## Support
38
+
39
+ http://wordpress.org/support/plugin/amazonjs
amazonjs-aws-params.php ADDED
@@ -0,0 +1,668 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @param Amazonjs $amazonjs
4
+ */
5
+ function amazonjs_aws_params( Amazonjs $amazonjs ) {
6
+ $amazonjs->search_indexes = array(
7
+ 'All' => array(
8
+ 'CA' => true,
9
+ 'CN' => true,
10
+ 'DE' => true,
11
+ 'ES' => true,
12
+ 'FR' => true,
13
+ 'IT' => true,
14
+ 'JP' => true,
15
+ 'UK' => true,
16
+ 'US' => true,
17
+ 'label' => __( 'All', $amazonjs->text_domain ),
18
+ ),
19
+ 'Apparel' => array(
20
+ 'CA' => false,
21
+ 'CN' => true,
22
+ 'DE' => true,
23
+ 'ES' => false,
24
+ 'FR' => true,
25
+ 'IT' => false,
26
+ 'JP' => true,
27
+ 'UK' => true,
28
+ 'US' => true,
29
+ 'label' => __( 'Apparel', $amazonjs->text_domain ),
30
+ ),
31
+ 'Appliances' => array(
32
+ 'CA' => false,
33
+ 'CN' => true,
34
+ 'DE' => false,
35
+ 'ES' => false,
36
+ 'FR' => false,
37
+ 'IT' => false,
38
+ 'JP' => true,
39
+ 'UK' => false,
40
+ 'US' => true,
41
+ 'label' => __( 'Appliances', $amazonjs->text_domain ),
42
+ ),
43
+ 'ArtsAndCrafts' => array(
44
+ 'CA' => false,
45
+ 'CN' => false,
46
+ 'DE' => false,
47
+ 'ES' => false,
48
+ 'FR' => false,
49
+ 'IT' => false,
50
+ 'JP' => false,
51
+ 'UK' => false,
52
+ 'US' => true,
53
+ 'label' => __( 'ArtsAndCrafts', $amazonjs->text_domain ),
54
+ ),
55
+ 'Automotive' => array(
56
+ 'CA' => false,
57
+ 'CN' => true,
58
+ 'DE' => true,
59
+ 'ES' => false,
60
+ 'FR' => false,
61
+ 'IT' => false,
62
+ 'JP' => true,
63
+ 'UK' => true,
64
+ 'US' => true,
65
+ 'label' => __( 'Automotive', $amazonjs->text_domain ),
66
+ ),
67
+ 'Baby' => array(
68
+ 'CA' => true,
69
+ 'CN' => true,
70
+ 'DE' => true,
71
+ 'ES' => false,
72
+ 'FR' => true,
73
+ 'IT' => true,
74
+ 'JP' => true,
75
+ 'UK' => true,
76
+ 'US' => true,
77
+ 'label' => __( 'Baby', $amazonjs->text_domain ),
78
+ ),
79
+ 'Beauty' => array(
80
+ 'CA' => false,
81
+ 'CN' => true,
82
+ 'DE' => true,
83
+ 'ES' => false,
84
+ 'FR' => true,
85
+ 'IT' => false,
86
+ 'JP' => true,
87
+ 'UK' => true,
88
+ 'US' => true,
89
+ 'label' => __( 'Beauty', $amazonjs->text_domain ),
90
+ ),
91
+ 'Blended' => array(
92
+ 'CA' => true,
93
+ 'CN' => false,
94
+ 'DE' => true,
95
+ 'ES' => false,
96
+ 'FR' => true,
97
+ 'IT' => false,
98
+ 'JP' => true,
99
+ 'UK' => true,
100
+ 'US' => true,
101
+ 'label' => __( 'Blended', $amazonjs->text_domain ),
102
+ ),
103
+ 'Books' => array(
104
+ 'CA' => true,
105
+ 'CN' => true,
106
+ 'DE' => true,
107
+ 'ES' => true,
108
+ 'FR' => true,
109
+ 'IT' => true,
110
+ 'JP' => true,
111
+ 'UK' => true,
112
+ 'US' => true,
113
+ 'label' => __( 'Books', $amazonjs->text_domain ),
114
+ ),
115
+ 'Classical' => array(
116
+ 'CA' => true,
117
+ 'CN' => false,
118
+ 'DE' => true,
119
+ 'ES' => false,
120
+ 'FR' => true,
121
+ 'IT' => false,
122
+ 'JP' => true,
123
+ 'UK' => true,
124
+ 'US' => true,
125
+ 'label' => __( 'Classical', $amazonjs->text_domain ),
126
+ ),
127
+ 'DigitalMusic' => array(
128
+ 'CA' => false,
129
+ 'CN' => false,
130
+ 'DE' => false,
131
+ 'ES' => false,
132
+ 'FR' => false,
133
+ 'IT' => false,
134
+ 'JP' => false,
135
+ 'UK' => false,
136
+ 'US' => true,
137
+ 'label' => __( 'DigitalMusic', $amazonjs->text_domain ),
138
+ ),
139
+ 'DVD' => array(
140
+ 'CA' => true,
141
+ 'CN' => false,
142
+ 'DE' => true,
143
+ 'ES' => true,
144
+ 'FR' => true,
145
+ 'IT' => true,
146
+ 'JP' => true,
147
+ 'UK' => true,
148
+ 'US' => true,
149
+ 'label' => __( 'DVD', $amazonjs->text_domain ),
150
+ ),
151
+ 'Electronics' => array(
152
+ 'CA' => true,
153
+ 'CN' => true,
154
+ 'DE' => true,
155
+ 'ES' => true,
156
+ 'FR' => true,
157
+ 'IT' => true,
158
+ 'JP' => true,
159
+ 'UK' => true,
160
+ 'US' => true,
161
+ 'label' => __( 'Electronics', $amazonjs->text_domain ),
162
+ ),
163
+ 'ForeignBooks' => array(
164
+ 'CA' => true,
165
+ 'CN' => false,
166
+ 'DE' => true,
167
+ 'ES' => true,
168
+ 'FR' => true,
169
+ 'IT' => true,
170
+ 'JP' => true,
171
+ 'UK' => false,
172
+ 'US' => false,
173
+ 'label' => __( 'ForeignBooks', $amazonjs->text_domain ),
174
+ ),
175
+ 'Garden' => array(
176
+ 'CA' => false,
177
+ 'CN' => false,
178
+ 'DE' => false,
179
+ 'ES' => false,
180
+ 'FR' => false,
181
+ 'IT' => true,
182
+ 'JP' => false,
183
+ 'UK' => false,
184
+ 'US' => false,
185
+ 'label' => __( 'Garden', $amazonjs->text_domain ),
186
+ ),
187
+ 'GourmetFood' => array(
188
+ 'CA' => false,
189
+ 'CN' => false,
190
+ 'DE' => false,
191
+ 'ES' => false,
192
+ 'FR' => false,
193
+ 'IT' => false,
194
+ 'JP' => false,
195
+ 'UK' => false,
196
+ 'US' => true,
197
+ 'label' => __( 'GourmetFood', $amazonjs->text_domain ),
198
+ ),
199
+ 'Grocery' => array(
200
+ 'CA' => false,
201
+ 'CN' => true,
202
+ 'DE' => true,
203
+ 'ES' => false,
204
+ 'FR' => false,
205
+ 'IT' => false,
206
+ 'JP' => true,
207
+ 'UK' => true,
208
+ 'US' => true,
209
+ 'label' => __( 'Grocery', $amazonjs->text_domain ),
210
+ ),
211
+ 'HealthPersonalCare' => array(
212
+ 'CA' => false,
213
+ 'CN' => true,
214
+ 'DE' => true,
215
+ 'ES' => false,
216
+ 'FR' => true,
217
+ 'IT' => false,
218
+ 'JP' => true,
219
+ 'UK' => true,
220
+ 'US' => true,
221
+ 'label' => __( 'HealthPersonalCare', $amazonjs->text_domain ),
222
+ ),
223
+ 'Hobbies' => array(
224
+ 'CA' => false,
225
+ 'CN' => false,
226
+ 'DE' => false,
227
+ 'ES' => false,
228
+ 'FR' => false,
229
+ 'IT' => false,
230
+ 'JP' => true,
231
+ 'UK' => false,
232
+ 'US' => false,
233
+ 'label' => __( 'Hobbies', $amazonjs->text_domain ),
234
+ ),
235
+ 'Home' => array(
236
+ 'CA' => false,
237
+ 'CN' => true,
238
+ 'DE' => false,
239
+ 'ES' => false,
240
+ 'FR' => false,
241
+ 'IT' => false,
242
+ 'JP' => false,
243
+ 'UK' => false,
244
+ 'US' => false,
245
+ 'label' => __( 'Home', $amazonjs->text_domain ),
246
+ ),
247
+ 'HomeGarden' => array(
248
+ 'CA' => false,
249
+ 'CN' => false,
250
+ 'DE' => true,
251
+ 'ES' => false,
252
+ 'FR' => false,
253
+ 'IT' => false,
254
+ 'JP' => false,
255
+ 'UK' => true,
256
+ 'US' => true,
257
+ 'label' => __( 'HomeGarden', $amazonjs->text_domain ),
258
+ ),
259
+ 'HomeImprovement' => array(
260
+ 'CA' => false,
261
+ 'CN' => true,
262
+ 'DE' => true,
263
+ 'ES' => false,
264
+ 'FR' => false,
265
+ 'IT' => false,
266
+ 'JP' => true,
267
+ 'UK' => true,
268
+ 'US' => false,
269
+ 'label' => __( 'HomeImprovement', $amazonjs->text_domain ),
270
+ ),
271
+ 'Industrial' => array(
272
+ 'CA' => false,
273
+ 'CN' => false,
274
+ 'DE' => false,
275
+ 'ES' => false,
276
+ 'FR' => false,
277
+ 'IT' => false,
278
+ 'JP' => false,
279
+ 'UK' => false,
280
+ 'US' => true,
281
+ 'label' => __( 'Industrial', $amazonjs->text_domain ),
282
+ ),
283
+ 'Jewelry' => array(
284
+ 'CA' => false,
285
+ 'CN' => true,
286
+ 'DE' => true,
287
+ 'ES' => false,
288
+ 'FR' => true,
289
+ 'IT' => false,
290
+ 'JP' => true,
291
+ 'UK' => true,
292
+ 'US' => true,
293
+ 'label' => __( 'Jewelry', $amazonjs->text_domain ),
294
+ ),
295
+ 'KindleStore' => array(
296
+ 'CA' => false,
297
+ 'CN' => true,
298
+ 'DE' => true,
299
+ 'ES' => true,
300
+ 'FR' => true,
301
+ 'IT' => true,
302
+ 'JP' => true, // fixed
303
+ 'UK' => true,
304
+ 'US' => true,
305
+ 'label' => __( 'KindleStore', $amazonjs->text_domain ),
306
+ ),
307
+ 'Kitchen' => array(
308
+ 'CA' => false,
309
+ 'CN' => false,
310
+ 'DE' => true,
311
+ 'ES' => true,
312
+ 'FR' => true,
313
+ 'IT' => true,
314
+ 'JP' => true,
315
+ 'UK' => true,
316
+ 'US' => true,
317
+ 'label' => __( 'Kitchen', $amazonjs->text_domain ),
318
+ ),
319
+ 'LawnAndGarden' => array(
320
+ 'CA' => false,
321
+ 'CN' => false,
322
+ 'DE' => false,
323
+ 'ES' => false,
324
+ 'FR' => false,
325
+ 'IT' => false,
326
+ 'JP' => false,
327
+ 'UK' => false,
328
+ 'US' => true,
329
+ 'label' => __( 'LawnAndGarden', $amazonjs->text_domain ),
330
+ ),
331
+ 'Lighting' => array(
332
+ 'CA' => false,
333
+ 'CN' => false,
334
+ 'DE' => true,
335
+ 'ES' => false,
336
+ 'FR' => true,
337
+ 'IT' => true,
338
+ 'JP' => false,
339
+ 'UK' => true,
340
+ 'US' => false,
341
+ 'label' => __( 'Lighting', $amazonjs->text_domain ),
342
+ ),
343
+ 'Magazines' => array(
344
+ 'CA' => false,
345
+ 'CN' => false,
346
+ 'DE' => true,
347
+ 'ES' => false,
348
+ 'FR' => false,
349
+ 'IT' => false,
350
+ 'JP' => false,
351
+ 'UK' => false,
352
+ 'US' => true,
353
+ 'label' => __( 'Magazines', $amazonjs->text_domain ),
354
+ ),
355
+ 'Marketplace' => array(
356
+ 'CA' => false,
357
+ 'CN' => false,
358
+ 'DE' => true,
359
+ 'ES' => false,
360
+ 'FR' => false,
361
+ 'IT' => false,
362
+ 'JP' => true,
363
+ 'UK' => true,
364
+ 'US' => true,
365
+ 'label' => __( 'Marketplace', $amazonjs->text_domain ),
366
+ ),
367
+ 'Miscellaneous' => array(
368
+ 'CA' => false,
369
+ 'CN' => false,
370
+ 'DE' => false,
371
+ 'ES' => false,
372
+ 'FR' => false,
373
+ 'IT' => false,
374
+ 'JP' => false,
375
+ 'UK' => true,
376
+ 'US' => false,
377
+ 'label' => __( 'Miscellaneous', $amazonjs->text_domain ),
378
+ ),
379
+ 'MobileApps' => array(
380
+ 'CA' => false,
381
+ 'CN' => false,
382
+ 'DE' => false,
383
+ 'ES' => false,
384
+ 'FR' => false,
385
+ 'IT' => false,
386
+ 'JP' => false,
387
+ 'UK' => false,
388
+ 'US' => true,
389
+ 'label' => __( 'MobileApps', $amazonjs->text_domain ),
390
+ ),
391
+ 'MP3Downloads' => array(
392
+ 'CA' => false,
393
+ 'CN' => false,
394
+ 'DE' => true,
395
+ 'ES' => false,
396
+ 'FR' => true,
397
+ 'IT' => false,
398
+ 'JP' => true,
399
+ 'UK' => true,
400
+ 'US' => true,
401
+ 'label' => __( 'MP3Downloads', $amazonjs->text_domain ),
402
+ ),
403
+ 'Music' => array(
404
+ 'CA' => true,
405
+ 'CN' => true,
406
+ 'DE' => true,
407
+ 'ES' => true,
408
+ 'FR' => true,
409
+ 'IT' => true,
410
+ 'JP' => true,
411
+ 'UK' => true,
412
+ 'US' => true,
413
+ 'label' => __( 'Music', $amazonjs->text_domain ),
414
+ ),
415
+ 'MusicalInstruments' => array(
416
+ 'CA' => false,
417
+ 'CN' => false,
418
+ 'DE' => true,
419
+ 'ES' => false,
420
+ 'FR' => true,
421
+ 'IT' => false,
422
+ 'JP' => true,
423
+ 'UK' => true,
424
+ 'US' => true,
425
+ 'label' => __( 'MusicalInstruments', $amazonjs->text_domain ),
426
+ ),
427
+ 'MusicTracks' => array(
428
+ 'CA' => false,
429
+ 'CN' => false,
430
+ 'DE' => true,
431
+ 'ES' => false,
432
+ 'FR' => true,
433
+ 'IT' => false,
434
+ 'JP' => true,
435
+ 'UK' => true,
436
+ 'US' => true,
437
+ 'label' => __( 'MusicTracks', $amazonjs->text_domain ),
438
+ ),
439
+ 'OfficeProducts' => array(
440
+ 'CA' => false,
441
+ 'CN' => true,
442
+ 'DE' => true,
443
+ 'ES' => false,
444
+ 'FR' => true,
445
+ 'IT' => false,
446
+ 'JP' => true,
447
+ 'UK' => true,
448
+ 'US' => true,
449
+ 'label' => __( 'OfficeProducts', $amazonjs->text_domain ),
450
+ ),
451
+ 'OutdoorLiving' => array(
452
+ 'CA' => false,
453
+ 'CN' => false,
454
+ 'DE' => true,
455
+ 'ES' => false,
456
+ 'FR' => false,
457
+ 'IT' => false,
458
+ 'JP' => false,
459
+ 'UK' => true,
460
+ 'US' => true,
461
+ 'label' => __( 'OutdoorLiving', $amazonjs->text_domain ),
462
+ ),
463
+ 'Outlet' => array(
464
+ 'CA' => false,
465
+ 'CN' => false,
466
+ 'DE' => true,
467
+ 'ES' => false,
468
+ 'FR' => false,
469
+ 'IT' => false,
470
+ 'JP' => false,
471
+ 'UK' => true,
472
+ 'US' => false,
473
+ 'label' => __( 'Outlet', $amazonjs->text_domain ),
474
+ ),
475
+ 'PCHardware' => array(
476
+ 'CA' => false,
477
+ 'CN' => false,
478
+ 'DE' => true,
479
+ 'ES' => false,
480
+ 'FR' => true,
481
+ 'IT' => false,
482
+ 'JP' => false,
483
+ 'UK' => true,
484
+ 'US' => true,
485
+ 'label' => __( 'PCHardware', $amazonjs->text_domain ),
486
+ ),
487
+ 'PetSupplies' => array(
488
+ 'CA' => false,
489
+ 'CN' => false,
490
+ 'DE' => false,
491
+ 'ES' => false,
492
+ 'FR' => false,
493
+ 'IT' => false,
494
+ 'JP' => false,
495
+ 'UK' => false,
496
+ 'US' => true,
497
+ 'label' => __( 'PetSupplies', $amazonjs->text_domain ),
498
+ ),
499
+ 'Photo' => array(
500
+ 'CA' => false,
501
+ 'CN' => true,
502
+ 'DE' => true,
503
+ 'ES' => false,
504
+ 'FR' => false,
505
+ 'IT' => false,
506
+ 'JP' => false,
507
+ 'UK' => false,
508
+ 'US' => true,
509
+ 'label' => __( 'Photo', $amazonjs->text_domain ),
510
+ ),
511
+ 'Shoes' => array(
512
+ 'CA' => false,
513
+ 'CN' => true,
514
+ 'DE' => true,
515
+ 'ES' => false,
516
+ 'FR' => true,
517
+ 'IT' => true,
518
+ 'JP' => true,
519
+ 'UK' => true,
520
+ 'US' => true,
521
+ 'label' => __( 'Shoes', $amazonjs->text_domain ),
522
+ ),
523
+ 'Software' => array(
524
+ 'CA' => true,
525
+ 'CN' => true,
526
+ 'DE' => true,
527
+ 'ES' => true,
528
+ 'FR' => true,
529
+ 'IT' => true,
530
+ 'JP' => true,
531
+ 'UK' => true,
532
+ 'US' => true,
533
+ 'label' => __( 'Software', $amazonjs->text_domain ),
534
+ ),
535
+ 'SoftwareVideoGames' => array(
536
+ 'CA' => true,
537
+ 'CN' => false,
538
+ 'DE' => true,
539
+ 'ES' => false,
540
+ 'FR' => true,
541
+ 'IT' => false,
542
+ 'JP' => false,
543
+ 'UK' => true,
544
+ 'US' => false,
545
+ 'label' => __( 'SoftwareVideoGames', $amazonjs->text_domain ),
546
+ ),
547
+ 'SportingGoods' => array(
548
+ 'CA' => false,
549
+ 'CN' => true,
550
+ 'DE' => true,
551
+ 'ES' => false,
552
+ 'FR' => true,
553
+ 'IT' => false,
554
+ 'JP' => true,
555
+ 'UK' => true,
556
+ 'US' => true,
557
+ 'label' => __( 'SportingGoods', $amazonjs->text_domain ),
558
+ ),
559
+ 'Tools' => array(
560
+ 'CA' => false,
561
+ 'CN' => false,
562
+ 'DE' => true,
563
+ 'ES' => false,
564
+ 'FR' => false,
565
+ 'IT' => false,
566
+ 'JP' => false,
567
+ 'UK' => true,
568
+ 'US' => true,
569
+ 'label' => __( 'Tools', $amazonjs->text_domain ),
570
+ ),
571
+ 'Toys' => array(
572
+ 'CA' => false,
573
+ 'CN' => true,
574
+ 'DE' => true,
575
+ 'ES' => true,
576
+ 'FR' => true,
577
+ 'IT' => true,
578
+ 'JP' => true,
579
+ 'UK' => true,
580
+ 'US' => true,
581
+ 'label' => __( 'Toys', $amazonjs->text_domain ),
582
+ ),
583
+ 'UnboxVideo' => array(
584
+ 'CA' => false,
585
+ 'CN' => false,
586
+ 'DE' => false,
587
+ 'ES' => false,
588
+ 'FR' => false,
589
+ 'IT' => false,
590
+ 'JP' => false,
591
+ 'UK' => false,
592
+ 'US' => true,
593
+ 'label' => __( 'UnboxVideo', $amazonjs->text_domain ),
594
+ ),
595
+ 'VHS' => array(
596
+ 'CA' => true,
597
+ 'CN' => false,
598
+ 'DE' => true,
599
+ 'ES' => false,
600
+ 'FR' => true,
601
+ 'IT' => false,
602
+ 'JP' => true,
603
+ 'UK' => true,
604
+ 'US' => true,
605
+ 'label' => __( 'VHS', $amazonjs->text_domain ),
606
+ ),
607
+ 'Video' => array(
608
+ 'CA' => true,
609
+ 'CN' => true,
610
+ 'DE' => true,
611
+ 'ES' => false,
612
+ 'FR' => true,
613
+ 'IT' => false,
614
+ 'JP' => true,
615
+ 'UK' => true,
616
+ 'US' => true,
617
+ 'label' => __( 'Video', $amazonjs->text_domain ),
618
+ ),
619
+ 'VideoGames' => array(
620
+ 'CA' => true,
621
+ 'CN' => true,
622
+ 'DE' => true,
623
+ 'ES' => true,
624
+ 'FR' => true,
625
+ 'IT' => true,
626
+ 'JP' => true,
627
+ 'UK' => true,
628
+ 'US' => true,
629
+ 'label' => __( 'VideoGames', $amazonjs->text_domain ),
630
+ ),
631
+ 'Watches' => array(
632
+ 'CA' => false,
633
+ 'CN' => true,
634
+ 'DE' => true,
635
+ 'ES' => true,
636
+ 'FR' => true,
637
+ 'IT' => true,
638
+ 'JP' => false,
639
+ 'UK' => true,
640
+ 'US' => true,
641
+ 'label' => __( 'Watches', $amazonjs->text_domain ),
642
+ ),
643
+ 'Wireless' => array(
644
+ 'CA' => false,
645
+ 'CN' => false,
646
+ 'DE' => false,
647
+ 'ES' => false,
648
+ 'FR' => false,
649
+ 'IT' => false,
650
+ 'JP' => false,
651
+ 'UK' => false,
652
+ 'US' => true,
653
+ 'label' => __( 'Wireless', $amazonjs->text_domain ),
654
+ ),
655
+ 'WirelessAccessories' => array(
656
+ 'CA' => false,
657
+ 'CN' => false,
658
+ 'DE' => false,
659
+ 'ES' => false,
660
+ 'FR' => false,
661
+ 'IT' => false,
662
+ 'JP' => false,
663
+ 'UK' => false,
664
+ 'US' => true,
665
+ 'label' => __( 'WirelessAccessories', $amazonjs->text_domain ),
666
+ ),
667
+ );
668
+ }
amazonjs.php ADDED
@@ -0,0 +1,987 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: AmazonJS
4
+ Plugin URI: http://wordpress.org/extend/plugins/amazonjs/
5
+ Description: Easy to use interface to add an amazon product to your post and display it by using jQuery template.
6
+ Author: makoto_kw
7
+ Version: 0.8
8
+ Author URI: http://makotokw.com
9
+ Requires at least: 3.3
10
+ Tested up to: 4.5
11
+ License: GPLv2
12
+ Text Domain: amazonjs
13
+ Domain Path: /languages/
14
+ */
15
+ /*
16
+ AmazonJS depends on
17
+ jQuery tmpl
18
+ PEAR Services_JSON: Michal Migurski <mike-json@teczno.com>
19
+ */
20
+
21
+ // TODO: Fixed NoSilencedErrors.Discouraged
22
+ // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged
23
+
24
+ require_once dirname( __FILE__ ) . '/lib/json.php';
25
+
26
+ class Amazonjs
27
+ {
28
+ const VERSION = '0.8';
29
+ const AWS_VERSION = '2011-08-01';
30
+ const CACHE_LIFETIME = 86400;
31
+
32
+ public $title;
33
+ public $url;
34
+ public $option_page_url;
35
+ public $plugin_rel_file;
36
+ public $option_page_name;
37
+ public $option_name;
38
+ public $setting_sections;
39
+ public $setting_fields;
40
+ public $default_settings;
41
+ public $settings;
42
+ public $text_domain;
43
+
44
+ public $media_type = 'amazonjs';
45
+ public $countries;
46
+ public $search_indexes;
47
+ public $display_items = array();
48
+ public $simple_template;
49
+
50
+ function __construct() {
51
+ $path = __FILE__;
52
+ $dir = dirname( $path );
53
+ $slug = basename( $dir );
54
+ $this->title = 'AmazonJS';
55
+ $this->plugin_rel_file = basename( $dir ) . DIRECTORY_SEPARATOR . basename( $path );
56
+ $this->option_page_name = basename( $dir );
57
+ $this->option_name = preg_replace( '/[\-\.]/', '_', $this->option_page_name ) . '_settings';
58
+ $this->url = plugins_url( '', $path );
59
+ $this->option_page_url = admin_url() . 'options-general.php?page=' . $this->option_page_name;
60
+ $this->text_domain = $slug;
61
+ load_plugin_textdomain( $this->text_domain, false, dirname( $this->plugin_rel_file ) . '/languages' );
62
+
63
+ $this->countries = array(
64
+ 'US' => array(
65
+ 'label' => __( 'United States', $this->text_domain ),
66
+ 'domain' => 'Amazon.com',
67
+ 'baseUri' => 'http://webservices.amazon.com',
68
+ 'linkTemplate' => '<iframe src="http://rcm.amazon.com/e/cm?t=${t}&o=1&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}&lt1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
69
+ 'associateTagSuffix' => '-20',
70
+ ),
71
+ 'UK' => array(
72
+ 'label' => __( 'United Kingdom', $this->text_domain ),
73
+ 'domain' => 'Amazon.co.uk',
74
+ 'baseUri' => 'http://webservices.amazon.co.uk',
75
+ 'linkTemplate' => '<iframe src="http://rcm-uk.amazon.co.uk/e/cm?t=${t}&o=2&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}&lt1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
76
+ 'associateTagSuffix' => '-21',
77
+ ),
78
+ 'DE' => array(
79
+ 'label' => __( 'Deutschland', $this->text_domain ),
80
+ 'domain' => 'Amazon.de',
81
+ 'baseUri' => 'http://webservices.amazon.de',
82
+ 'linkTemplate' => '<iframe src="http://rcm-de.amazon.de/e/cm?t=${t}&o=3&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}&lt1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
83
+ 'associateTagSuffix' => '04-21',
84
+ ),
85
+ 'FR' => array(
86
+ 'label' => __( 'France', $this->text_domain ),
87
+ 'domain' => 'Amazon.fr',
88
+ 'baseUri' => 'http://webservices.amazon.fr',
89
+ 'linkTemplate' => '<iframe src="http://rcm-fr.amazon.fr/e/cm?t=${t}&o=8&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}&lt1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
90
+ 'associateTagSuffix' => '09-21',
91
+ ),
92
+ 'JP' => array(
93
+ 'label' => __( 'Japan', $this->text_domain ),
94
+ 'domain' => 'Amazon.co.jp',
95
+ 'baseUri' => 'http://webservices.amazon.co.jp',
96
+ 'linkTemplate' => '<iframe src="http://rcm-jp.amazon.co.jp/e/cm?t=${t}&o=9&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}&lt1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
97
+ 'associateTagSuffix' => '-22',
98
+ ),
99
+ 'CA' => array(
100
+ 'label' => __( 'Canada', $this->text_domain ),
101
+ 'domain' => 'Amazon.ca',
102
+ 'baseUri' => 'http://webservices.amazon.ca',
103
+ 'linkTemplate' => '<iframe src="http://rcm-ca.amazon.ca/e/cm?t=${t}&o=15&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}&lt1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
104
+ 'associateTagSuffix' => '0c-20',
105
+ ),
106
+ 'CN' => array(
107
+ 'label' => __( 'China', $this->text_domain ),
108
+ 'domain' => 'Amazon.cn',
109
+ 'baseUri' => 'http://webservices.amazon.cn',
110
+ 'linkTemplate' => '<iframe src="http://rcm-cn.amazon.cn/e/cm?t=${t}&o=28&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}&lt1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
111
+ 'associateTagSuffix' => '-23',
112
+ ),
113
+ 'IT' => array(
114
+ 'label' => __( 'Italia', $this->text_domain ),
115
+ 'domain' => 'Amazon.it',
116
+ 'baseUri' => 'http://webservices.amazon.it',
117
+ 'linkTemplate' => '<iframe src="http://rcm-it.amazon.it/e/cm?t=${t}&o=29&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}&lt1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
118
+ 'associateTagSuffix' => '-21',
119
+ ),
120
+ 'ES' => array(
121
+ 'label' => __( 'España', $this->text_domain ),
122
+ 'domain' => 'Amazon.es',
123
+ 'baseUri' => 'http://webservices.amazon.es',
124
+ 'linkTemplate' => '<iframe src="http://rcm-es.amazon.es/e/cm?t=${t}&o=30&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}&lt1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
125
+ 'associateTagSuffix' => '-21',
126
+ ),
127
+ );
128
+ }
129
+
130
+ function clean() {
131
+ $this->delete_settings();
132
+ }
133
+
134
+ function init() {
135
+ $this->init_settings();
136
+
137
+ if ( is_admin() ) {
138
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
139
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
140
+ add_action( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
141
+ }
142
+ add_shortcode( 'amazonjs', array( $this, 'shortcode' ) );
143
+ if ( ! is_admin() ) {
144
+ add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_styles' ) );
145
+ add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
146
+ add_action( 'wp_footer', array( $this, 'wp_enqueue_scripts_for_footer' ), 1 );
147
+ }
148
+ }
149
+
150
+ function admin_init() {
151
+ add_action( 'media_buttons', array( $this, 'media_buttons' ), 20 );
152
+ add_action( 'media_upload_amazonjs', array( $this, 'media_upload_amazonjs' ) );
153
+ add_action( 'media_upload_amazonjs_keyword', array( $this, 'media_upload_amazonjs_keyword' ) );
154
+ add_action( 'media_upload_amazonjs_id', array( $this, 'media_upload_amazonjs_id' ) );
155
+ add_action( 'wp_ajax_amazonjs_search', array( $this, 'ajax_amazonjs_search' ) );
156
+
157
+ $page = $this->option_page_name;
158
+ register_setting( $this->option_name, $this->option_name, array( $this, 'validate_settings' ) );
159
+ if ( $this->setting_sections ) {
160
+ foreach ( $this->setting_sections as $key => $section ) {
161
+ add_settings_section( $page . '_' . $key, $section['label'], array( $this, $section['add'] ), $page );
162
+ }
163
+ }
164
+ foreach ( $this->setting_fields as $key => $field ) {
165
+ $label = ('checkbox' == $field['type']) ? '' : $field['label'];
166
+ add_settings_field(
167
+ $this->option_name . '_' . $key,
168
+ $label,
169
+ array( $this, 'add_settings_field' ),
170
+ $page,
171
+ $page . '_' . $field['section'],
172
+ array( $key, $field )
173
+ );
174
+ }
175
+ }
176
+
177
+ function admin_print_styles() {
178
+ global $wp_version;
179
+ // use dashicon
180
+ if ( version_compare( $wp_version, '3.8', '>=' ) ) {
181
+ wp_enqueue_style( 'amazonjs-options', $this->url . '/css/amazonjs-options.css', array(), self::VERSION );
182
+ }
183
+ }
184
+
185
+ function wp_enqueue_styles() {
186
+ if ( $this->settings['displayCustomerReview'] ) {
187
+ wp_enqueue_style( 'thickbox' );
188
+ }
189
+
190
+ if ( $this->settings['overrideThemeCss'] ) {
191
+ wp_enqueue_style( 'amazonjs', $this->url . '/css/amazonjs-force.css', array(), self::VERSION );
192
+ } else {
193
+ wp_enqueue_style( 'amazonjs', $this->url . '/css/amazonjs.css', array(), self::VERSION );
194
+ }
195
+ if ( $this->settings['customCss'] ) {
196
+ wp_enqueue_style( 'amazonjs-custom', get_stylesheet_directory_uri() . '/amazonjs.css' );
197
+ }
198
+ }
199
+
200
+ function wp_enqueue_scripts() {
201
+ wp_register_script( 'jquery-tmpl', $this->url . '/components/js/jquery-tmpl/jquery.tmpl.min.js', array( 'jquery' ), '1.0.0pre', true );
202
+
203
+ $depends = array( 'jquery-tmpl' );
204
+ if ( $this->settings['displayCustomerReview'] ) {
205
+ $depends[] = 'thickbox';
206
+ }
207
+ wp_register_script( 'amazonjs', $this->url . '/js/amazonjs.js', $depends, self::VERSION, true );
208
+ if ( $this->settings['customJs'] ) {
209
+ wp_register_script( 'amazonjs-custom', get_stylesheet_directory_uri() . '/amazonjs.js', array( 'amazonjs' ), self::VERSION, true );
210
+ }
211
+ }
212
+
213
+ function wp_enqueue_scripts_for_footer() {
214
+ $country_codes = array();
215
+ $items = array();
216
+ foreach ( $this->display_items as $country_code => $sub_items ) {
217
+ foreach ( $this->fetch_items( $country_code, $sub_items ) as $asin => $item ) {
218
+ $items[ $country_code . ':' . $asin ] = $item;
219
+ }
220
+ $country_codes[] = $country_code;
221
+ }
222
+
223
+ if ( count( $items ) == 0 ) {
224
+ return;
225
+ }
226
+
227
+ $this->enqueue_amazonjs_scripts( $items, $country_codes );
228
+ }
229
+
230
+ function enqueue_amazonjs_scripts( $items = array(), $country_codes = array() ) {
231
+ $wpurl = get_bloginfo( 'wpurl' );
232
+
233
+ $region = array();
234
+ foreach ( $this->countries as $code => $value ) {
235
+ if ( in_array( $code, $country_codes ) ) {
236
+ foreach ( array( 'linkTemplate' ) as $attr ) {
237
+ $region[ 'Link' . $code ] = $this->tmpl( $value[ $attr ], array( 't' => $this->settings[ 'associateTag' . $code ] ) );
238
+ }
239
+ }
240
+ }
241
+
242
+ $amazonVars = array(
243
+ 'thickboxUrl' => $wpurl . '/wp-includes/js/thickbox/',
244
+ 'regionTemplate' => $region,
245
+ 'resource' => array(
246
+ 'BookAuthor' => __( 'Author', $this->text_domain ),
247
+ 'BookPublicationDate' => __( 'PublicationDate', $this->text_domain ),
248
+ 'BookPublisher' => __( 'Publisher', $this->text_domain ),
249
+ 'NumberOfPagesValue' => __( '${NumberOfPages} pages', $this->text_domain ),
250
+ 'ListPrice' => __( 'List Price', $this->text_domain ),
251
+ 'Price' => __( 'Price', $this->text_domain ),
252
+ 'PriceUsage' => __( 'Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [amazon.com or endless.com, as applicable] at the time of purchase will apply to the purchase of this product.', $this->text_domain ),
253
+ 'PublicationDate' => __( 'Publication Date', $this->text_domain ),
254
+ 'ReleaseDate' => __( 'Release Date', $this->text_domain ),
255
+ 'SalesRank' => __( 'SalesRank', $this->text_domain ),
256
+ 'SalesRankValue' => __( '#${SalesRank}', $this->text_domain ),
257
+ 'RunningTime' => __( 'Run Time', $this->text_domain ),
258
+ 'RunningTimeValue' => __( '${RunningTime} minutes', $this->text_domain ),
259
+ 'CustomerReviewTitle' => __( '${Title} Customer Review', $this->text_domain ),
260
+ 'SeeCustomerReviews' => __( 'See Customer Reviews', $this->text_domain ),
261
+ 'PriceUpdatedat' => __( '(at ${UpdatedDate})', $this->text_domain ),
262
+ ),
263
+ 'isCustomerReviewEnabled' => ($this->settings['displayCustomerReview']) ? true : false,
264
+ 'isTrackEventEnabled' => ($this->settings['useTrackEvent']) ? true : false,
265
+ 'isFadeInEnabled' => ($this->settings['useAnimation']) ? true : false,
266
+ 'items' => array_values( $items ),
267
+
268
+ );
269
+ wp_localize_script( 'amazonjs', 'amazonjsVars', $amazonVars );
270
+
271
+ wp_enqueue_script( 'amazonjs' );
272
+ if ( $this->settings['customJs'] ) {
273
+ wp_enqueue_script( 'amazonjs-custom' );
274
+ }
275
+ }
276
+
277
+ function init_settings() {
278
+ // section
279
+ $this->setting_sections = array(
280
+ 'api' => array(
281
+ 'label' => __( 'Product Advertising API settings', $this->text_domain ),
282
+ 'add' => 'add_api_setting_section',
283
+ ),
284
+ 'associate' => array(
285
+ 'label' => __( 'Amazon Associates settings', $this->text_domain ),
286
+ 'add' => 'add_associate_setting_section',
287
+ ),
288
+ 'appearance' => array(
289
+ 'label' => __( 'Appearance settings', $this->text_domain ),
290
+ 'add' => 'add_appearance_setting_section',
291
+ ),
292
+ 'analytics' => array(
293
+ 'label' => __( 'Analytics settings', $this->text_domain ),
294
+ 'add' => 'add_analytics_setting_section',
295
+ ),
296
+ 'customize' => array(
297
+ 'label' => __( 'Customize', $this->text_domain ),
298
+ 'add' => 'add_customize_setting_section',
299
+ ),
300
+ );
301
+ // filed
302
+ $template_url = get_bloginfo( 'template_url' );
303
+ $this->setting_fields = array(
304
+ 'accessKeyId' => array(
305
+ 'label' => __( 'Access Key ID', $this->text_domain ),
306
+ 'type' => 'text',
307
+ 'size' => 60,
308
+ 'section' => 'api',
309
+ ),
310
+ 'secretAccessKey' => array(
311
+ 'label' => __( 'Secret Access Key', $this->text_domain ),
312
+ 'type' => 'text',
313
+ 'size' => 60,
314
+ 'section' => 'api',
315
+ ),
316
+ 'displayCustomerReview' => array(
317
+ 'label' => __( 'Display customer review', $this->text_domain ),
318
+ 'type' => 'checkbox',
319
+ 'section' => 'appearance',
320
+ 'description' => __( "AmazonJS will display customer review by using WordPress's Thickbox.", $this->text_domain ),
321
+ ),
322
+ 'supportDisabledJavascript' => array(
323
+ 'label' => __( 'Display official widget when disabled javascript in web browser', $this->text_domain ),
324
+ 'type' => 'checkbox',
325
+ 'section' => 'appearance',
326
+ 'description' => __( 'If set to true, AmazonJS will output html by using <code>&lt;script type=&quot;text/javascript&quot;&gt;document.write(&quot;{$indicator_html}&quot;)&lt;/script&gt;&lt;noscript&gt;{$link_html}&lt;/noscript&gt;</code>.', $this->text_domain ),
327
+ ),
328
+ 'useAnimation' => array(
329
+ 'label' => __( 'Use fadeIn animation', $this->text_domain ),
330
+ 'type' => 'checkbox',
331
+ 'section' => 'appearance',
332
+ ),
333
+ 'overrideThemeCss' => array(
334
+ 'label' => __( 'Override style of theme', $this->text_domain ),
335
+ 'type' => 'checkbox',
336
+ 'section' => 'appearance',
337
+ 'description' => __( 'If set to true, AmazonJS will override the style of the theme by using <code>!important</code> declaration.', $this->text_domain ),
338
+ ),
339
+ 'useTrackEvent' => array(
340
+ 'label' => __( 'Click Tracking by using Google Analytics', $this->text_domain ),
341
+ 'type' => 'checkbox',
342
+ 'section' => 'analytics',
343
+ 'description' => __( 'If set to true, AmazonJS will call <code>_gaq.push(["_trackEvent", "AmazonJS", "Click", "ASIN TITLE"])</code> or <code>ga("send", "event", "AmazonJS", "Click", "ASIN TITLE")</code>.', $this->text_domain ),
344
+ ),
345
+ 'customCss' => array(
346
+ 'label' => __( 'Use Custom Css', $this->text_domain ),
347
+ 'type' => 'checkbox',
348
+ 'section' => 'customize',
349
+ 'description' => '(' . $template_url . '/amazonjs.css)',
350
+ ),
351
+ 'customJs' => array(
352
+ 'label' => __( 'Use Custom Javascript', $this->text_domain ),
353
+ 'type' => 'checkbox',
354
+ 'section' => 'customize',
355
+ 'description' => '(' . $template_url . '/amazonjs.js)',
356
+ ),
357
+ );
358
+ foreach ( $this->countries as $key => $value ) {
359
+ $this->setting_fields[ 'associateTag' . $key ] = array(
360
+ 'label' => __( $value['domain'], $this->text_domain ),
361
+ 'type' => 'text',
362
+ 'size' => 30,
363
+ 'placeholder' => 'associatetag' . $value['associateTagSuffix'],
364
+ 'section' => 'associate',
365
+ );
366
+ }
367
+
368
+ $this->default_settings = array();
369
+ if ( is_array( $this->setting_fields ) ) {
370
+ foreach ( $this->setting_fields as $key => $field ) {
371
+ $this->default_settings[ $key ] = @$field['defaults'];
372
+ }
373
+ }
374
+ //delete_option($this->option_name);
375
+ $this->settings = wp_parse_args( (array) get_option( $this->option_name ), $this->default_settings );
376
+ }
377
+
378
+ function delete_settings() {
379
+ delete_option( $this->option_name );
380
+ }
381
+
382
+ function validate_settings( $settings ) {
383
+ foreach ( $this->setting_fields as $key => $field ) {
384
+ if ( 'checkbox' == $field['type'] ) {
385
+ $settings[ $key ] = ( 'on' == @$settings[ $key ] || '1' == @$settings[ $key ] );
386
+ }
387
+ }
388
+
389
+ foreach ( array( 'accessKeyId', 'secretAccessKey' ) as $key ) {
390
+ $settings[ $key ] = trim( $settings[ $key ] );
391
+ }
392
+
393
+ foreach ( $this->countries as $country_code => $value ) {
394
+ $key = 'associateTag' . $country_code;
395
+ $settings[ $key ] = trim( $settings[ $key ] );
396
+ }
397
+
398
+ return $settings;
399
+ }
400
+
401
+ function admin_menu() {
402
+ if ( function_exists( 'add_options_page' ) ) {
403
+ $page_hook_suffix = add_options_page(
404
+ __( $this->title, $this->text_domain ),
405
+ __( $this->title, $this->text_domain ),
406
+ 'manage_options',
407
+ $this->option_page_name,
408
+ array( $this, 'options_page' )
409
+ );
410
+ add_action( 'admin_print_styles-' . $page_hook_suffix, array( $this, 'admin_print_styles' ) );
411
+ }
412
+ }
413
+
414
+ function get_amazon_official_link( $asin, $country_code ) {
415
+ $tmpl = $this->countries[ $country_code ]['linkTemplate'];
416
+ $item = array(
417
+ 't' => $this->settings[ 'associateTag' . $country_code ],
418
+ 'asins' => $asin,
419
+ 'fc1' => '000000',
420
+ 'lc1' => '0000FF',
421
+ 'bc1' => '000000',
422
+ 'bg1' => 'FFFFFF',
423
+ 'IS2' => 1,
424
+ 'lt1' => '_blank',
425
+ 'f' => 'ifr',
426
+ 'm' => 'amazon',
427
+ );
428
+ return $this->tmpl( $tmpl, $item );
429
+ }
430
+
431
+ function shortcode( $atts, /** @noinspection PhpUnusedParameterInspection */ $content ) {
432
+ /**
433
+ * @var string $asin
434
+ * @var string $tmpl
435
+ * @var string $locale
436
+ * @var string $title
437
+ * @var string $imgsize
438
+ */
439
+ $defaults = array( 'asin' => '', 'tmpl' => '', 'locale' => $this->default_country_code(), 'title' => '', 'imgsize' => '' );
440
+ extract( shortcode_atts( $defaults, $atts ) );
441
+ if ( empty($asin) ) {
442
+ return '';
443
+ }
444
+ $country_code = strtoupper( $locale );
445
+ $imgsize = strtolower( $imgsize );
446
+ if ( is_feed() ) {
447
+ // use static html for rss reader
448
+ if ( $ai = $this->get_item( $country_code, $asin ) ) {
449
+ $aimg = $ai['SmallImage'];
450
+ if ( array_key_exists( 'MediumImage', $ai ) ) {
451
+ $aimg = $ai['MediumImage'];
452
+ }
453
+ return <<<EOF
454
+ <a href="{$ai['DetailPageURL']}" title="{$ai['Title']}" target="_blank">
455
+ <img src="{$aimg['src']}" width="{$aimg['width']}" height="{$aimg['height']}" alt="{$ai['Title']}"/>
456
+ {$ai['Title']}
457
+ </a>
458
+ EOF;
459
+ }
460
+ return $this->get_amazon_official_link( $asin, $country_code );
461
+ }
462
+ if ( ! isset($this->display_items[ $country_code ]) ) {
463
+ $this->display_items[ $country_code ] = array();
464
+ }
465
+ $item = (array_key_exists( $asin, $this->display_items[ $country_code ] ))
466
+ ? $this->display_items[ $country_code ][ $asin ]
467
+ : $this->display_items[ $country_code ][ $asin ] = get_site_transient("amazonjs_{$country_code}_{$asin}");
468
+ $url = '#';
469
+ if ( is_array( $item ) && array_key_exists( 'DetailPageURL', $item ) ) {
470
+ $url = $item['DetailPageURL'];
471
+ }
472
+ $indicator_html = <<<EOF
473
+ <div data-role="amazonjs" data-asin="{$asin}" data-locale="{$country_code}" data-tmpl="${tmpl}" data-img-size="${imgsize}" class="asin_{$asin}_{$country_code}_${tmpl} amazonjs_item"><div class="amazonjs_indicator"><span class="amazonjs_indicator_img"></span><a class="amazonjs_indicator_title" href="{$url}">{$title}</a><span class="amazonjs_indicator_footer"></span></div></div>
474
+ EOF;
475
+
476
+ $indicator_html = trim( $indicator_html );
477
+ if ( ! $this->settings['supportDisabledJavascript'] ) {
478
+ return $indicator_html;
479
+ }
480
+ $indicator_html = addslashes( $indicator_html );
481
+ $link_html = $this->get_amazon_official_link( $asin, $country_code );
482
+
483
+ return <<<EOF
484
+ <script type="text/javascript">document.write("{$indicator_html}")</script><noscript>{$link_html}</noscript>
485
+ EOF;
486
+ }
487
+
488
+ /**
489
+ * Gets default country code by get_locale
490
+ * @return string
491
+ */
492
+ function default_country_code() {
493
+ switch ( get_locale() ) {
494
+ case 'en_CA':
495
+ return 'CA';
496
+ case 'de_DE':
497
+ return 'DE';
498
+ case 'fr_FR':
499
+ return 'FR';
500
+ case 'ja':
501
+ return 'JP';
502
+ case 'en_GB':
503
+ return 'UK';
504
+ case 'zh_CN':
505
+ return 'CN';
506
+ case 'it_IT':
507
+ return 'IT';
508
+ case 'es_ES':
509
+ return 'ES';
510
+ }
511
+ return 'US';
512
+ }
513
+
514
+ function get_item( $country_code, $asin ) {
515
+ if ( $ai = get_site_transient( "amazonjs_{$country_code}_{$asin}" ) ) {
516
+ return $ai;
517
+ }
518
+ $items = $this->fetch_items( $country_code, array( $asin => false ) );
519
+ return @$items[ $asin ];
520
+ }
521
+
522
+ /**
523
+ * @param string $country_code
524
+ * @param array $items
525
+ * @return array
526
+ */
527
+ function fetch_items( $country_code, $items ) {
528
+ $now = time();
529
+ $item_ids = array();
530
+ foreach ( $items as $asin => $item ) {
531
+ if ( ! $item && $item['UpdatedAt'] + 86400 < $now ) {
532
+ $item_ids[] = $asin;
533
+ }
534
+ }
535
+ while ( count( $item_ids ) ) {
536
+ // fetch via 10 products
537
+ // ItemLookup ItemId: Must be a valid item ID. For more than one ID, use a comma-separated list of up to ten IDs.
538
+ $itemid = implode( ',', array_splice( $item_ids, 0, 10 ) );
539
+ $results = $this->itemlookup( $country_code, $itemid );
540
+ if ( $results && $results['success'] ) {
541
+ foreach ( $results['items'] as $item ) {
542
+ $items[ $item['ASIN'] ] = $item;
543
+ set_site_transient("amazonjs_{$country_code}_{$item['ASIN']}", $item, self::CACHE_LIFETIME);
544
+ }
545
+ }
546
+ }
547
+ return $items;
548
+ }
549
+
550
+ function tmpl( $tmpl, $item ) {
551
+ $s = $tmpl;
552
+ foreach ( $item as $key => $value ) {
553
+ $s = str_replace( '${' . $key . '}', $value, $s );
554
+ }
555
+ return $s;
556
+ }
557
+
558
+ function plugin_row_meta( $links, $file ) {
559
+ if ( $file == $this->plugin_rel_file ) {
560
+ array_push(
561
+ $links,
562
+ sprintf( '<a href="%s">%s</a>', $this->option_page_url, __( 'Settings' ) )
563
+ );
564
+ array_push(
565
+ $links,
566
+ sprintf( '<a href="https://github.com/makotokw/wp-amazonjs/releases" target="_blank">%s</a>', __( 'Old Releases', $this->text_domain ) )
567
+ );
568
+ }
569
+ return $links;
570
+ }
571
+
572
+ function add_api_setting_section() {
573
+ ?>
574
+ <p><?php _e( 'This plugin uses the Amazon Product Advertising API in order to get product infomation. Thus, you must use your Access Key ID &amp; Secret Access Key.', $this->text_domain ); ?></p>
575
+ <p><?php _e( 'You can sign up the Amazon Product Advertising API from <a href="https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html" target="_blank">here</a>. Please review the <a href="http://affiliate-program.amazon.com/gp/advertising/api/detail/agreement.html" target="_blank">Product Advertising API License Agreement</a> for details.', $this->text_domain ) ?></p>
576
+ <?php
577
+ }
578
+
579
+ function add_associate_setting_section() {
580
+ ?>
581
+ <p><?php _e( 'Amazon has an affiliate program called Amazon Associates. To apply for the Associates Program, visit the <a href="https://affiliate-program.amazon.com/" target="_blank">Amazon Associates website</a> for details.', $this->text_domain ); ?></p>
582
+ <p><?php _e( 'Associate Tag has been a <strong>required and verified</strong> input parameter in all requests to the Amazon Product Advertising API since 11/1/2011.', $this->text_domain ) ?></p>
583
+ <?php
584
+ }
585
+
586
+ function add_appearance_setting_section() {
587
+ }
588
+
589
+ function add_analytics_setting_section() {
590
+ }
591
+
592
+ function add_customize_setting_section() {
593
+ }
594
+
595
+ function add_settings_field( $args = array() ) {
596
+ // not work wordpress 2.9.0 #11143
597
+ if ( empty($args) ) {
598
+ return;
599
+ }
600
+ list ($key, $field) = $args;
601
+ $id = $this->option_name . '_' . $key;
602
+ $name = $this->option_name . "[{$key}]";
603
+ $value = $this->settings[ $key ];
604
+ if ( isset($field['html']) ) {
605
+ echo '' . $field['html'] . '';
606
+ } else {
607
+ switch ( $field['type'] ) {
608
+ case 'checkbox':
609
+ ?>
610
+ <input id="<?php echo esc_attr( $id ); ?>" name="<?php echo esc_attr( $name ); ?>" type="checkbox" <?php checked( true, $value ); ?> value="1" />
611
+ <label for="<?php echo esc_attr( $id ); ?>"><?php echo esc_html( $field['label'] ); ?></label>
612
+ <?php
613
+ break;
614
+ case 'radio':
615
+ $index = 1;
616
+ foreach ( $field['options'] as $v => $content ) {
617
+ $input_element_id = $id . '_' . $index;
618
+ ?>
619
+ <input id="<?php echo esc_attr( $input_element_id ); ?>" name="<?php echo esc_attr( $name ); ?>" type="radio" <?php checked( $v, $value ); ?> value="<?php echo esc_attr( $v ); ?>" />
620
+ <label for="<?php echo esc_attr( $input_element_id ); ?>"><?php echo esc_html( $content ); ?></label>
621
+ <?php
622
+ $index++;
623
+ }
624
+ break;
625
+ case 'select':
626
+ ?>
627
+ <select id="<?php echo esc_attr( $id ); ?>" name="<?php echo esc_attr( $name ); ?>">
628
+ <?php foreach ( $field['options'] as $option => $name ) : ?>
629
+ <option value="<?php echo esc_attr( $option ); ?>" <?php selected( $option, $value ); ?>><?php echo esc_html( $name ); ?></option>
630
+ <?php endforeach ?>
631
+ </select>
632
+ <?php
633
+ break;
634
+ case 'text':
635
+ default:
636
+ $size = @$field['size'];
637
+ $placeholder = @$field['placeholder'];
638
+ if ( $size <= 0 ) {
639
+ $size = 40;
640
+ }
641
+ if ( ! is_string( $placeholder ) ) {
642
+ $placeholder = '';
643
+ }
644
+ ?>
645
+ <input id="<?php echo esc_attr( $id ); ?>" name="<?php echo esc_attr( $name ); ?>" type="text" size="<?php echo esc_attr( $size ); ?>" value="<?php echo esc_attr( $value ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>"/>
646
+ <?php
647
+ break;
648
+ }
649
+ }
650
+ if ( @$field['description'] ) {
651
+ echo '<p class="description">' . $field['description'] . '</p>';
652
+ }
653
+ }
654
+
655
+ function media_buttons() {
656
+ global $post_ID, $temp_ID;
657
+ $iframe_ID = (int) ( 0 == $post_ID ? $temp_ID : $post_ID );
658
+ $iframe_src = 'media-upload.php?post_id=' . $iframe_ID . '&amp;type=' . $this->media_type . '&amp;tab=' . $this->media_type . '_keyword';
659
+ $label = __( 'Add Amazon Link', $this->text_domain );
660
+ ?>
661
+ <a href="<?php echo esc_attr( $iframe_src . '&amp;TB_iframe=true' ); ?>" id="add_amazon" class="button thickbox" title="<?php echo esc_attr( $label ); ?>"><img src="<?php echo esc_attr( $this->url . '/images/amazon-icon.png' ); ?>" alt="<?php echo esc_attr( $label ); ?>"/></a>
662
+ <?php
663
+ }
664
+
665
+ function media_upload_init() {
666
+ add_action( 'admin_print_styles', array( $this, 'wp_enqueue_styles' ) );
667
+
668
+ $this->wp_enqueue_scripts();
669
+ wp_enqueue_style( 'amazonjs-media-upload', $this->url . '/css/media-upload-type-amazonjs.css', array( 'amazonjs' ), self::VERSION );
670
+
671
+ $this->enqueue_amazonjs_scripts();
672
+ }
673
+
674
+ function media_upload_amazonjs() {
675
+ $this->media_upload_init();
676
+ wp_iframe( 'media_upload_type_amazonjs' );
677
+ }
678
+
679
+ function media_upload_amazonjs_keyword() {
680
+ $this->media_upload_init();
681
+ wp_iframe( 'media_upload_type_amazonjs_keyword' );
682
+ }
683
+
684
+ function media_upload_amazonjs_id() {
685
+ $this->media_upload_init();
686
+ wp_iframe( 'media_upload_type_amazonjs_id' );
687
+ }
688
+
689
+ function media_upload_tabs( /** @noinspection PhpUnusedParameterInspection */$tabs ) {
690
+ return array(
691
+ $this->media_type . '_keyword' => __( 'Keyword Search', $this->text_domain ),
692
+ $this->media_type . '_id' => __( 'Search by ASIN/URL', $this->text_domain ),
693
+ );
694
+ }
695
+
696
+ function options_page() {
697
+ ?>
698
+ <div class="wrap wrap-amazonjs">
699
+ <h2><?php echo esc_html( $this->title ); ?></h2>
700
+ <?php $this->options_page_header(); ?>
701
+ <!--suppress HtmlUnknownTarget -->
702
+ <form action="options.php" method="post">
703
+ <?php settings_fields( $this->option_name ); ?>
704
+ <?php do_settings_sections( $this->option_page_name ); ?>
705
+ <?php submit_button(); ?>
706
+ </form>
707
+ </div>
708
+ <?php
709
+ }
710
+
711
+ function options_page_header() {
712
+ ?>
713
+ <?php if ( ! function_exists( 'simplexml_load_string' ) ) : ?>
714
+ <div class="error">
715
+ <p><?php printf( __( 'Error! "simplexml_load_string" function is not found. %s requires PHP 5 and SimpleXML extension.', $this->text_domain ), $this->title ); ?></p>
716
+ </div>
717
+ <?php endif ?>
718
+ <?php
719
+ }
720
+
721
+ // amazon api
722
+ function itemlookup( $countryCode, $itemId ) {
723
+ $options = array();
724
+ $options['ItemId'] = $itemId;
725
+ $options['Operation'] = 'ItemLookup';
726
+ return $this->amazon_get( $countryCode, $options );
727
+ }
728
+
729
+ // amazon api
730
+ function itemsearch( $countryCode, $searchIndex, $keywords, $itemPage = 0 ) {
731
+ $options = array();
732
+ if ( $itemPage > 0 ) {
733
+ $options['ItemPage'] = $itemPage;
734
+ }
735
+ $options['Keywords'] = $keywords;
736
+ $options['Operation'] = 'ItemSearch';
737
+ if ( $searchIndex ) {
738
+ $options['SearchIndex'] = $searchIndex;
739
+ }
740
+ return $this->amazon_get( $countryCode, $options );
741
+ }
742
+
743
+ /**
744
+ * parse ASIN from URL
745
+ * @param string $url
746
+ * @return bool|string
747
+ */
748
+ static function parse_asin( $url ) {
749
+ if ( preg_match( '/^https?:\/\/.+\.amazon\.([^\/]+).+\/(dp|gp\/product|ASIN)\/([^\/]+)/', $url, $matches ) ) {
750
+ return $matches[3];
751
+ }
752
+ return null;
753
+ }
754
+
755
+ function ajax_amazonjs_search() {
756
+ $itemId = null;
757
+
758
+ // from http get
759
+ $itemPage = @$_GET['ItemPage'];
760
+ $id = @$_GET['ID'];
761
+ $keywords = @$_GET['Keywords'];
762
+ $searchIndex = @$_GET['SearchIndex'];
763
+ $countryCode = @$_GET['CountryCode'];
764
+
765
+ if ( ! empty($id) ) {
766
+ if ( preg_match( '/^https?:\/\//', $id ) ) {
767
+ if ( $asin = self::parse_asin( $id ) ) {
768
+ $itemId = $asin;
769
+ } else {
770
+ // url string as query keyword
771
+ $keywords = $id;
772
+ }
773
+ } else {
774
+ $itemId = $id;
775
+ }
776
+ } else if ( ! empty($keywords) ) {
777
+ if ( preg_match( '/^https?:\/\//', $keywords ) ) {
778
+ if ( $asin = self::parse_asin( $keywords ) ) {
779
+ $itemId = $asin;
780
+ }
781
+ }
782
+ }
783
+ $amazonjs = new Amazonjs();
784
+ $amazonjs->init();
785
+ if ( isset($itemId) ) {
786
+ $result = $amazonjs->itemlookup( $countryCode, $itemId );
787
+ die(json_encode( $result ));
788
+ } else {
789
+ $result = $amazonjs->itemsearch( $countryCode, $searchIndex, $keywords, $itemPage );
790
+ die(json_encode( $result ));
791
+ }
792
+ }
793
+
794
+ function amazon_get( $countryCode, $options ) {
795
+ $baseUri = $this->countries[ $countryCode ]['baseUri'];
796
+ $accessKeyId = @trim( $this->settings['accessKeyId'] );
797
+ $secretAccessKey = @trim( $this->settings['secretAccessKey'] );
798
+ $associateTag = @$this->settings[ 'associateTag' . $countryCode ];
799
+
800
+ // validate request
801
+ if ( empty($countryCode) || (empty($options['ItemId']) && empty($options['Keywords'])) || (empty($accessKeyId) || empty($secretAccessKey)) ) {
802
+ $message = __( 'Invalid Request Parameters', $this->text_domain );
803
+ return compact( 'success', 'message' );
804
+ }
805
+
806
+ $options['AWSAccessKeyId'] = $accessKeyId;
807
+ if ( ! empty($associateTag) ) {
808
+ $options['AssociateTag'] = @trim( $associateTag );
809
+ }
810
+ $options['ResponseGroup'] = 'ItemAttributes,Small,Images,OfferSummary,SalesRank,Reviews';
811
+ $options['Service'] = 'AWSECommerceService';
812
+ $options['Timestamp'] = gmdate( 'Y-m-d\TH:i:s\Z' );
813
+ $options['Version'] = self::AWS_VERSION;
814
+ ksort( $options );
815
+ $params = array();
816
+ foreach ( $options as $k => $v ) {
817
+ $params[] = $k . '=' . self::urlencode_rfc3986( $v );
818
+ }
819
+ $query = implode( '&', $params );
820
+ $urlInfo = parse_url( $baseUri );
821
+ $signature = sprintf( "GET\n%s\n/onca/xml\n%s", $urlInfo['host'], $query );
822
+ $signature = base64_encode( hash_hmac( 'sha256', $signature, $secretAccessKey, true ) );
823
+ unset($params, $urlInfo);
824
+
825
+ $url = sprintf( '%s/onca/xml?%s&Signature=%s', $baseUri, $query, self::urlencode_rfc3986( $signature ) );
826
+
827
+ $response = wp_remote_request(
828
+ $url,
829
+ array(
830
+ 'timeout' => 30,
831
+ )
832
+ );
833
+
834
+ if ( is_wp_error( $response ) ) {
835
+ $error = '';
836
+ $errors = $response->get_error_messages();
837
+ if ( is_array( $errors ) ) {
838
+ $error = implode( '<br/>', $errors );
839
+ }
840
+ $message = sprintf( __( 'Network Error: %s', $this->text_domain ), $error );
841
+ return compact( 'success', 'message' );
842
+ }
843
+
844
+ $body = wp_remote_retrieve_body( $response );
845
+ if ( empty($body) ) {
846
+ $message = sprintf( __( 'Empty Response from %s', $this->text_domain ), $url );
847
+ return compact( 'success', 'message' );
848
+ }
849
+
850
+ $fetchedAt = time();
851
+
852
+ $success = false;
853
+ /* @var $xml stdClass */
854
+ $xml = @simplexml_load_string( $body );
855
+ if ( WP_DEBUG ) {
856
+ if ( ! $xml ) {
857
+ error_log( 'amazonjs: cannot parse xml: ' . $body );
858
+ }
859
+ }
860
+
861
+ if ( $xml ) {
862
+ if ( 'True' == (string) @$xml->Items->Request->IsValid ) {
863
+ $success = true;
864
+ $items = array();
865
+ $operation = $options['Operation'];
866
+ if ( 'ItemSearch' == $operation ) {
867
+ $os = array(); // OpenSearch
868
+ $request = $xml->Items->Request->ItemSearchRequest;
869
+ $resultMap = self::to_array( $xml->Items->SearchResultsMap );
870
+ $itemsParPage = 10;
871
+ $startPage = ($request->ItemPage) ? (int) $request->ItemPage : 1;
872
+ $os['itemsPerPage'] = $itemsParPage;
873
+ $os['startIndex'] = ($startPage - 1) * $itemsParPage + 1;
874
+ $os['Query'] = array( 'searchTerms' => (string) $request->Keywords, 'startPage' => $startPage );
875
+ }
876
+ $os['totalResults'] = (int) $xml->Items->TotalResults;
877
+ $os['totalPages'] = (int) $xml->Items->TotalPages;
878
+
879
+ foreach ( $xml->Items->Item as $item ) {
880
+ $r = self::to_array( $item->ItemAttributes );
881
+ $r['ASIN'] = trim( (string) $item->ASIN );
882
+ $r['DetailPageURL'] = trim( (string) $item->DetailPageURL );
883
+ $r['SalesRank'] = (int) $item->SalesRank;
884
+ if ( $reviews = $item->CustomerReviews ) {
885
+ $r['IFrameReviewURL'] = (string) $reviews->IFrameURL;
886
+ }
887
+ $r['OfferSummary'] = self::to_array( $item->OfferSummary );
888
+ $r['SmallImage'] = self::image_element( $item->SmallImage );
889
+ $r['MediumImage'] = self::image_element( $item->MediumImage );
890
+ $r['LargeImage'] = self::image_element( $item->LargeImage );
891
+ $r['CountryCode'] = $countryCode;
892
+ $r['UpdatedAt'] = $fetchedAt;
893
+ $items[] = $r;
894
+ }
895
+ if ( 'ItemLookup' == $operation ) {
896
+ if ( 0 == $os['totalResults'] ) {
897
+ $os['totalResults'] = count( $items );
898
+ }
899
+ if ( 0 == $os['totalPages'] ) {
900
+ $os['totalPages'] = 1;
901
+ }
902
+ }
903
+ } else {
904
+ if ( $error = @$xml->Items->Request->Errors->Error ) {
905
+ $message = __( 'Amazon Product Advertising API Error', $this->text_domain );
906
+ $error_code = (string) @$error->Code;
907
+ $error_message = (string) @$error->Message;
908
+ } elseif ( $error = @$xml->Error ) {
909
+ $message = __( 'Amazon Product Advertising API Error', $this->text_domain );
910
+ $error_code = (string) @$error->Code;
911
+ $error_message = (string) @$error->Message;
912
+ } else {
913
+ $message = __( 'Cannot Parse Amazon Product Advertising API Response' );
914
+ $error_body = (string) $body;
915
+ }
916
+ }
917
+ } else {
918
+ $message = __( 'Invalid Response', $this->text_domain );
919
+ }
920
+ return compact( 'success', 'operation', 'os', 'items', 'resultMap', 'message', 'error_code' , 'error_message', 'error_body' );
921
+ }
922
+
923
+ static function to_array( $element ) {
924
+ $orgElement = $element;
925
+ if ( is_object( $element ) && 'SimpleXMLElement' == get_class( $element ) ) {
926
+ $element = get_object_vars( $element );
927
+ }
928
+ if ( is_array( $element ) ) {
929
+ $result = array();
930
+ if ( count( $element ) <= 0 ) {
931
+ return trim( strval( $orgElement ) );
932
+ }
933
+ foreach ( $element as $key => $value ) {
934
+ if ( is_string( $key ) && '@attributes' == $key ) {
935
+ continue;
936
+ }
937
+ $result[ $key ] = self::to_array( $value );
938
+ }
939
+ return $result;
940
+ } else {
941
+ return trim( strval( $element ) );
942
+ }
943
+ }
944
+
945
+ static function image_element( $element ) {
946
+ if ( $element ) {
947
+ $src = trim( (string) @$element->URL );
948
+ $width = (int) @$element->Width;
949
+ $height = (int) @$element->Height;
950
+ return compact( 'src', 'width', 'height' );
951
+ }
952
+ return null;
953
+ }
954
+
955
+ static function urlencode_rfc3986( $string ) {
956
+ return str_replace( '%7E', '~', rawurlencode( $string ) );
957
+ }
958
+ }
959
+
960
+ function media_upload_type_amazonjs() {
961
+ include dirname( __FILE__ ) . '/media-upload-type-amazonjs.php';
962
+ }
963
+
964
+ function media_upload_type_amazonjs_keyword() {
965
+ include dirname( __FILE__ ) . '/media-upload-type-amazonjs.php';
966
+ }
967
+
968
+ function media_upload_type_amazonjs_id() {
969
+ include dirname( __FILE__ ) . '/media-upload-type-amazonjs.php';
970
+ }
971
+
972
+ function amazonjs_init() {
973
+ global $amazonjs;
974
+ $amazonjs = new Amazonjs();
975
+ $amazonjs->init();
976
+ }
977
+
978
+ function amazonjs_uninstall() {
979
+ $amazonjs = new Amazonjs();
980
+ $amazonjs->clean();
981
+ unset($amazonjs);
982
+ }
983
+
984
+ add_action( 'init', 'amazonjs_init' );
985
+ if ( function_exists( 'register_uninstall_hook' ) ) {
986
+ register_uninstall_hook( __FILE__, 'amazonjs_uninstall' );
987
+ }
components/js/jquery-tmpl/jquery.tmpl.min.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery Templates Plugin 1.0.0pre
3
+ * http://github.com/jquery/jquery-tmpl
4
+ * Requires jQuery 1.4.2
5
+ *
6
+ * Copyright 2011, Software Freedom Conservancy, Inc.
7
+ * Dual licensed under the MIT or GPL Version 2 licenses.
8
+ * http://jquery.org/license
9
+ */
10
+ (function(a){var r=a.fn.domManip,d="_tmplitem",q=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,b={},f={},e,p={key:0,data:{}},i=0,c=0,l=[];function g(g,d,h,e){var c={data:e||(e===0||e===false)?e:d?d.data:{},_wrap:d?d._wrap:null,tmpl:null,parent:d||null,nodes:[],calls:u,nest:w,wrap:x,html:v,update:t};g&&a.extend(c,g,{nodes:[],parent:d});if(h){c.tmpl=h;c._ctnt=c._ctnt||c.tmpl(a,c);c.key=++i;(l.length?f:b)[i]=c}return c}a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(f,d){a.fn[f]=function(n){var g=[],i=a(n),k,h,m,l,j=this.length===1&&this[0].parentNode;e=b||{};if(j&&j.nodeType===11&&j.childNodes.length===1&&i.length===1){i[d](this[0]);g=this}else{for(h=0,m=i.length;h<m;h++){c=h;k=(h>0?this.clone(true):this).get();a(i[h])[d](k);g=g.concat(k)}c=0;g=this.pushStack(g,f,i.selector)}l=e;e=null;a.tmpl.complete(l);return g}});a.fn.extend({tmpl:function(d,c,b){return a.tmpl(this[0],d,c,b)},tmplItem:function(){return a.tmplItem(this[0])},template:function(b){return a.template(b,this[0])},domManip:function(d,m,k){if(d[0]&&a.isArray(d[0])){var g=a.makeArray(arguments),h=d[0],j=h.length,i=0,f;while(i<j&&!(f=a.data(h[i++],"tmplItem")));if(f&&c)g[2]=function(b){a.tmpl.afterManip(this,b,k)};r.apply(this,g)}else r.apply(this,arguments);c=0;!e&&a.tmpl.complete(b);return this}});a.extend({tmpl:function(d,h,e,c){var i,k=!c;if(k){c=p;d=a.template[d]||a.template(null,d);f={}}else if(!d){d=c.tmpl;b[c.key]=c;c.nodes=[];c.wrapped&&n(c,c.wrapped);return a(j(c,null,c.tmpl(a,c)))}if(!d)return[];if(typeof h==="function")h=h.call(c||{});e&&e.wrapped&&n(e,e.wrapped);i=a.isArray(h)?a.map(h,function(a){return a?g(e,c,d,a):null}):[g(e,c,d,h)];return k?a(j(c,null,i)):i},tmplItem:function(b){var c;if(b instanceof a)b=b[0];while(b&&b.nodeType===1&&!(c=a.data(b,"tmplItem"))&&(b=b.parentNode));return c||p},template:function(c,b){if(b){if(typeof b==="string")b=o(b);else if(b instanceof a)b=b[0]||{};if(b.nodeType)b=a.data(b,"tmpl")||a.data(b,"tmpl",o(b.innerHTML));return typeof c==="string"?(a.template[c]=b):b}return c?typeof c!=="string"?a.template(null,c):a.template[c]||a.template(null,q.test(c)?c:a(c)):null},encode:function(a){return(""+a).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){b={}},afterManip:function(f,b,d){var e=b.nodeType===11?a.makeArray(b.childNodes):b.nodeType===1?[b]:[];d.call(f,b);m(e);c++}});function j(e,g,f){var b,c=f?a.map(f,function(a){return typeof a==="string"?e.key?a.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+d+'="'+e.key+'" $2'):a:j(a,e,a._ctnt)}):e;if(g)return c;c=c.join("");c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(f,c,e,d){b=a(e).get();m(b);if(c)b=k(c).concat(b);if(d)b=b.concat(k(d))});return b?b:k(c)}function k(c){var b=document.createElement("div");b.innerHTML=c;return a.makeArray(b.childNodes)}function o(b){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+a.trim(b).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(m,l,k,g,b,c,d){var j=a.tmpl.tag[k],i,e,f;if(!j)throw"Unknown template tag: "+k;i=j._default||[];if(c&&!/\w$/.test(b)){b+=c;c=""}if(b){b=h(b);d=d?","+h(d)+")":c?")":"";e=c?b.indexOf(".")>-1?b+h(c):"("+b+").call($item"+d:b;f=c?e:"(typeof("+b+")==='function'?("+b+").call($item):("+b+"))"}else f=e=i.$1||"null";g=h(g);return"');"+j[l?"close":"open"].split("$notnull_1").join(b?"typeof("+b+")!=='undefined' && ("+b+")!=null":"true").split("$1a").join(f).split("$1").join(e).split("$2").join(g||i.$2||"")+"__.push('"})+"');}return __;")}function n(c,b){c._wrap=j(c,true,a.isArray(b)?b:[q.test(b)?b:a(b).html()]).join("")}function h(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function s(b){var a=document.createElement("div");a.appendChild(b.cloneNode(true));return a.innerHTML}function m(o){var n="_"+c,k,j,l={},e,p,h;for(e=0,p=o.length;e<p;e++){if((k=o[e]).nodeType!==1)continue;j=k.getElementsByTagName("*");for(h=j.length-1;h>=0;h--)m(j[h]);m(k)}function m(j){var p,h=j,k,e,m;if(m=j.getAttribute(d)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(p=h.getAttribute(d)));if(p!==m){h=h.parentNode?h.nodeType===11?0:h.getAttribute(d)||0:0;if(!(e=b[m])){e=f[m];e=g(e,b[h]||f[h]);e.key=++i;b[i]=e}c&&o(m)}j.removeAttribute(d)}else if(c&&(e=a.data(j,"tmplItem"))){o(e.key);b[e.key]=e;h=a.data(j.parentNode,"tmplItem");h=h?h.key:0}if(e){k=e;while(k&&k.key!=h){k.nodes.push(j);k=k.parent}delete e._ctnt;delete e._wrap;a.data(j,"tmplItem",e)}function o(a){a=a+n;e=l[a]=l[a]||g(e,b[e.parent.key+n]||e.parent)}}}function u(a,d,c,b){if(!a)return l.pop();l.push({_:a,tmpl:d,item:this,data:c,options:b})}function w(d,c,b){return a.tmpl(a.template(d),c,b,this)}function x(b,d){var c=b.options||{};c.wrapped=d;return a.tmpl(a.template(b.tmpl),b.data,c,b.item)}function v(d,c){var b=this._wrap;return a.map(a(a.isArray(b)?b.join(""):b).filter(d||"*"),function(a){return c?a.innerText||a.textContent:a.outerHTML||s(a)})}function t(){var b=this.nodes;a.tmpl(null,null,null,this).insertBefore(b[0]);a(b).remove()}})(jQuery);
css/amazonjs-force.css ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .amazonjs_item {
2
+ font-size: 14px;
3
+ margin: .5em 0 1em 0;
4
+ padding: 25px 10px 25px 10px;
5
+ border: 1px solid #ddd;
6
+ position: relative;
7
+ display: block;
8
+ background: white url(../images/amazonjs.png) no-repeat right bottom;
9
+ color: #333;
10
+ }
11
+ .amazonjs_item a {
12
+ color: #e47911;
13
+ text-decoration: none;
14
+ }
15
+ .amazonjs_item a:hover {
16
+ color: #996633;
17
+ }
18
+ .amazonjs_item * {
19
+ margin: 0;
20
+ padding: 0;
21
+ border: 0;
22
+ }
23
+ .amazonjs_item .amazonjs_indicator {
24
+ margin: 0 10px;
25
+ clear: both;
26
+ }
27
+ .amazonjs_item .amazonjs_indicator .amazonjs_indicator_img {
28
+ float: left;
29
+ display: block;
30
+ width: 32px;
31
+ height: 32px;
32
+ background: transparent url(../images/ajax-loader.gif) no-repeat center;
33
+ }
34
+ .amazonjs_item .amazonjs_indicator .amazonjs_indicator_title {
35
+ display: block;
36
+ line-height: 32px;
37
+ margin-left: 42px;
38
+ }
39
+ .amazonjs_item .amazonjs_indicator .amazonjs_indicator_footer {
40
+ clear: both;
41
+ }
42
+ .amazonjs_item .amazonjs_image {
43
+ display: block;
44
+ float: left;
45
+ margin-right: 10px;
46
+ }
47
+ .amazonjs_item .amazonjs_info {
48
+ display: block;
49
+ }
50
+ .amazonjs_item .amazonjs_info h4 {
51
+ margin: 0 0 5px !important;
52
+ padding: 0 !important;
53
+ font-size: 1.2em !important;
54
+ font-weight: bold !important;
55
+ clear: none !important;
56
+ border: none !important;
57
+ }
58
+ .amazonjs_item .amazonjs_info ul {
59
+ list-style: none !important;
60
+ margin: 0 !important;
61
+ padding: 0 !important;
62
+ }
63
+ .amazonjs_item .amazonjs_info ul li {
64
+ list-style: none !important;
65
+ line-height: 1.5em !important;
66
+ font-size: 1em !important;
67
+ margin: 0 !important;
68
+ padding: 0 !important;
69
+ }
70
+ .amazonjs_item .amazonjs_info ul li b {
71
+ margin-right: .5em;
72
+ color: #555;
73
+ font-weight: normal;
74
+ }
75
+ .amazonjs_item .amazonjs_info .amazonjs_price {
76
+ color: #900;
77
+ }
78
+ .amazonjs_item .amazonjs_info .amazonjs_price span {
79
+ color: #666;
80
+ margin-left: .5em;
81
+ }
82
+ .amazonjs_item .amazonjs_info .amazonjs_listprice {
83
+ text-decoration: line-through;
84
+ }
85
+ .amazonjs_item .amazonjs_review {
86
+ padding: 0;
87
+ font-size: 0.7em;
88
+ position: absolute;
89
+ right: 34px;
90
+ bottom: 4px;
91
+ }
92
+ #preview .amazonjs_item .amazonjs_review {
93
+ display: none;
94
+ }
95
+ .amazonjs_item .amazonjs_footer {
96
+ clear: both;
97
+ }
98
+
99
+ .amazonjs_book .amazonjs_info ul,
100
+ .amazonjs_music .amazonjs_info ul {
101
+ margin-top: 0.5em;
102
+ }
103
+
104
+ .amazonjs_book .amazonjs_info ul li,
105
+ .amazonjs_music .amazonjs_info ul li {
106
+ line-height: 1.6em;
107
+ }
108
+
109
+ @media (max-width: 720px) {
110
+ .amazonjs_item .amazonjs_info {
111
+ margin-bottom: 10px;
112
+ }
113
+ }
114
+ @media (max-width: 480px) {
115
+ .amazonjs_item img {
116
+ width: 60px;
117
+ max-width: 60px;
118
+ }
119
+ .amazonjs_item .amazonjs_info {
120
+ margin-left: 70px !important;
121
+ }
122
+ .amazonjs_item .amazonjs_info h4 a {
123
+ font-size: 0.9em;
124
+ }
125
+ .amazonjs_item .amazonjs_info ul li {
126
+ font-size: 0.9em;
127
+ }
128
+ }
css/amazonjs-options.css ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ .wrap-amazonjs > h2:before {
2
+ font-family: "dashicons";
3
+ content: "\f108";
4
+ font-size: 1.2em;
5
+ vertical-align: -20%;
6
+ }
css/amazonjs.css ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .amazonjs_item {
2
+ font-size: 14px;
3
+ margin: .5em 0 1em 0;
4
+ padding: 25px 10px 25px 10px;
5
+ border: 1px solid #ddd;
6
+ position: relative;
7
+ display: block;
8
+ background: white url(../images/amazonjs.png) no-repeat right bottom;
9
+ color: #333;
10
+ }
11
+ .amazonjs_item a {
12
+ color: #e47911;
13
+ text-decoration: none;
14
+ }
15
+ .amazonjs_item a:hover {
16
+ color: #996633;
17
+ }
18
+ .amazonjs_item * {
19
+ margin: 0;
20
+ padding: 0;
21
+ border: 0;
22
+ }
23
+ .amazonjs_item .amazonjs_indicator {
24
+ margin: 0 10px;
25
+ clear: both;
26
+ }
27
+ .amazonjs_item .amazonjs_indicator .amazonjs_indicator_img {
28
+ float: left;
29
+ display: block;
30
+ width: 32px;
31
+ height: 32px;
32
+ background: transparent url(../images/ajax-loader.gif) no-repeat center;
33
+ }
34
+ .amazonjs_item .amazonjs_indicator .amazonjs_indicator_title {
35
+ display: block;
36
+ line-height: 32px;
37
+ margin-left: 42px;
38
+ }
39
+ .amazonjs_item .amazonjs_indicator .amazonjs_indicator_footer {
40
+ clear: both;
41
+ }
42
+ .amazonjs_item .amazonjs_image {
43
+ display: block;
44
+ float: left;
45
+ margin-right: 10px;
46
+ }
47
+ .amazonjs_item .amazonjs_info {
48
+ display: block;
49
+ }
50
+ .amazonjs_item .amazonjs_info h4 {
51
+ margin: 0 0 5px;
52
+ padding: 0;
53
+ font-size: 1.2em;
54
+ font-weight: bold;
55
+ clear: none;
56
+ border: none;
57
+ }
58
+ .amazonjs_item .amazonjs_info ul {
59
+ list-style: none;
60
+ margin: 0;
61
+ padding: 0;
62
+ }
63
+ .amazonjs_item .amazonjs_info ul li {
64
+ list-style: none;
65
+ line-height: 1.5em;
66
+ font-size: 1em;
67
+ margin: 0;
68
+ padding: 0;
69
+ }
70
+ .amazonjs_item .amazonjs_info ul li b {
71
+ margin-right: .5em;
72
+ color: #555;
73
+ font-weight: normal;
74
+ }
75
+ .amazonjs_item .amazonjs_info .amazonjs_price {
76
+ color: #900;
77
+ }
78
+ .amazonjs_item .amazonjs_info .amazonjs_price span {
79
+ color: #666;
80
+ margin-left: .5em;
81
+ }
82
+ .amazonjs_item .amazonjs_info .amazonjs_listprice {
83
+ text-decoration: line-through;
84
+ }
85
+ .amazonjs_item .amazonjs_review {
86
+ padding: 0;
87
+ font-size: 0.7em;
88
+ position: absolute;
89
+ right: 34px;
90
+ bottom: 4px;
91
+ }
92
+ #preview .amazonjs_item .amazonjs_review {
93
+ display: none;
94
+ }
95
+ .amazonjs_item .amazonjs_footer {
96
+ clear: both;
97
+ }
98
+
99
+ .amazonjs_book .amazonjs_info ul,
100
+ .amazonjs_music .amazonjs_info ul {
101
+ margin-top: 0.5em;
102
+ }
103
+
104
+ .amazonjs_book .amazonjs_info ul li,
105
+ .amazonjs_music .amazonjs_info ul li {
106
+ line-height: 1.6em;
107
+ }
108
+
109
+ @media (max-width: 720px) {
110
+ .amazonjs_item .amazonjs_info {
111
+ margin-bottom: 10px;
112
+ }
113
+ }
114
+ @media (max-width: 480px) {
115
+ .amazonjs_item img {
116
+ width: 60px;
117
+ max-width: 60px;
118
+ }
119
+ .amazonjs_item .amazonjs_info {
120
+ margin-left: 70px !important;
121
+ }
122
+ .amazonjs_item .amazonjs_info h4 a {
123
+ font-size: 0.9em;
124
+ }
125
+ .amazonjs_item .amazonjs_info ul li {
126
+ font-size: 0.9em;
127
+ }
128
+ }
css/media-upload-type-amazonjs.css ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .amazonjs_search_form input[type="text"] {
2
+ margin: 5px 0;
3
+ padding: 5px;
4
+ width: 80%;
5
+ }
6
+ .amazonjs_search_form .button-large {
7
+ height: 30px !important;
8
+ line-height: 28px !important;
9
+ padding: 0 12px 2px !important;
10
+ }
11
+
12
+ #search_results {
13
+ margin: 1em;
14
+ min-height: 200px;
15
+ }
16
+ #search_results .error .error_body {
17
+ overflow: auto;
18
+ }
19
+ #search_results .indicator {
20
+ display: block;
21
+ width: 300px;
22
+ height: 200px;
23
+ margin: 0 auto;
24
+ background: transparent url(../images/ajax-loader.gif) no-repeat center;
25
+ }
26
+ #search_results .searchindex {
27
+ clear: both;
28
+ }
29
+ #search_results .searchpager {
30
+ border: 1px solid #ddd;
31
+ text-align: center;
32
+ padding: 2px;
33
+ margin: 2px;
34
+ }
35
+ #search_results .searchpager .prev {
36
+ margin-right: 1em;
37
+ }
38
+ #search_results .searchpager .next {
39
+ margin-left: 1em;
40
+ }
41
+ #search_results .amazonjs_searchitem {
42
+ display: block;
43
+ margin: 0;
44
+ padding: 5px;
45
+ border-bottom: 1px solid #ddd;
46
+ }
47
+ #search_results .amazonjs_searchitem .amazonjs_footer {
48
+ clear: both;
49
+ }
50
+ #search_results h4 {
51
+ display: inline;
52
+ font-size: 1em;
53
+ font-weight: normal;
54
+ margin: .5em;
55
+ }
56
+ #search_results h4 a {
57
+ text-decoration: none;
58
+ }
59
+ #search_results img {
60
+ float: left;
61
+ border: 1px solid #DFDFDF;
62
+ }
63
+ #search_results .amazonjs_searchitem .select {
64
+ float: right !important;
65
+ margin-left: 1em;
66
+ }
67
+
68
+ #overlay {
69
+ position: absolute;
70
+ display: none;
71
+ top: 0px;
72
+ left: 0px;
73
+ width: 100%;
74
+ height: 100%;
75
+ background-color: #fff;
76
+ filter: alpha(opacity=75);
77
+ /*IE*/
78
+ -moz-opacity: 0.75;
79
+ /*FF*/
80
+ opacity: 0.75;
81
+ }
82
+
83
+ #template_form {
84
+ position: absolute;
85
+ display: none;
86
+ border: 1px solid #ddd;
87
+ background-color: #fff;
88
+ left: 5px;
89
+ right: 5px;
90
+ padding: 10px;
91
+ }
92
+ #template_form h2 {
93
+ font-size: 1em;
94
+ margin: 5px 0;
95
+ padding: 0;
96
+ }
97
+ #template_form label, #template_form legend {
98
+ font-size: .9em;
99
+ }
100
+ #template_form label.disabled {
101
+ color: #999;
102
+ }
103
+ #template_form .select_template {
104
+ margin-bottom: 10px;
105
+ }
106
+ #template_form .select_template legend {
107
+ margin: 5px 0;
108
+ }
109
+ #template_form .buttons {
110
+ margin: 5px auto 0 auto;
111
+ text-align: center;
112
+ }
113
+
114
+ #select_template fieldset {
115
+ margin-left: 1em;
116
+ }
117
+ #select_template fieldset input {
118
+ margin-left: 1em;
119
+ }
120
+
121
+ #preview_code {
122
+ width: 100%;
123
+ height: 4em;
124
+ font-size: .9em;
125
+ }
images/ajax-loader.gif ADDED
Binary file
images/amazon-icon.png ADDED
Binary file
images/amazonjs.png ADDED
Binary file
images/noimage-large.jpg ADDED
Binary file
images/noimage-medium.jpg ADDED
Binary file
images/noimage-small.jpg ADDED
Binary file
js/amazonjs.js ADDED
@@ -0,0 +1,432 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
+ if (!$) return;
3
+ var ua = navigator.userAgent,
4
+ isIE = ua.match(/msie/i),
5
+ isIE6 = isIE && ua.match(/msie 6\./i),
6
+ location = window.location,
7
+ isHttpsScheme = location && location.protocol && location.protocol == 'https:';
8
+ $.extend({
9
+ amazonjs:{
10
+ imageAttributes: ['SmallImage', 'MediumImage', 'LargeImage'],
11
+ isCustomerReviewEnabled: false,
12
+ isTrackEventEnabled: false,
13
+ resource: {},
14
+ initTemplate:function () {
15
+ var r = this.resource;
16
+
17
+ var linkOpenTag = '<a href="${DetailPageURL}" class="amazonjs_link" data-role="amazonjs_product" data-asin="${ASIN}" title="${Title}" target="_blank">';
18
+ var smallImageTemplate =
19
+ [
20
+ '{{if SmallImage}}',
21
+ '{{if $item.setInfoMargin(SmallImage.width+10)}}{{/if}}',
22
+ '<div class="amazonjs_image">',
23
+ linkOpenTag,
24
+ '<img src="${SmallImage.src}" width="${SmallImage.width}" height="${SmallImage.height}" style="max-width:${SmallImage.width}px" alt="${Title}"/>',
25
+ '</a>',
26
+ '</div>',
27
+ '{{/if}}'
28
+ ].join('');
29
+ var mediumImageTemplate =
30
+ [
31
+ '{{if MediumImage}}',
32
+ '{{if $item.setInfoMargin(MediumImage.width+10)}}{{/if}}',
33
+ '<div class="amazonjs_image">',
34
+ linkOpenTag,
35
+ '<img src="${MediumImage.src}" width="${MediumImage.width}" height="${MediumImage.height}" style="max-width:${MediumImage.width}px" alt="${Title}"/>',
36
+ '</a>',
37
+ '</div>',
38
+ '{{/if}}'
39
+ ].join('');
40
+ var largeImageTemplate =
41
+ [
42
+ '{{if LargeImage}}',
43
+ '{{if $item.setInfoMargin(LargeImage.width+10)}}{{/if}}',
44
+ '<div class="amazonjs_image">',
45
+ linkOpenTag,
46
+ '<img src="${LargeImage.src}" width="${LargeImage.width}" height="${LargeImage.height}" style="max-width:${LargeImage.width}px" alt="${Title}"/>',
47
+ '</a>',
48
+ '</div>',
49
+ '{{/if}}'
50
+ ].join('');
51
+ var imageTemplate =
52
+ [
53
+ '{{if _ShowSmallImage}}',smallImageTemplate,'{{/if}}',
54
+ '{{if _ShowMediumImage}}',mediumImageTemplate,'{{/if}}',
55
+ '{{if _ShowLargeImage}}',largeImageTemplate,'{{/if}}'
56
+ ].join('');
57
+
58
+ var linkTemplate = linkOpenTag + '${Title}</a>';
59
+
60
+ var priceContentTemplate =
61
+ [
62
+ '{{if $item.isSale()}}',
63
+ '<b>' + r.ListPrice + '</b><span class="amazonjs_listprice">${ListPrice.FormattedPrice}</span><br/>',
64
+ '{{if OfferSummary.LowestNewPrice}}<b>' + r.Price + '</b>${OfferSummary.LowestNewPrice.FormattedPrice}{{/if}}',
65
+ '<span>' + r.PriceUpdatedat + '</span>',
66
+ '{{else}}',
67
+ '<b>' + r.Price + '</b>${ListPrice.FormattedPrice}',
68
+ '<span>' + r.PriceUpdatedat + '</span>',
69
+ '{{/if}}'
70
+ ].join('');
71
+ var priceTemplate = '{{if ListPrice}}<div class="amazonjs_price" title="' + r.PriceUsage + '">' + priceContentTemplate + '</div>{{/if}}';
72
+ var priceLiTemplate = '{{if ListPrice}}<li class="amazonjs_price" title="' + r.PriceUsage + '">' + priceContentTemplate + '</li>{{/if}}';
73
+ var reviewLinkTemplate = '';
74
+ if (this.isCustomerReviewEnabled) {
75
+ reviewLinkTemplate = '<a href="${IFrameReviewURL}&TB_iframe=true&height=500&width=600" title="' + r.CustomerReviewTitle + '" target="_blank" class="amazonjs_review">' + r.SeeCustomerReviews + '</a>';
76
+ }
77
+
78
+ this.partial = {
79
+ smallImage:smallImageTemplate,
80
+ mediumImage:mediumImageTemplate,
81
+ largeImage:largeImageTemplate,
82
+ link:linkTemplate,
83
+ price:priceTemplate
84
+ };
85
+
86
+ var defaultTemplates = {
87
+ Small:[
88
+ '<div class="amazonjs_item">',
89
+ imageTemplate,
90
+ '{{if _ShowDefaultImage}}',smallImageTemplate,'{{/if}}',
91
+ '<div class="amazonjs_info" style="{{if _InfoMarginLeft}}margin-left:${_InfoMarginLeft}px;{{/if}}">',
92
+ '<h4>',linkTemplate,'</h4>',
93
+ '<ul>',
94
+ '{{if Creator}}<li>${Creator}</li>{{/if}}',
95
+ '{{if Manufacturer}}<li>${Manufacturer}</li>{{/if}}',
96
+ priceLiTemplate,
97
+ '{{if PublicationDate}}<li><b>' + r.PublicationDate + '</b>${PublicationDate}</li>{{/if}}',
98
+ '{{if SalesRank}}<li><b>' + r.SalesRank + '</b>' + r.SalesRankValue + '</li>{{/if}}',
99
+ '</ul>',
100
+ '</div>',
101
+ reviewLinkTemplate,
102
+ '<div class="amazonjs_footer"></div>',
103
+ '</div>'
104
+ ],
105
+ Music:[
106
+ '<div class="amazonjs_item amazonjs_music">',
107
+ imageTemplate,
108
+ '{{if _ShowDefaultImage}}',mediumImageTemplate,'{{/if}}',
109
+ '<div class="amazonjs_info" style="{{if _InfoMarginLeft}}margin-left:${_InfoMarginLeft}px;{{/if}}">',
110
+ '<h4>',linkTemplate,'</h4>',
111
+ '<ul>',
112
+ '{{if Artist}}<li>${Artist}</li>{{/if}}',
113
+ '{{if Creator}}<li>${Creator}</li>{{/if}}',
114
+ '{{if Label}}<li>${Label}</li>{{/if}}',
115
+ priceLiTemplate,
116
+ '{{if ReleaseDate}}<li><b>' + r.ReleaseDate + '</b>${ReleaseDate}</li>{{/if}}',
117
+ '{{if SalesRank}}<li><b>' + r.SalesRank + '</b>' + r.SalesRankValue + '</li>{{/if}}',
118
+ '{{if RunningTime}}<li><b>' + r.RunningTime + '</b>' + r.RunningTimeValue + '</li>{{/if}}',
119
+ '</ul>',
120
+ '</div>',
121
+ reviewLinkTemplate,
122
+ '<div class="amazonjs_footer"></div>',
123
+ '</div>'
124
+ ],
125
+ DVD:[
126
+ '<div class="amazonjs_item amazonjs_dvd">',
127
+ imageTemplate,
128
+ '{{if _ShowDefaultImage}}',mediumImageTemplate,'{{/if}}',
129
+ '<div class="amazonjs_info" style="{{if _InfoMarginLeft}}margin-left:${_InfoMarginLeft}px;{{/if}}">',
130
+ '<h4>',linkTemplate,'</h4>',
131
+ '<ul>',
132
+ '{{if Director}}<li>${Director}</li>{{/if}}',
133
+ '{{if Actor}}<li>${Actor}</li>{{/if}}',
134
+ '{{if Label}}<li>${Label}</li>{{/if}}',
135
+ priceLiTemplate,
136
+ '{{if ReleaseDate}}<li><b>' + r.ReleaseDate + '</b>${ReleaseDate}</li>{{/if}}',
137
+ '{{if SalesRank}}<li><b>' + r.SalesRank + '</b>' + r.SalesRankValue + '</li>{{/if}}',
138
+ '{{if RunningTime}}<li><b>' + r.RunningTime + '</b>' + r.RunningTimeValue + '</li>{{/if}}',
139
+ '</ul>',
140
+ '</div>',
141
+ reviewLinkTemplate,
142
+ '<div class="amazonjs_footer"></div>',
143
+ '</div>'
144
+ ],
145
+ Book:[
146
+ '<div class="amazonjs_item amazonjs_book">',
147
+ imageTemplate,
148
+ '{{if _ShowDefaultImage}}',mediumImageTemplate,'{{/if}}',
149
+ '<div class="amazonjs_info" style="{{if _InfoMarginLeft}}margin-left:${_InfoMarginLeft}px;{{/if}}">',
150
+ '<h4>',linkTemplate,'</h4>',
151
+ '<ul>',
152
+ '{{if Author}}<li><b>' + r.BookAuthor + '</b>${Author}</li>{{/if}}',
153
+ priceLiTemplate,
154
+ '<li><b>' + r.BookPublicationDate + '</b>${PublicationDate}</li>',
155
+ '{{if SalesRank}}<li><b>' + r.SalesRank + '</b>' + r.SalesRankValue + '</li>{{/if}}',
156
+ '<li><b>${Binding}</b>' + r.NumberOfPagesValue + '</li>',
157
+ '<li><b>ISBN-10</b>${ISBN}</li>',
158
+ '<li><b>ISBN-13</b>${EAN}</li>',
159
+ '<li><b>' + r.BookPublisher + '</b>${Publisher}</li>',
160
+ '</ul>',
161
+ '</div>',
162
+ reviewLinkTemplate,
163
+ '<div class="amazonjs_footer"></div>',
164
+ '</div>'
165
+ ],
166
+ eBooks:[
167
+ '<div class="amazonjs_item amazonjs_book">',
168
+ imageTemplate,
169
+ '{{if _ShowDefaultImage}}',mediumImageTemplate,'{{/if}}',
170
+ '<div class="amazonjs_info" style="{{if _InfoMarginLeft}}margin-left:${_InfoMarginLeft}px;{{/if}}">',
171
+ '<h4>',linkTemplate,'</h4>',
172
+ '<ul>',
173
+ '{{if Author}}<li><b>' + r.BookAuthor + '</b>${Author}</li>{{/if}}',
174
+ priceLiTemplate,
175
+ '<li><b>' + r.BookPublicationDate + '</b>${PublicationDate}</li>',
176
+ '{{if SalesRank}}<li><b>' + r.SalesRank + '</b>' + r.SalesRankValue + '</li>{{/if}}',
177
+ '<li><b>${Binding}</b>' + r.NumberOfPagesValue + '</li>',
178
+ '<li><b>' + r.BookPublisher + '</b>${Publisher}</li>',
179
+ '</ul>',
180
+ '</div>',
181
+ reviewLinkTemplate,
182
+ '<div class="amazonjs_footer"></div>',
183
+ '</div>'
184
+ ]
185
+ };
186
+ this.template(defaultTemplates);
187
+ var me = this;
188
+ $.each(this.addTemplateCallbacks, function (i, callback) {
189
+ var t = callback.call(me, me.partial);
190
+ if (t) me.template(t);
191
+ });
192
+ },
193
+ addTemplateCallbacks:[],
194
+ addTemplate:function (fn) {
195
+ if (typeof(fn) == 'function') {
196
+ this.addTemplateCallbacks.push(fn);
197
+ }
198
+ },
199
+ template:function (templates) { // set up jQuery template
200
+ $.each(templates, function (name, tmpl) {
201
+ if (tmpl) {
202
+ $.template('amazonjs' + name + 'Tpl', (typeof tmpl === 'string') ? tmpl : tmpl.join(''));
203
+ }
204
+ });
205
+ },
206
+ render:function (items) {
207
+ var $items = [];
208
+ this.initTemplate();
209
+ $(".amazonjs_item").each(function () {
210
+ var classNames = $(this).attr('class').split(' '),
211
+ c = classNames[0].split('_'),
212
+ asin = c[1],
213
+ countryCode = c[2],
214
+ tmpl = (c.length > 3) ? c[3] : null,
215
+ item = find(asin, countryCode),
216
+ imgSize = $(this).attr('data-img-size')
217
+ ;
218
+
219
+ if (item) {
220
+ item._ImageSize = imgSize || '';
221
+ var $item = $.amazonjs.tmpl(item, $.amazonjs.formatTmplName(tmpl));
222
+ $(this).replaceWith($item.hide());
223
+ var $review = $item.find('.amazonjs_review');
224
+ if (isIE6) {
225
+ $item.css('position', 'static');
226
+ $review.css({
227
+ 'float':'right',
228
+ 'position':'static',
229
+ 'marginRight':'32px'
230
+ });
231
+ }
232
+ $review.click(function () {
233
+ tb_show(this.title, this.href);
234
+ this.blur();
235
+ return false;
236
+ });
237
+ if ($.amazonjs.isTrackEventEnabled) {
238
+ $item.find('.amazonjs_link').click(function() {
239
+ try {
240
+ var data = $(this).data();
241
+ var title = $(this).attr('title');
242
+ if (data.role == 'amazonjs_product') {
243
+ if ($.isFunction(ga)) {
244
+ ga('send', 'event', 'AmazonJS', 'Click', data.asin + ' ' + title);
245
+ } else if (_gaq) {
246
+ _gaq.push(['_trackEvent', 'AmazonJS', 'Click', data.asin + ' ' + title]);
247
+ }
248
+ }
249
+ } catch (e) {
250
+ }
251
+ });
252
+ }
253
+ $items.push($item);
254
+ } else {
255
+ // add official link when amazon product is not fetched by using AWS API
256
+ tmpl = 'Link' + countryCode.toUpperCase();
257
+ item = {
258
+ asins:asin,
259
+ fc1:'000000',
260
+ lc1:'0000FF',
261
+ bc1:'000000',
262
+ bg1:'FFFFFF',
263
+ IS2:1,
264
+ lt1:'_blank',
265
+ f:'ifr',
266
+ m:'amazon'
267
+ };
268
+ var $item = $.amazonjs.tmpl(item, $.amazonjs.formatTmplName(tmpl));
269
+ $(this).replaceWith($item);
270
+ }
271
+ });
272
+
273
+ function find(asin, countryCode) {
274
+ for (var i = 0, length = items.length; i < length; i++) {
275
+ if (items[i].ASIN == asin && items[i].CountryCode == countryCode) {
276
+ return items[i];
277
+ }
278
+ }
279
+ }
280
+ if ($.amazonjs.isFadeInEnabled) {
281
+ function fadeIn() {
282
+ if ($items.length > 0) {
283
+ var $item = $items.shift();
284
+ $item.fadeIn();
285
+ setTimeout(fadeIn, 100);
286
+ }
287
+ }
288
+ fadeIn();
289
+ } else {
290
+ $.each($items, function() {
291
+ this.show();
292
+ });
293
+ }
294
+ },
295
+
296
+ formatTmplName:function (key) {
297
+ return (key) ? 'amazonjs' + key + 'Tpl' : null;
298
+ },
299
+ formatNumber:function (val) {
300
+ val += '';
301
+ var x = val.split('.'),
302
+ x1 = x[0],
303
+ x2 = x.length > 1 ? '.' + x[1] : '',
304
+ rgx = /(\d+)(\d{3})/;
305
+ while (rgx.test(x1)) {
306
+ x1 = x1.replace(rgx, '$1' + ',' + '$2');
307
+ }
308
+ return x1 + x2;
309
+ },
310
+ formatDateTime:function (timestamp) {
311
+ var dt = new Date(timestamp * 1000);
312
+ var Y = dt.getFullYear(),
313
+ m = dt.getMonth() + 1,
314
+ d = dt.getDate(),
315
+ H = dt.getHours(),
316
+ i = dt.getMinutes();
317
+ if (m < 10) m = '0' + m;
318
+ if (d < 10) d = '0' + d;
319
+ if (H < 10) H = '0' + H;
320
+ if (i < 10) i = '0' + i;
321
+ return Y + '/' + m + '/' + d + ' ' + H + ':' + i;
322
+ },
323
+ getTemplate:function (item) {
324
+ var defaultTmpl = this.formatTmplName('Small');
325
+ if (item && item.ProductGroup) {
326
+ var tmpl = this.formatTmplName(item.ProductGroup);
327
+ return $.template[tmpl] || defaultTmpl;
328
+ }
329
+ return defaultTmpl;
330
+ },
331
+ prepareData:function (item) {
332
+
333
+ // workaround: https://forums.aws.amazon.com/thread.jspa?messageID=435131
334
+ if (isHttpsScheme) {
335
+ $.each(this.imageAttributes, function(i, v) {
336
+ var image = item[v];
337
+ if (image && image.src) {
338
+ image.src = image.src.replace('http://ecx.images-amazon.com', 'https://images-eu.ssl-images-amazon.com');
339
+ }
340
+ });
341
+ }
342
+ item._ShowDefaultImage = _ShowSmallImage = item._ShowMediumImage = item._ShowLargeImage = false;
343
+ if (item._ImageSize == 'small') item._ShowSmallImage = true;
344
+ else if (item._ImageSize == 'medium') item._ShowMediumImage = true;
345
+ else if (item._ImageSize == 'large') item._ShowLargeImage = true;
346
+ else item._ShowDefaultImage = true;
347
+ item.PublicationDate = item.PublicationDate || item.ReleaseDate;
348
+ item.Manufacturer = item.Manufacturer || item.Label;
349
+ if (item.SalesRank) item.SalesRank = this.formatNumber(item.SalesRank);
350
+ if (item.PublicationDate) item.PublicationDate = item.PublicationDate.replace(/-/g, '/');
351
+ if (item.ReleaseDate) item.ReleaseDate = item.ReleaseDate.replace(/-/g, '/');
352
+ if (item.Artist && item.Creator) {
353
+ var Creator = [];
354
+ var a = $.isArray(item.Artist) ? item.Artist : [item.Artist];
355
+ var c = $.isArray(item.Creator) ? item.Creator : [item.Creator];
356
+ $.each(c, function (i, value) {
357
+ if ($.inArray(value, a) == -1) Creator.push(value);
358
+ });
359
+ item.Creator = (Creator.length) ? Creator : null;
360
+ }
361
+ item.UpdatedDate = this.formatDateTime(item.UpdatedAt);
362
+ return item;
363
+ },
364
+ tmpl:function (item, tmpl) {
365
+ item = this.prepareData(item);
366
+ // overwrite ListPrice
367
+ if (!item.ListPrice && item.OfferSummary) {
368
+ item.ListPrice = item.OfferSummary.LowestNewPrice;
369
+ }
370
+ return $.tmpl($.template[tmpl] || this.getTemplate(item), item, {
371
+ isSale:function () {
372
+ if (this.data) {
373
+ var lp = this.data.ListPrice, la = Number(lp.Amount),
374
+ os = this.data.OfferSummary || {}, sp = os.LowestNewPrice || {}, sa = Number(sp.Amount);
375
+ return (!isNaN(sa) && sa < la);
376
+ }
377
+ return false;
378
+ },
379
+ setInfoMargin: function(margin) {
380
+ return this.data._InfoMarginLeft = margin;
381
+ }
382
+ });
383
+ },
384
+ execute: function() {
385
+ var amazonjsVars = window.amazonjsVars;
386
+ if (amazonjsVars) {
387
+ function render() {
388
+ if (!amazonjsVars.items) {
389
+ return;
390
+ }
391
+ if ($.amazonjs.isExecuted) {
392
+ return;
393
+ }
394
+ if (amazonjsVars.isCustomerReviewEnabled) {
395
+ if (typeof tb_pathToImage === 'undefined') {
396
+ tb_pathToImage = amazonjsVars.thickboxUrl + '/loadingAnimation.gif';
397
+ }
398
+ if (typeof tb_closeImage === 'undefined') {
399
+ tb_closeImage = amazonjsVars.thickboxUrl + '/tb-close.png';
400
+ }
401
+ }
402
+ $.amazonjs.isFadeInEnabled = amazonjsVars.isFadeInEnabled;
403
+ $.amazonjs.isCustomerReviewEnabled = amazonjsVars.isCustomerReviewEnabled;
404
+ $.amazonjs.isTrackEventEnabled = amazonjsVars.isTrackEventEnabled;
405
+ $.amazonjs.resource = amazonjsVars.resource;
406
+ $.amazonjs.template(amazonjsVars.regionTemplate);
407
+ $.amazonjs.render(amazonjsVars.items);
408
+ $.amazonjs.isExecuted = true;
409
+ }
410
+ if (amazonjsVars.isFadeInEnabled) {
411
+ setTimeout(function () {
412
+ render();
413
+ }, 1000);
414
+ } else {
415
+ render();
416
+ }
417
+ }
418
+ }
419
+ }
420
+ });
421
+ $(document).ready(function(){
422
+ $.amazonjs.execute();
423
+ });
424
+ $(window).load(function() {
425
+ $.amazonjs.execute();
426
+ });
427
+ if (document.addEventListener) {
428
+ document.addEventListener('DOMContentLoaded', function () {
429
+ $.amazonjs.execute();
430
+ });
431
+ }
432
+ })(jQuery);
languages/amazonjs-ja.mo ADDED
Binary file
languages/amazonjs-ja.po ADDED
@@ -0,0 +1,657 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2014 makoto_kw
2
+ # This file is distributed under the GPLv2.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: PACKAGE VERSION\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/amazonjs\n"
7
+ "POT-Creation-Date: 2014-08-27 07:43:33+00:00\n"
8
+ "PO-Revision-Date: 2010-11-08 00:37+0900\n"
9
+ "Last-Translator: makoto_kw <makoto.kw+wordpress@gmail.com>\n"
10
+ "Language-Team: Japanese\n"
11
+ "Language: \n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: grunt-wp-i18n 0.4.7\n"
16
+
17
+ #: amazonjs-aws-params.php:17
18
+ msgid "All"
19
+ msgstr "全商品"
20
+
21
+ #: amazonjs-aws-params.php:29
22
+ msgid "Apparel"
23
+ msgstr "アパレル"
24
+
25
+ #: amazonjs-aws-params.php:41
26
+ msgid "Appliances"
27
+ msgstr "家電"
28
+
29
+ #: amazonjs-aws-params.php:53
30
+ msgid "ArtsAndCrafts"
31
+ msgstr "美術と工芸"
32
+
33
+ #: amazonjs-aws-params.php:65
34
+ msgid "Automotive"
35
+ msgstr "カー・バイク用品"
36
+
37
+ #: amazonjs-aws-params.php:77
38
+ msgid "Baby"
39
+ msgstr "ベビー・マタニティ"
40
+
41
+ #: amazonjs-aws-params.php:89
42
+ msgid "Beauty"
43
+ msgstr "コスメ"
44
+
45
+ #: amazonjs-aws-params.php:101
46
+ msgid "Blended"
47
+ msgstr "ブレンド"
48
+
49
+ #: amazonjs-aws-params.php:113
50
+ msgid "Books"
51
+ msgstr "本"
52
+
53
+ #: amazonjs-aws-params.php:125
54
+ msgid "Classical"
55
+ msgstr "クラシックミュージック"
56
+
57
+ #: amazonjs-aws-params.php:137
58
+ msgid "DigitalMusic"
59
+ msgstr "デジタルミュージック"
60
+
61
+ #: amazonjs-aws-params.php:149
62
+ msgid "DVD"
63
+ msgstr "DVD"
64
+
65
+ #: amazonjs-aws-params.php:161
66
+ msgid "Electronics"
67
+ msgstr "家電・カメラ"
68
+
69
+ #: amazonjs-aws-params.php:173
70
+ msgid "ForeignBooks"
71
+ msgstr "洋書"
72
+
73
+ #: amazonjs-aws-params.php:185
74
+ msgid "Garden"
75
+ msgstr "ガーデン"
76
+
77
+ #: amazonjs-aws-params.php:197
78
+ msgid "GourmetFood"
79
+ msgstr "グルメ"
80
+
81
+ #: amazonjs-aws-params.php:209
82
+ msgid "Grocery"
83
+ msgstr "食品・飲料"
84
+
85
+ #: amazonjs-aws-params.php:221
86
+ msgid "HealthPersonalCare"
87
+ msgstr "ヘルス・ビューティー"
88
+
89
+ #: amazonjs-aws-params.php:233
90
+ msgid "Hobbies"
91
+ msgstr "ホビー"
92
+
93
+ #: amazonjs-aws-params.php:245
94
+ msgid "Home"
95
+ msgstr "ホーム"
96
+
97
+ #: amazonjs-aws-params.php:257
98
+ msgid "HomeGarden"
99
+ msgstr "ホーム・ガーデン"
100
+
101
+ #: amazonjs-aws-params.php:269
102
+ msgid "HomeImprovement"
103
+ msgstr "ホームインプルーブメント"
104
+
105
+ #: amazonjs-aws-params.php:281
106
+ msgid "Industrial"
107
+ msgstr "工業製品"
108
+
109
+ #: amazonjs-aws-params.php:293
110
+ msgid "Jewelry"
111
+ msgstr "ジュエリー"
112
+
113
+ #: amazonjs-aws-params.php:305
114
+ msgid "KindleStore"
115
+ msgstr "Kindleストア"
116
+
117
+ #: amazonjs-aws-params.php:317
118
+ msgid "Kitchen"
119
+ msgstr "キッチン"
120
+
121
+ #: amazonjs-aws-params.php:329
122
+ msgid "LawnAndGarden"
123
+ msgstr "ガーデニング"
124
+
125
+ #: amazonjs-aws-params.php:341
126
+ msgid "Lighting"
127
+ msgstr "照明"
128
+
129
+ #: amazonjs-aws-params.php:353
130
+ msgid "Magazines"
131
+ msgstr "雑誌"
132
+
133
+ #: amazonjs-aws-params.php:365
134
+ msgid "Marketplace"
135
+ msgstr "マーケットプレイス"
136
+
137
+ #: amazonjs-aws-params.php:377
138
+ msgid "Miscellaneous"
139
+ msgstr "雑多"
140
+
141
+ #: amazonjs-aws-params.php:389
142
+ msgid "MobileApps"
143
+ msgstr "モバイルアプリ"
144
+
145
+ #: amazonjs-aws-params.php:401
146
+ msgid "MP3Downloads"
147
+ msgstr "MP3ダウンロード"
148
+
149
+ #: amazonjs-aws-params.php:413
150
+ msgid "Music"
151
+ msgstr "ミュージック"
152
+
153
+ #: amazonjs-aws-params.php:425
154
+ msgid "MusicalInstruments"
155
+ msgstr "楽器"
156
+
157
+ #: amazonjs-aws-params.php:437
158
+ msgid "MusicTracks"
159
+ msgstr "曲"
160
+
161
+ #: amazonjs-aws-params.php:449
162
+ msgid "OfficeProducts"
163
+ msgstr "文房具・オフィス用品"
164
+
165
+ #: amazonjs-aws-params.php:461
166
+ msgid "OutdoorLiving"
167
+ msgstr "アウトドア"
168
+
169
+ #: amazonjs-aws-params.php:473
170
+ msgid "Outlet"
171
+ msgstr "アウトレット"
172
+
173
+ #: amazonjs-aws-params.php:485
174
+ msgid "PCHardware"
175
+ msgstr "パソコン・周辺機器"
176
+
177
+ #: amazonjs-aws-params.php:497
178
+ msgid "PetSupplies"
179
+ msgstr "ペット用品"
180
+
181
+ #: amazonjs-aws-params.php:509
182
+ msgid "Photo"
183
+ msgstr "写真"
184
+
185
+ #: amazonjs-aws-params.php:521
186
+ msgid "Shoes"
187
+ msgstr "シューズ&バッグ"
188
+
189
+ #: amazonjs-aws-params.php:533
190
+ msgid "Software"
191
+ msgstr "PCソフト"
192
+
193
+ #: amazonjs-aws-params.php:545
194
+ msgid "SoftwareVideoGames"
195
+ msgstr "TVゲーム"
196
+
197
+ #: amazonjs-aws-params.php:557
198
+ msgid "SportingGoods"
199
+ msgstr "スポーツ"
200
+
201
+ #: amazonjs-aws-params.php:569
202
+ msgid "Tools"
203
+ msgstr "道具"
204
+
205
+ #: amazonjs-aws-params.php:581
206
+ msgid "Toys"
207
+ msgstr "おもちゃ"
208
+
209
+ #: amazonjs-aws-params.php:593
210
+ msgid "UnboxVideo"
211
+ msgstr "デジタルビデオ"
212
+
213
+ #: amazonjs-aws-params.php:605
214
+ msgid "VHS"
215
+ msgstr "VHSビデオ"
216
+
217
+ #: amazonjs-aws-params.php:617
218
+ msgid "Video"
219
+ msgstr "ビデオ"
220
+
221
+ #: amazonjs-aws-params.php:629
222
+ msgid "VideoGames"
223
+ msgstr "TVゲーム"
224
+
225
+ #: amazonjs-aws-params.php:641
226
+ msgid "Watches"
227
+ msgstr "時計"
228
+
229
+ #: amazonjs-aws-params.php:653
230
+ msgid "Wireless"
231
+ msgstr "無線"
232
+
233
+ #: amazonjs-aws-params.php:665
234
+ msgid "WirelessAccessories"
235
+ msgstr "無線アクセサリー"
236
+
237
+ #: amazonjs.php:66
238
+ msgid "United States"
239
+ msgstr "アメリカ"
240
+
241
+ #: amazonjs.php:73
242
+ msgid "United Kingdom"
243
+ msgstr "イギリス"
244
+
245
+ #: amazonjs.php:80
246
+ msgid "Deutschland"
247
+ msgstr "ドイツ"
248
+
249
+ #: amazonjs.php:87
250
+ msgid "France"
251
+ msgstr "フランス"
252
+
253
+ #: amazonjs.php:94
254
+ msgid "Japan"
255
+ msgstr "日本"
256
+
257
+ #: amazonjs.php:101
258
+ msgid "Canada"
259
+ msgstr "カナダ"
260
+
261
+ #: amazonjs.php:108
262
+ msgid "China"
263
+ msgstr "中国"
264
+
265
+ #: amazonjs.php:115
266
+ msgid "Italia"
267
+ msgstr "イタリア"
268
+
269
+ #: amazonjs.php:122
270
+ msgid "España"
271
+ msgstr "スペイン"
272
+
273
+ #: amazonjs.php:264
274
+ msgid "Author"
275
+ msgstr "著者"
276
+
277
+ #: amazonjs.php:265
278
+ msgid "PublicationDate"
279
+ msgstr "出版日"
280
+
281
+ #: amazonjs.php:266
282
+ msgid "Publisher"
283
+ msgstr "出版社"
284
+
285
+ #: amazonjs.php:267
286
+ msgid "${NumberOfPages} pages"
287
+ msgstr "${NumberOfPages}ページ"
288
+
289
+ #: amazonjs.php:268
290
+ msgid "List Price"
291
+ msgstr "参考価格"
292
+
293
+ #: amazonjs.php:269
294
+ msgid "Price"
295
+ msgstr "価格"
296
+
297
+ #: amazonjs.php:270
298
+ msgid ""
299
+ "Product prices and availability are accurate as of the date/time indicated "
300
+ "and are subject to change. Any price and availability information displayed "
301
+ "on [amazon.com or endless.com, as applicable] at the time of purchase will "
302
+ "apply to the purchase of this product."
303
+ msgstr ""
304
+ "価格および発送可能時期は表示された日付/時刻の時点のものであり、変更される場合"
305
+ "があります。商品の販売においては、購入の時点で [Amazon.co.jp または Javari."
306
+ "jp] に表示されている価格および発送可能時期の情報が適用されます。"
307
+
308
+ #: amazonjs.php:271
309
+ msgid "Publication Date"
310
+ msgstr "発売日"
311
+
312
+ #: amazonjs.php:272
313
+ msgid "Release Date"
314
+ msgstr "リリース日"
315
+
316
+ #: amazonjs.php:273
317
+ msgid "SalesRank"
318
+ msgstr "商品ランキング"
319
+
320
+ #: amazonjs.php:274
321
+ msgid "#${SalesRank}"
322
+ msgstr "${SalesRank}位"
323
+
324
+ #: amazonjs.php:275
325
+ msgid "Run Time"
326
+ msgstr "時間"
327
+
328
+ #: amazonjs.php:276
329
+ msgid "${RunningTime} minutes"
330
+ msgstr "${RunningTime}分"
331
+
332
+ #: amazonjs.php:277
333
+ msgid "${Title} Customer Review"
334
+ msgstr "${Title} カスタマーレビュー"
335
+
336
+ #: amazonjs.php:278
337
+ msgid "See Customer Reviews"
338
+ msgstr "カスタマーレビューを見る"
339
+
340
+ #: amazonjs.php:279
341
+ msgid "(at ${UpdatedDate})"
342
+ msgstr "(${UpdatedDate}時点)"
343
+
344
+ #: amazonjs.php:299
345
+ msgid "Product Advertising API settings"
346
+ msgstr "Product Advertising APIの設定"
347
+
348
+ #: amazonjs.php:302
349
+ msgid "Amazon Associates settings"
350
+ msgstr "アソシエイトタグの設定"
351
+
352
+ #: amazonjs.php:305
353
+ msgid "Appearance settings"
354
+ msgstr "表示設定"
355
+
356
+ #: amazonjs.php:308
357
+ msgid "Analytics settings"
358
+ msgstr "アナリティクス設定"
359
+
360
+ #: amazonjs.php:311
361
+ msgid "Customize"
362
+ msgstr "カスタマイズ"
363
+
364
+ #: amazonjs.php:318
365
+ msgid "Access Key ID"
366
+ msgstr "アクセスキーID"
367
+
368
+ #: amazonjs.php:324
369
+ msgid "Secret Access Key"
370
+ msgstr "シークレットアクセスキー"
371
+
372
+ #: amazonjs.php:330
373
+ msgid "Display customer review"
374
+ msgstr "カスタマーレビューを表示する"
375
+
376
+ #: amazonjs.php:333
377
+ msgid "AmazonJS will display customer review by using WordPress's Thickbox."
378
+ msgstr "WordPressのThickboxを利用してカスタマーレビューを表示します"
379
+
380
+ #: amazonjs.php:336
381
+ msgid "Display official widget when disabled javascript in web browser"
382
+ msgstr "ブラウザのJavascriptが無効の時にオフィシャルウィジェットを表示する"
383
+
384
+ #: amazonjs.php:339
385
+ msgid ""
386
+ "If set to true, AmazonJS will output html by using <code>&lt;script "
387
+ "type=&quot;text/javascript&quot;&gt;document.write(&quot;{$indicator_html}"
388
+ "&quot;)&lt;/script&gt;&lt;noscript&gt;{$link_html}&lt;/noscript&gt;</code>."
389
+ msgstr ""
390
+ "設定が有効の場合、<code>&lt;script type=&quot;text/javascript&quot;&gt;"
391
+ "document.write(&quot;{$indicator_html}&quot;)&lt;/script&gt;&lt;noscript&gt;"
392
+ "{$link_html}&lt;/noscript&gt;</code>を出力します"
393
+
394
+ #: amazonjs.php:342
395
+ msgid "Use fadeIn animation"
396
+ msgstr "フェードインアニメーションを使用する"
397
+
398
+ #: amazonjs.php:347
399
+ msgid "Override style of theme"
400
+ msgstr "テーマのスタイルを上書きする"
401
+
402
+ #: amazonjs.php:350
403
+ msgid ""
404
+ "If set to true, AmazonJS will override the style of the theme by using "
405
+ "<code>!important</code> declaration."
406
+ msgstr ""
407
+ "設定が有効の場合、<code>!important</code>を使ってテーマのスタイルを上書きしま"
408
+ "す"
409
+
410
+ #: amazonjs.php:353
411
+ msgid "Click Tracking by using Google Analytics"
412
+ msgstr "Google Analyticsで商品リンクのクリックをトラッキングする"
413
+
414
+ #: amazonjs.php:356
415
+ msgid ""
416
+ "If set to true, AmazonJS will call <code>_gaq.push([\"_trackEvent\", "
417
+ "\"AmazonJS\", \"Click\", \"ASIN TITLE\"])</code> or <code>ga(\"send\", "
418
+ "\"event\", \"AmazonJS\", \"Click\", \"ASIN TITLE\")</code>."
419
+ msgstr ""
420
+ "設定が有効の場合、<code>_gaq.push([\"_trackEvent\", \"AmazonJS\", \"Click\", "
421
+ "\"ASIN TITLE\"])</code> または <code>ga(\"send\", \"event\", \"AmazonJS\", "
422
+ "\"Click\", \"ASIN TITLE\")</code>を呼び出します"
423
+
424
+ #: amazonjs.php:359
425
+ msgid "Use Custom Css"
426
+ msgstr "カスタムCSSを使用する"
427
+
428
+ #: amazonjs.php:365
429
+ msgid "Use Custom Javascript"
430
+ msgstr "カスタムスクリプトを使用する"
431
+
432
+ #: amazonjs.php:576
433
+ msgid "Settings"
434
+ msgstr "設定"
435
+
436
+ #: amazonjs.php:580
437
+ msgid "Old Releases"
438
+ msgstr "過去のバージョン"
439
+
440
+ #: amazonjs.php:588
441
+ msgid ""
442
+ "This plugin uses the Amazon Product Advertising API in order to get product "
443
+ "infomation. Thus, you must use your Access Key ID &amp; Secret Access Key."
444
+ msgstr ""
445
+ "このプラグインはAmazon Product Advertising APIを必須としています。Product "
446
+ "Advertising APIを使うにはあなたのアクセスキーIDと秘密アクセスキーを使わなけれ"
447
+ "ばいけません。"
448
+
449
+ #: amazonjs.php:589
450
+ msgid ""
451
+ "You can sign up the Amazon Product Advertising API from <a href=\"https://"
452
+ "affiliate-program.amazon.com/gp/advertising/api/detail/main.html\" target="
453
+ "\"_blank\">here</a>. Please review the <a href=\"http://affiliate-program."
454
+ "amazon.com/gp/advertising/api/detail/agreement.html\" target=\"_blank"
455
+ "\">Product Advertising API License Agreement</a> for details."
456
+ msgstr ""
457
+ "Amazon Product Advertising APIアカウントの作成は <a href=\"https://affiliate."
458
+ "amazon.co.jp/gp/advertising/api/detail/main.html\" target=\"_blank\">ここ</a>"
459
+ "から作成することができます。 APIのご利用にあたっては <a href=\"http://"
460
+ "affiliate.amazon.co.jp/gp/advertising/api/detail/agreement.html\" target="
461
+ "\"_blank\">Product Advertising API ライセンス契約</a> をよくお読みください。"
462
+
463
+ #: amazonjs.php:595
464
+ msgid ""
465
+ "Amazon has an affiliate program called Amazon Associates. To apply for the "
466
+ "Associates Program, visit the <a href=\"https://affiliate-program.amazon.com/"
467
+ "\" target=\"_blank\">Amazon Associates website</a> for details."
468
+ msgstr ""
469
+ "AmazonにはAmazonアソシエイトと呼ばれるアフィリエイトプログラムがあります。 ア"
470
+ "フィリエイトプログラムの詳細は<a href=\"https://affiliate.amazon.co.jp/\" "
471
+ "target=\"_blank\">Amazon アソシエイトウェブサイト</a>を参照してください。"
472
+
473
+ #: amazonjs.php:596
474
+ msgid ""
475
+ "Associate Tag has been a <strong>required and verified</strong> input "
476
+ "parameter in all requests to the Amazon Product Advertising API since "
477
+ "11/1/2011."
478
+ msgstr ""
479
+ "2011年11月1日よりアソシエイトタグはAmazon Product Advertising APIへの全てのリ"
480
+ "クエストにおいて<strong>必須かつ検証される</strong>パラメータになりました。"
481
+
482
+ #: amazonjs.php:669
483
+ msgid "Add Amazon Link"
484
+ msgstr "Amazonリンクを追加"
485
+
486
+ #: amazonjs.php:701
487
+ msgid "Keyword Search"
488
+ msgstr "キーワード検索"
489
+
490
+ #: amazonjs.php:702
491
+ msgid "Search by ASIN/URL"
492
+ msgstr "ASIN/URLで検索"
493
+
494
+ #: amazonjs.php:725
495
+ msgid ""
496
+ "Error! \"simplexml_load_string\" function is not found. %s requires PHP 5 "
497
+ "and SimpleXML extension."
498
+ msgstr ""
499
+ "エラー! \"simplexml_load_string\" 関数が見つかりません。%s を使うにはPHP5以上"
500
+ "でSimpleXML拡張が必要です"
501
+
502
+ #: amazonjs.php:730
503
+ msgid ""
504
+ "Warning! Cache directory is not exist. Please create writable directory: <br/"
505
+ "><code>%s</code>"
506
+ msgstr ""
507
+ "警告! キャッシュディレクトリが存在しません<br/>書き込み可能なディレクトリを "
508
+ "<code>%s</code> に作成してください"
509
+
510
+ #: amazonjs.php:734
511
+ msgid ""
512
+ "Warning! Cache Directory \"%s\" is not writable, set permission as 0777."
513
+ msgstr ""
514
+ "警告! キャッシュディレクトリ \"%s\" に書き込み権限がありません。パーミッショ"
515
+ "ンを0777に設定してください"
516
+
517
+ #: amazonjs.php:800
518
+ msgid "Invalid Request Parameters"
519
+ msgstr "リクエストが不正です"
520
+
521
+ #: amazonjs.php:835
522
+ msgid "Network Error: %s"
523
+ msgstr "ネットワークエラー: %s"
524
+
525
+ #: amazonjs.php:841
526
+ msgid "Empty Response from %s"
527
+ msgstr "%sからのレスポンスが空です"
528
+
529
+ #: amazonjs.php:899 amazonjs.php:903
530
+ msgid "Amazon Product Advertising API Error"
531
+ msgstr "Amazon Product Advertising APIのエラー"
532
+
533
+ #: amazonjs.php:907
534
+ msgid "Cannot Parse Amazon Product Advertising API Response"
535
+ msgstr "Amazon Product Advertising APIからのレスポンスをパースできません"
536
+
537
+ #: amazonjs.php:912
538
+ msgid "Invalid Response"
539
+ msgstr "レスポンスが不正です"
540
+
541
+ #: media-upload-type-amazonjs.php:23
542
+ msgid ""
543
+ "The Access Key ID or Secret Access Key is empty. Please specify it in <a "
544
+ "href=\"%s\" target=\"_blank\">settings</a>."
545
+ msgstr ""
546
+ "アクセスキーIDかシークレットアクセスキーが設定されていません。<a href=\"%s\" "
547
+ "target=\"_blank\">設定画面</a>から設定してください。"
548
+
549
+ #: media-upload-type-amazonjs.php:28
550
+ msgid "Warning! Cache Directory \"%s\" is not writable"
551
+ msgstr "警告! キャッシュディレクトリ \"%s\" に書き込み権限がありません"
552
+
553
+ #: media-upload-type-amazonjs.php:41
554
+ msgid "Input Keyword"
555
+ msgstr "キーワードを入力"
556
+
557
+ #: media-upload-type-amazonjs.php:47
558
+ msgid "Input ASIN or URL"
559
+ msgstr "ASINかURLを入力"
560
+
561
+ #: media-upload-type-amazonjs.php:49
562
+ msgid "Search"
563
+ msgstr "検索"
564
+
565
+ #: media-upload-type-amazonjs.php:58
566
+ msgid "Select template"
567
+ msgstr "テンプレートの選択"
568
+
569
+ #: media-upload-type-amazonjs.php:62
570
+ msgid "Simple Html"
571
+ msgstr "単純なHtml"
572
+
573
+ #: media-upload-type-amazonjs.php:64
574
+ msgid "Title"
575
+ msgstr "タイトル"
576
+
577
+ #: media-upload-type-amazonjs.php:66
578
+ msgid "Small Image"
579
+ msgstr "画像(小)"
580
+
581
+ #: media-upload-type-amazonjs.php:68
582
+ msgid "Medium Image"
583
+ msgstr "画像(中)"
584
+
585
+ #: media-upload-type-amazonjs.php:70
586
+ msgid "Large Image"
587
+ msgstr "画像(大)"
588
+
589
+ #: media-upload-type-amazonjs.php:73
590
+ msgid "Dynamic Template"
591
+ msgstr "動的なテンプレート"
592
+
593
+ #: media-upload-type-amazonjs.php:75
594
+ msgid "Default"
595
+ msgstr "デフォルト"
596
+
597
+ #: media-upload-type-amazonjs.php:77
598
+ msgid "Small"
599
+ msgstr "少ない情報"
600
+
601
+ #: media-upload-type-amazonjs.php:80
602
+ msgid "Preview"
603
+ msgstr "プレビュー"
604
+
605
+ #: media-upload-type-amazonjs.php:86
606
+ msgid "Cancel"
607
+ msgstr "キャンセル"
608
+
609
+ #: media-upload-type-amazonjs.php:87
610
+ msgid "Insert"
611
+ msgstr "挿入"
612
+
613
+ #: media-upload-type-amazonjs.php:145
614
+ msgid ""
615
+ "<h3 class=\"searchindex\"><a href=\"#\" rel=\"${IndexName}\">${Label}</a> "
616
+ "(${Results} hits)</h3>"
617
+ msgstr ""
618
+ "<h3 class=\"searchindex\"><a href=\"#\" rel=\"${IndexName}\">${Label}</a> "
619
+ "(${Results} 件)</h3>"
620
+
621
+ #: media-upload-type-amazonjs.php:146
622
+ msgid ""
623
+ "<div class=\"searchpager\">{{if prev}}<button class=\"button prev\">Prev</"
624
+ "button>{{/if}}${startIndex} - ${endIndex} / ${totalResults}{{if next}}"
625
+ "<button class=\"button next\">Next</button>{{/if}}</div>"
626
+ msgstr ""
627
+ "<div class=\"searchpager\">{{if prev}}<button class=\"button prev\">前</"
628
+ "button>{{/if}}${startIndex} - ${endIndex} / ${totalResults}{{if next}}"
629
+ "<button class=\"button next\">次</button>{{/if}}</div>"
630
+
631
+ #: media-upload-type-amazonjs.php:162
632
+ msgid "Select"
633
+ msgstr "選択"
634
+
635
+ #. Plugin Name of the plugin/theme
636
+ msgid "AmazonJS"
637
+ msgstr ""
638
+
639
+ #. Plugin URI of the plugin/theme
640
+ msgid "http://wordpress.org/extend/plugins/amazonjs/"
641
+ msgstr ""
642
+
643
+ #. Description of the plugin/theme
644
+ msgid ""
645
+ "Easy to use interface to add an amazon product to your post and display it "
646
+ "by using jQuery template."
647
+ msgstr ""
648
+ "Amazonの商品情報をブログに簡単に追加し、jQueryテンプレートを使って表示を行い"
649
+ "ます。"
650
+
651
+ #. Author of the plugin/theme
652
+ msgid "makoto_kw"
653
+ msgstr ""
654
+
655
+ #. Author URI of the plugin/theme
656
+ msgid "http://makotokw.com"
657
+ msgstr ""
languages/amazonjs.pot ADDED
@@ -0,0 +1,619 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2014 makoto_kw
2
+ # This file is distributed under the GPLv2.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: AmazonJS 0.7.3\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/amazonjs\n"
7
+ "POT-Creation-Date: 2014-08-27 07:43:33+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=utf-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "X-Generator: grunt-wp-i18n 0.4.7\n"
15
+
16
+ #: amazonjs-aws-params.php:17
17
+ msgid "All"
18
+ msgstr ""
19
+
20
+ #: amazonjs-aws-params.php:29
21
+ msgid "Apparel"
22
+ msgstr ""
23
+
24
+ #: amazonjs-aws-params.php:41
25
+ msgid "Appliances"
26
+ msgstr ""
27
+
28
+ #: amazonjs-aws-params.php:53
29
+ msgid "ArtsAndCrafts"
30
+ msgstr ""
31
+
32
+ #: amazonjs-aws-params.php:65
33
+ msgid "Automotive"
34
+ msgstr ""
35
+
36
+ #: amazonjs-aws-params.php:77
37
+ msgid "Baby"
38
+ msgstr ""
39
+
40
+ #: amazonjs-aws-params.php:89
41
+ msgid "Beauty"
42
+ msgstr ""
43
+
44
+ #: amazonjs-aws-params.php:101
45
+ msgid "Blended"
46
+ msgstr ""
47
+
48
+ #: amazonjs-aws-params.php:113
49
+ msgid "Books"
50
+ msgstr ""
51
+
52
+ #: amazonjs-aws-params.php:125
53
+ msgid "Classical"
54
+ msgstr ""
55
+
56
+ #: amazonjs-aws-params.php:137
57
+ msgid "DigitalMusic"
58
+ msgstr ""
59
+
60
+ #: amazonjs-aws-params.php:149
61
+ msgid "DVD"
62
+ msgstr ""
63
+
64
+ #: amazonjs-aws-params.php:161
65
+ msgid "Electronics"
66
+ msgstr ""
67
+
68
+ #: amazonjs-aws-params.php:173
69
+ msgid "ForeignBooks"
70
+ msgstr ""
71
+
72
+ #: amazonjs-aws-params.php:185
73
+ msgid "Garden"
74
+ msgstr ""
75
+
76
+ #: amazonjs-aws-params.php:197
77
+ msgid "GourmetFood"
78
+ msgstr ""
79
+
80
+ #: amazonjs-aws-params.php:209
81
+ msgid "Grocery"
82
+ msgstr ""
83
+
84
+ #: amazonjs-aws-params.php:221
85
+ msgid "HealthPersonalCare"
86
+ msgstr ""
87
+
88
+ #: amazonjs-aws-params.php:233
89
+ msgid "Hobbies"
90
+ msgstr ""
91
+
92
+ #: amazonjs-aws-params.php:245
93
+ msgid "Home"
94
+ msgstr ""
95
+
96
+ #: amazonjs-aws-params.php:257
97
+ msgid "HomeGarden"
98
+ msgstr ""
99
+
100
+ #: amazonjs-aws-params.php:269
101
+ msgid "HomeImprovement"
102
+ msgstr ""
103
+
104
+ #: amazonjs-aws-params.php:281
105
+ msgid "Industrial"
106
+ msgstr ""
107
+
108
+ #: amazonjs-aws-params.php:293
109
+ msgid "Jewelry"
110
+ msgstr ""
111
+
112
+ #: amazonjs-aws-params.php:305
113
+ msgid "KindleStore"
114
+ msgstr ""
115
+
116
+ #: amazonjs-aws-params.php:317
117
+ msgid "Kitchen"
118
+ msgstr ""
119
+
120
+ #: amazonjs-aws-params.php:329
121
+ msgid "LawnAndGarden"
122
+ msgstr ""
123
+
124
+ #: amazonjs-aws-params.php:341
125
+ msgid "Lighting"
126
+ msgstr ""
127
+
128
+ #: amazonjs-aws-params.php:353
129
+ msgid "Magazines"
130
+ msgstr ""
131
+
132
+ #: amazonjs-aws-params.php:365
133
+ msgid "Marketplace"
134
+ msgstr ""
135
+
136
+ #: amazonjs-aws-params.php:377
137
+ msgid "Miscellaneous"
138
+ msgstr ""
139
+
140
+ #: amazonjs-aws-params.php:389
141
+ msgid "MobileApps"
142
+ msgstr ""
143
+
144
+ #: amazonjs-aws-params.php:401
145
+ msgid "MP3Downloads"
146
+ msgstr ""
147
+
148
+ #: amazonjs-aws-params.php:413
149
+ msgid "Music"
150
+ msgstr ""
151
+
152
+ #: amazonjs-aws-params.php:425
153
+ msgid "MusicalInstruments"
154
+ msgstr ""
155
+
156
+ #: amazonjs-aws-params.php:437
157
+ msgid "MusicTracks"
158
+ msgstr ""
159
+
160
+ #: amazonjs-aws-params.php:449
161
+ msgid "OfficeProducts"
162
+ msgstr ""
163
+
164
+ #: amazonjs-aws-params.php:461
165
+ msgid "OutdoorLiving"
166
+ msgstr ""
167
+
168
+ #: amazonjs-aws-params.php:473
169
+ msgid "Outlet"
170
+ msgstr ""
171
+
172
+ #: amazonjs-aws-params.php:485
173
+ msgid "PCHardware"
174
+ msgstr ""
175
+
176
+ #: amazonjs-aws-params.php:497
177
+ msgid "PetSupplies"
178
+ msgstr ""
179
+
180
+ #: amazonjs-aws-params.php:509
181
+ msgid "Photo"
182
+ msgstr ""
183
+
184
+ #: amazonjs-aws-params.php:521
185
+ msgid "Shoes"
186
+ msgstr ""
187
+
188
+ #: amazonjs-aws-params.php:533
189
+ msgid "Software"
190
+ msgstr ""
191
+
192
+ #: amazonjs-aws-params.php:545
193
+ msgid "SoftwareVideoGames"
194
+ msgstr ""
195
+
196
+ #: amazonjs-aws-params.php:557
197
+ msgid "SportingGoods"
198
+ msgstr ""
199
+
200
+ #: amazonjs-aws-params.php:569
201
+ msgid "Tools"
202
+ msgstr ""
203
+
204
+ #: amazonjs-aws-params.php:581
205
+ msgid "Toys"
206
+ msgstr ""
207
+
208
+ #: amazonjs-aws-params.php:593
209
+ msgid "UnboxVideo"
210
+ msgstr ""
211
+
212
+ #: amazonjs-aws-params.php:605
213
+ msgid "VHS"
214
+ msgstr ""
215
+
216
+ #: amazonjs-aws-params.php:617
217
+ msgid "Video"
218
+ msgstr ""
219
+
220
+ #: amazonjs-aws-params.php:629
221
+ msgid "VideoGames"
222
+ msgstr ""
223
+
224
+ #: amazonjs-aws-params.php:641
225
+ msgid "Watches"
226
+ msgstr ""
227
+
228
+ #: amazonjs-aws-params.php:653
229
+ msgid "Wireless"
230
+ msgstr ""
231
+
232
+ #: amazonjs-aws-params.php:665
233
+ msgid "WirelessAccessories"
234
+ msgstr ""
235
+
236
+ #: amazonjs.php:66
237
+ msgid "United States"
238
+ msgstr ""
239
+
240
+ #: amazonjs.php:73
241
+ msgid "United Kingdom"
242
+ msgstr ""
243
+
244
+ #: amazonjs.php:80
245
+ msgid "Deutschland"
246
+ msgstr ""
247
+
248
+ #: amazonjs.php:87
249
+ msgid "France"
250
+ msgstr ""
251
+
252
+ #: amazonjs.php:94
253
+ msgid "Japan"
254
+ msgstr ""
255
+
256
+ #: amazonjs.php:101
257
+ msgid "Canada"
258
+ msgstr ""
259
+
260
+ #: amazonjs.php:108
261
+ msgid "China"
262
+ msgstr ""
263
+
264
+ #: amazonjs.php:115
265
+ msgid "Italia"
266
+ msgstr ""
267
+
268
+ #: amazonjs.php:122
269
+ msgid "España"
270
+ msgstr ""
271
+
272
+ #: amazonjs.php:264
273
+ msgid "Author"
274
+ msgstr ""
275
+
276
+ #: amazonjs.php:265
277
+ msgid "PublicationDate"
278
+ msgstr ""
279
+
280
+ #: amazonjs.php:266
281
+ msgid "Publisher"
282
+ msgstr ""
283
+
284
+ #: amazonjs.php:267
285
+ msgid "${NumberOfPages} pages"
286
+ msgstr ""
287
+
288
+ #: amazonjs.php:268
289
+ msgid "List Price"
290
+ msgstr ""
291
+
292
+ #: amazonjs.php:269
293
+ msgid "Price"
294
+ msgstr ""
295
+
296
+ #: amazonjs.php:270
297
+ msgid ""
298
+ "Product prices and availability are accurate as of the date/time indicated "
299
+ "and are subject to change. Any price and availability information displayed "
300
+ "on [amazon.com or endless.com, as applicable] at the time of purchase will "
301
+ "apply to the purchase of this product."
302
+ msgstr ""
303
+
304
+ #: amazonjs.php:271
305
+ msgid "Publication Date"
306
+ msgstr ""
307
+
308
+ #: amazonjs.php:272
309
+ msgid "Release Date"
310
+ msgstr ""
311
+
312
+ #: amazonjs.php:273
313
+ msgid "SalesRank"
314
+ msgstr ""
315
+
316
+ #: amazonjs.php:274
317
+ msgid "#${SalesRank}"
318
+ msgstr ""
319
+
320
+ #: amazonjs.php:275
321
+ msgid "Run Time"
322
+ msgstr ""
323
+
324
+ #: amazonjs.php:276
325
+ msgid "${RunningTime} minutes"
326
+ msgstr ""
327
+
328
+ #: amazonjs.php:277
329
+ msgid "${Title} Customer Review"
330
+ msgstr ""
331
+
332
+ #: amazonjs.php:278
333
+ msgid "See Customer Reviews"
334
+ msgstr ""
335
+
336
+ #: amazonjs.php:279
337
+ msgid "(at ${UpdatedDate})"
338
+ msgstr ""
339
+
340
+ #: amazonjs.php:299
341
+ msgid "Product Advertising API settings"
342
+ msgstr ""
343
+
344
+ #: amazonjs.php:302
345
+ msgid "Amazon Associates settings"
346
+ msgstr ""
347
+
348
+ #: amazonjs.php:305
349
+ msgid "Appearance settings"
350
+ msgstr ""
351
+
352
+ #: amazonjs.php:308
353
+ msgid "Analytics settings"
354
+ msgstr ""
355
+
356
+ #: amazonjs.php:311
357
+ msgid "Customize"
358
+ msgstr ""
359
+
360
+ #: amazonjs.php:318
361
+ msgid "Access Key ID"
362
+ msgstr ""
363
+
364
+ #: amazonjs.php:324
365
+ msgid "Secret Access Key"
366
+ msgstr ""
367
+
368
+ #: amazonjs.php:330
369
+ msgid "Display customer review"
370
+ msgstr ""
371
+
372
+ #: amazonjs.php:333
373
+ msgid "AmazonJS will display customer review by using WordPress's Thickbox."
374
+ msgstr ""
375
+
376
+ #: amazonjs.php:336
377
+ msgid "Display official widget when disabled javascript in web browser"
378
+ msgstr ""
379
+
380
+ #: amazonjs.php:339
381
+ msgid ""
382
+ "If set to true, AmazonJS will output html by using <code>&lt;script "
383
+ "type=&quot;text/javascript&quot;&gt;document.write(&quot;{$indicator_html}&"
384
+ "quot;)&lt;/script&gt;&lt;noscript&gt;{$link_html}&lt;/noscript&gt;</code>."
385
+ msgstr ""
386
+
387
+ #: amazonjs.php:342
388
+ msgid "Use fadeIn animation"
389
+ msgstr ""
390
+
391
+ #: amazonjs.php:347
392
+ msgid "Override style of theme"
393
+ msgstr ""
394
+
395
+ #: amazonjs.php:350
396
+ msgid ""
397
+ "If set to true, AmazonJS will override the style of the theme by using "
398
+ "<code>!important</code> declaration."
399
+ msgstr ""
400
+
401
+ #: amazonjs.php:353
402
+ msgid "Click Tracking by using Google Analytics"
403
+ msgstr ""
404
+
405
+ #: amazonjs.php:356
406
+ msgid ""
407
+ "If set to true, AmazonJS will call <code>_gaq.push([\"_trackEvent\", "
408
+ "\"AmazonJS\", \"Click\", \"ASIN TITLE\"])</code> or <code>ga(\"send\", "
409
+ "\"event\", \"AmazonJS\", \"Click\", \"ASIN TITLE\")</code>."
410
+ msgstr ""
411
+
412
+ #: amazonjs.php:359
413
+ msgid "Use Custom Css"
414
+ msgstr ""
415
+
416
+ #: amazonjs.php:365
417
+ msgid "Use Custom Javascript"
418
+ msgstr ""
419
+
420
+ #: amazonjs.php:576
421
+ msgid "Settings"
422
+ msgstr ""
423
+
424
+ #: amazonjs.php:580
425
+ msgid "Old Releases"
426
+ msgstr ""
427
+
428
+ #: amazonjs.php:588
429
+ msgid ""
430
+ "This plugin uses the Amazon Product Advertising API in order to get product "
431
+ "infomation. Thus, you must use your Access Key ID &amp; Secret Access Key."
432
+ msgstr ""
433
+
434
+ #: amazonjs.php:589
435
+ msgid ""
436
+ "You can sign up the Amazon Product Advertising API from <a "
437
+ "href=\"https://affiliate-program.amazon.com/gp/advertising/api/detail/main."
438
+ "html\" target=\"_blank\">here</a>. Please review the <a "
439
+ "href=\"http://affiliate-program.amazon.com/gp/advertising/api/detail/"
440
+ "agreement.html\" target=\"_blank\">Product Advertising API License "
441
+ "Agreement</a> for details."
442
+ msgstr ""
443
+
444
+ #: amazonjs.php:595
445
+ msgid ""
446
+ "Amazon has an affiliate program called Amazon Associates. To apply for the "
447
+ "Associates Program, visit the <a "
448
+ "href=\"https://affiliate-program.amazon.com/\" target=\"_blank\">Amazon "
449
+ "Associates website</a> for details."
450
+ msgstr ""
451
+
452
+ #: amazonjs.php:596
453
+ msgid ""
454
+ "Associate Tag has been a <strong>required and verified</strong> input "
455
+ "parameter in all requests to the Amazon Product Advertising API since "
456
+ "11/1/2011."
457
+ msgstr ""
458
+
459
+ #: amazonjs.php:669
460
+ msgid "Add Amazon Link"
461
+ msgstr ""
462
+
463
+ #: amazonjs.php:701
464
+ msgid "Keyword Search"
465
+ msgstr ""
466
+
467
+ #: amazonjs.php:702
468
+ msgid "Search by ASIN/URL"
469
+ msgstr ""
470
+
471
+ #: amazonjs.php:725
472
+ msgid ""
473
+ "Error! \"simplexml_load_string\" function is not found. %s requires PHP 5 "
474
+ "and SimpleXML extension."
475
+ msgstr ""
476
+
477
+ #: amazonjs.php:730
478
+ msgid ""
479
+ "Warning! Cache directory is not exist. Please create writable directory: "
480
+ "<br/><code>%s</code>"
481
+ msgstr ""
482
+
483
+ #: amazonjs.php:734
484
+ msgid "Warning! Cache Directory \"%s\" is not writable, set permission as 0777."
485
+ msgstr ""
486
+
487
+ #: amazonjs.php:800
488
+ msgid "Invalid Request Parameters"
489
+ msgstr ""
490
+
491
+ #: amazonjs.php:835
492
+ msgid "Network Error: %s"
493
+ msgstr ""
494
+
495
+ #: amazonjs.php:841
496
+ msgid "Empty Response from %s"
497
+ msgstr ""
498
+
499
+ #: amazonjs.php:899 amazonjs.php:903
500
+ msgid "Amazon Product Advertising API Error"
501
+ msgstr ""
502
+
503
+ #: amazonjs.php:907
504
+ msgid "Cannot Parse Amazon Product Advertising API Response"
505
+ msgstr ""
506
+
507
+ #: amazonjs.php:912
508
+ msgid "Invalid Response"
509
+ msgstr ""
510
+
511
+ #: media-upload-type-amazonjs.php:23
512
+ msgid ""
513
+ "The Access Key ID or Secret Access Key is empty. Please specify it in <a "
514
+ "href=\"%s\" target=\"_blank\">settings</a>."
515
+ msgstr ""
516
+
517
+ #: media-upload-type-amazonjs.php:28
518
+ msgid "Warning! Cache Directory \"%s\" is not writable"
519
+ msgstr ""
520
+
521
+ #: media-upload-type-amazonjs.php:41
522
+ msgid "Input Keyword"
523
+ msgstr ""
524
+
525
+ #: media-upload-type-amazonjs.php:47
526
+ msgid "Input ASIN or URL"
527
+ msgstr ""
528
+
529
+ #: media-upload-type-amazonjs.php:49
530
+ msgid "Search"
531
+ msgstr ""
532
+
533
+ #: media-upload-type-amazonjs.php:58
534
+ msgid "Select template"
535
+ msgstr ""
536
+
537
+ #: media-upload-type-amazonjs.php:62
538
+ msgid "Simple Html"
539
+ msgstr ""
540
+
541
+ #: media-upload-type-amazonjs.php:64
542
+ msgid "Title"
543
+ msgstr ""
544
+
545
+ #: media-upload-type-amazonjs.php:66
546
+ msgid "Small Image"
547
+ msgstr ""
548
+
549
+ #: media-upload-type-amazonjs.php:68
550
+ msgid "Medium Image"
551
+ msgstr ""
552
+
553
+ #: media-upload-type-amazonjs.php:70
554
+ msgid "Large Image"
555
+ msgstr ""
556
+
557
+ #: media-upload-type-amazonjs.php:73
558
+ msgid "Dynamic Template"
559
+ msgstr ""
560
+
561
+ #: media-upload-type-amazonjs.php:75
562
+ msgid "Default"
563
+ msgstr ""
564
+
565
+ #: media-upload-type-amazonjs.php:77
566
+ msgid "Small"
567
+ msgstr ""
568
+
569
+ #: media-upload-type-amazonjs.php:80
570
+ msgid "Preview"
571
+ msgstr ""
572
+
573
+ #: media-upload-type-amazonjs.php:86
574
+ msgid "Cancel"
575
+ msgstr ""
576
+
577
+ #: media-upload-type-amazonjs.php:87
578
+ msgid "Insert"
579
+ msgstr ""
580
+
581
+ #: media-upload-type-amazonjs.php:145
582
+ msgid ""
583
+ "<h3 class=\"searchindex\"><a href=\"#\" rel=\"${IndexName}\">${Label}</a> "
584
+ "(${Results} hits)</h3>"
585
+ msgstr ""
586
+
587
+ #: media-upload-type-amazonjs.php:146
588
+ msgid ""
589
+ "<div class=\"searchpager\">{{if prev}}<button class=\"button "
590
+ "prev\">Prev</button>{{/if}}${startIndex} - ${endIndex} / "
591
+ "${totalResults}{{if next}}<button class=\"button "
592
+ "next\">Next</button>{{/if}}</div>"
593
+ msgstr ""
594
+
595
+ #: media-upload-type-amazonjs.php:162
596
+ msgid "Select"
597
+ msgstr ""
598
+
599
+ #. Plugin Name of the plugin/theme
600
+ msgid "AmazonJS"
601
+ msgstr ""
602
+
603
+ #. Plugin URI of the plugin/theme
604
+ msgid "http://wordpress.org/extend/plugins/amazonjs/"
605
+ msgstr ""
606
+
607
+ #. Description of the plugin/theme
608
+ msgid ""
609
+ "Easy to use interface to add an amazon product to your post and display it "
610
+ "by using jQuery template."
611
+ msgstr ""
612
+
613
+ #. Author of the plugin/theme
614
+ msgid "makoto_kw"
615
+ msgstr ""
616
+
617
+ #. Author URI of the plugin/theme
618
+ msgid "http://makotokw.com"
619
+ msgstr ""
lib/Services_JSON/JSON.php ADDED
@@ -0,0 +1,806 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
+
4
+ /**
5
+ * Converts to and from JSON format.
6
+ *
7
+ * JSON (JavaScript Object Notation) is a lightweight data-interchange
8
+ * format. It is easy for humans to read and write. It is easy for machines
9
+ * to parse and generate. It is based on a subset of the JavaScript
10
+ * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
11
+ * This feature can also be found in Python. JSON is a text format that is
12
+ * completely language independent but uses conventions that are familiar
13
+ * to programmers of the C-family of languages, including C, C++, C#, Java,
14
+ * JavaScript, Perl, TCL, and many others. These properties make JSON an
15
+ * ideal data-interchange language.
16
+ *
17
+ * This package provides a simple encoder and decoder for JSON notation. It
18
+ * is intended for use with client-side Javascript applications that make
19
+ * use of HTTPRequest to perform server communication functions - data can
20
+ * be encoded into JSON notation for use in a client-side javascript, or
21
+ * decoded from incoming Javascript requests. JSON format is native to
22
+ * Javascript, and can be directly eval()'ed with no further parsing
23
+ * overhead
24
+ *
25
+ * All strings should be in ASCII or UTF-8 format!
26
+ *
27
+ * LICENSE: Redistribution and use in source and binary forms, with or
28
+ * without modification, are permitted provided that the following
29
+ * conditions are met: Redistributions of source code must retain the
30
+ * above copyright notice, this list of conditions and the following
31
+ * disclaimer. Redistributions in binary form must reproduce the above
32
+ * copyright notice, this list of conditions and the following disclaimer
33
+ * in the documentation and/or other materials provided with the
34
+ * distribution.
35
+ *
36
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
37
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
38
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
39
+ * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
40
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
41
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
42
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
44
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
45
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
46
+ * DAMAGE.
47
+ *
48
+ * @category
49
+ * @package Services_JSON
50
+ * @author Michal Migurski <mike-json@teczno.com>
51
+ * @author Matt Knapp <mdknapp[at]gmail[dot]com>
52
+ * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
53
+ * @copyright 2005 Michal Migurski
54
+ * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
55
+ * @license http://www.opensource.org/licenses/bsd-license.php
56
+ * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
57
+ */
58
+
59
+ /**
60
+ * Marker constant for Services_JSON::decode(), used to flag stack state
61
+ */
62
+ define('AMAZONJS_JSON_SLICE', 1);
63
+
64
+ /**
65
+ * Marker constant for Services_JSON::decode(), used to flag stack state
66
+ */
67
+ define('AMAZONJS_JSON_IN_STR', 2);
68
+
69
+ /**
70
+ * Marker constant for Services_JSON::decode(), used to flag stack state
71
+ */
72
+ define('AMAZONJS_JSON_IN_ARR', 3);
73
+
74
+ /**
75
+ * Marker constant for Services_JSON::decode(), used to flag stack state
76
+ */
77
+ define('AMAZONJS_JSON_IN_OBJ', 4);
78
+
79
+ /**
80
+ * Marker constant for Services_JSON::decode(), used to flag stack state
81
+ */
82
+ define('AMAZONJS_JSON_IN_CMT', 5);
83
+
84
+ /**
85
+ * Behavior switch for Services_JSON::decode()
86
+ */
87
+ define('AMAZONJS_JSON_LOOSE_TYPE', 16);
88
+
89
+ /**
90
+ * Behavior switch for Services_JSON::decode()
91
+ */
92
+ define('AMAZONJS_JSON_SUPPRESS_ERRORS', 32);
93
+
94
+ /**
95
+ * Converts to and from JSON format.
96
+ *
97
+ * Brief example of use:
98
+ *
99
+ * <code>
100
+ * // create a new instance of Services_JSON
101
+ * $json = new Services_JSON();
102
+ *
103
+ * // convert a complexe value to JSON notation, and send it to the browser
104
+ * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
105
+ * $output = $json->encode($value);
106
+ *
107
+ * print($output);
108
+ * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
109
+ *
110
+ * // accept incoming POST data, assumed to be in JSON notation
111
+ * $input = file_get_contents('php://input', 1000000);
112
+ * $value = $json->decode($input);
113
+ * </code>
114
+ */
115
+ class Amazonjs_JSON
116
+ {
117
+ /**
118
+ * constructs a new JSON instance
119
+ *
120
+ * @param int $use object behavior flags; combine with boolean-OR
121
+ *
122
+ * possible values:
123
+ * - AMAZONJS_JSON_LOOSE_TYPE: loose typing.
124
+ * "{...}" syntax creates associative arrays
125
+ * instead of objects in decode().
126
+ * - AMAZONJS_JSON_SUPPRESS_ERRORS: error suppression.
127
+ * Values which can't be encoded (e.g. resources)
128
+ * appear as NULL instead of throwing errors.
129
+ * By default, a deeply-nested resource will
130
+ * bubble up with an error, so all return values
131
+ * from encode() should be checked with isError()
132
+ */
133
+ function Amazonjs_JSON($use = 0)
134
+ {
135
+ $this->use = $use;
136
+ }
137
+
138
+ /**
139
+ * convert a string from one UTF-16 char to one UTF-8 char
140
+ *
141
+ * Normally should be handled by mb_convert_encoding, but
142
+ * provides a slower PHP-only method for installations
143
+ * that lack the multibye string extension.
144
+ *
145
+ * @param string $utf16 UTF-16 character
146
+ * @return string UTF-8 character
147
+ * @access private
148
+ */
149
+ function utf162utf8($utf16)
150
+ {
151
+ // oh please oh please oh please oh please oh please
152
+ if(function_exists('mb_convert_encoding')) {
153
+ return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
154
+ }
155
+
156
+ $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
157
+
158
+ switch(true) {
159
+ case ((0x7F & $bytes) == $bytes):
160
+ // this case should never be reached, because we are in ASCII range
161
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
162
+ return chr(0x7F & $bytes);
163
+
164
+ case (0x07FF & $bytes) == $bytes:
165
+ // return a 2-byte UTF-8 character
166
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
167
+ return chr(0xC0 | (($bytes >> 6) & 0x1F))
168
+ . chr(0x80 | ($bytes & 0x3F));
169
+
170
+ case (0xFFFF & $bytes) == $bytes:
171
+ // return a 3-byte UTF-8 character
172
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
173
+ return chr(0xE0 | (($bytes >> 12) & 0x0F))
174
+ . chr(0x80 | (($bytes >> 6) & 0x3F))
175
+ . chr(0x80 | ($bytes & 0x3F));
176
+ }
177
+
178
+ // ignoring UTF-32 for now, sorry
179
+ return '';
180
+ }
181
+
182
+ /**
183
+ * convert a string from one UTF-8 char to one UTF-16 char
184
+ *
185
+ * Normally should be handled by mb_convert_encoding, but
186
+ * provides a slower PHP-only method for installations
187
+ * that lack the multibye string extension.
188
+ *
189
+ * @param string $utf8 UTF-8 character
190
+ * @return string UTF-16 character
191
+ * @access private
192
+ */
193
+ function utf82utf16($utf8)
194
+ {
195
+ // oh please oh please oh please oh please oh please
196
+ if(function_exists('mb_convert_encoding')) {
197
+ return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
198
+ }
199
+
200
+ switch(strlen($utf8)) {
201
+ case 1:
202
+ // this case should never be reached, because we are in ASCII range
203
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
204
+ return $utf8;
205
+
206
+ case 2:
207
+ // return a UTF-16 character from a 2-byte UTF-8 char
208
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
209
+ return chr(0x07 & (ord($utf8{0}) >> 2))
210
+ . chr((0xC0 & (ord($utf8{0}) << 6))
211
+ | (0x3F & ord($utf8{1})));
212
+
213
+ case 3:
214
+ // return a UTF-16 character from a 3-byte UTF-8 char
215
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
216
+ return chr((0xF0 & (ord($utf8{0}) << 4))
217
+ | (0x0F & (ord($utf8{1}) >> 2)))
218
+ . chr((0xC0 & (ord($utf8{1}) << 6))
219
+ | (0x7F & ord($utf8{2})));
220
+ }
221
+
222
+ // ignoring UTF-32 for now, sorry
223
+ return '';
224
+ }
225
+
226
+ /**
227
+ * encodes an arbitrary variable into JSON format
228
+ *
229
+ * @param mixed $var any number, boolean, string, array, or object to be encoded.
230
+ * see argument 1 to Amazonjs_JSON() above for array-parsing behavior.
231
+ * if var is a strng, note that encode() always expects it
232
+ * to be in ASCII or UTF-8 format!
233
+ *
234
+ * @return mixed JSON string representation of input var or an error if a problem occurs
235
+ * @access public
236
+ */
237
+ function encode($var)
238
+ {
239
+ switch (gettype($var)) {
240
+ case 'boolean':
241
+ return $var ? 'true' : 'false';
242
+
243
+ case 'NULL':
244
+ return 'null';
245
+
246
+ case 'integer':
247
+ return (int) $var;
248
+
249
+ case 'double':
250
+ case 'float':
251
+ return (float) $var;
252
+
253
+ case 'string':
254
+ // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
255
+ $ascii = '';
256
+ $strlen_var = strlen($var);
257
+
258
+ /*
259
+ * Iterate over every character in the string,
260
+ * escaping with a slash or encoding to UTF-8 where necessary
261
+ */
262
+ for ($c = 0; $c < $strlen_var; ++$c) {
263
+
264
+ $ord_var_c = ord($var{$c});
265
+
266
+ switch (true) {
267
+ case $ord_var_c == 0x08:
268
+ $ascii .= '\b';
269
+ break;
270
+ case $ord_var_c == 0x09:
271
+ $ascii .= '\t';
272
+ break;
273
+ case $ord_var_c == 0x0A:
274
+ $ascii .= '\n';
275
+ break;
276
+ case $ord_var_c == 0x0C:
277
+ $ascii .= '\f';
278
+ break;
279
+ case $ord_var_c == 0x0D:
280
+ $ascii .= '\r';
281
+ break;
282
+
283
+ case $ord_var_c == 0x22:
284
+ case $ord_var_c == 0x2F:
285
+ case $ord_var_c == 0x5C:
286
+ // double quote, slash, slosh
287
+ $ascii .= '\\'.$var{$c};
288
+ break;
289
+
290
+ case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
291
+ // characters U-00000000 - U-0000007F (same as ASCII)
292
+ $ascii .= $var{$c};
293
+ break;
294
+
295
+ case (($ord_var_c & 0xE0) == 0xC0):
296
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
297
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
298
+ $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
299
+ $c += 1;
300
+ $utf16 = $this->utf82utf16($char);
301
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
302
+ break;
303
+
304
+ case (($ord_var_c & 0xF0) == 0xE0):
305
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
306
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
307
+ $char = pack('C*', $ord_var_c,
308
+ ord($var{$c + 1}),
309
+ ord($var{$c + 2}));
310
+ $c += 2;
311
+ $utf16 = $this->utf82utf16($char);
312
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
313
+ break;
314
+
315
+ case (($ord_var_c & 0xF8) == 0xF0):
316
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
317
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
318
+ $char = pack('C*', $ord_var_c,
319
+ ord($var{$c + 1}),
320
+ ord($var{$c + 2}),
321
+ ord($var{$c + 3}));
322
+ $c += 3;
323
+ $utf16 = $this->utf82utf16($char);
324
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
325
+ break;
326
+
327
+ case (($ord_var_c & 0xFC) == 0xF8):
328
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
329
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
330
+ $char = pack('C*', $ord_var_c,
331
+ ord($var{$c + 1}),
332
+ ord($var{$c + 2}),
333
+ ord($var{$c + 3}),
334
+ ord($var{$c + 4}));
335
+ $c += 4;
336
+ $utf16 = $this->utf82utf16($char);
337
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
338
+ break;
339
+
340
+ case (($ord_var_c & 0xFE) == 0xFC):
341
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
342
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
343
+ $char = pack('C*', $ord_var_c,
344
+ ord($var{$c + 1}),
345
+ ord($var{$c + 2}),
346
+ ord($var{$c + 3}),
347
+ ord($var{$c + 4}),
348
+ ord($var{$c + 5}));
349
+ $c += 5;
350
+ $utf16 = $this->utf82utf16($char);
351
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
352
+ break;
353
+ }
354
+ }
355
+
356
+ return '"'.$ascii.'"';
357
+
358
+ case 'array':
359
+ /*
360
+ * As per JSON spec if any array key is not an integer
361
+ * we must treat the the whole array as an object. We
362
+ * also try to catch a sparsely populated associative
363
+ * array with numeric keys here because some JS engines
364
+ * will create an array with empty indexes up to
365
+ * max_index which can cause memory issues and because
366
+ * the keys, which may be relevant, will be remapped
367
+ * otherwise.
368
+ *
369
+ * As per the ECMA and JSON specification an object may
370
+ * have any string as a property. Unfortunately due to
371
+ * a hole in the ECMA specification if the key is a
372
+ * ECMA reserved word or starts with a digit the
373
+ * parameter is only accessible using ECMAScript's
374
+ * bracket notation.
375
+ */
376
+
377
+ // treat as a JSON object
378
+ if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
379
+ $properties = array_map(array($this, 'name_value'),
380
+ array_keys($var),
381
+ array_values($var));
382
+
383
+ foreach($properties as $property) {
384
+ if(Amazonjs_JSON::isError($property)) {
385
+ return $property;
386
+ }
387
+ }
388
+
389
+ return '{' . join(',', $properties) . '}';
390
+ }
391
+
392
+ // treat it like a regular array
393
+ $elements = array_map(array($this, 'encode'), $var);
394
+
395
+ foreach($elements as $element) {
396
+ if(Amazonjs_JSON::isError($element)) {
397
+ return $element;
398
+ }
399
+ }
400
+
401
+ return '[' . join(',', $elements) . ']';
402
+
403
+ case 'object':
404
+ $vars = get_object_vars($var);
405
+
406
+ $properties = array_map(array($this, 'name_value'),
407
+ array_keys($vars),
408
+ array_values($vars));
409
+
410
+ foreach($properties as $property) {
411
+ if(Amazonjs_JSON::isError($property)) {
412
+ return $property;
413
+ }
414
+ }
415
+
416
+ return '{' . join(',', $properties) . '}';
417
+
418
+ default:
419
+ return ($this->use & AMAZONJS_JSON_SUPPRESS_ERRORS)
420
+ ? 'null'
421
+ : new Amazonjs_JSON_Error(gettype($var)." can not be encoded as JSON string");
422
+ }
423
+ }
424
+
425
+ /**
426
+ * array-walking function for use in generating JSON-formatted name-value pairs
427
+ *
428
+ * @param string $name name of key to use
429
+ * @param mixed $value reference to an array element to be encoded
430
+ *
431
+ * @return string JSON-formatted name-value pair, like '"name":value'
432
+ * @access private
433
+ */
434
+ function name_value($name, $value)
435
+ {
436
+ $encoded_value = $this->encode($value);
437
+
438
+ if(Amazonjs_JSON::isError($encoded_value)) {
439
+ return $encoded_value;
440
+ }
441
+
442
+ return $this->encode(strval($name)) . ':' . $encoded_value;
443
+ }
444
+
445
+ /**
446
+ * reduce a string by removing leading and trailing comments and whitespace
447
+ *
448
+ * @param $str string string value to strip of comments and whitespace
449
+ *
450
+ * @return string string value stripped of comments and whitespace
451
+ * @access private
452
+ */
453
+ function reduce_string($str)
454
+ {
455
+ $str = preg_replace(array(
456
+
457
+ // eliminate single line comments in '// ...' form
458
+ '#^\s*//(.+)$#m',
459
+
460
+ // eliminate multi-line comments in '/* ... */' form, at start of string
461
+ '#^\s*/\*(.+)\*/#Us',
462
+
463
+ // eliminate multi-line comments in '/* ... */' form, at end of string
464
+ '#/\*(.+)\*/\s*$#Us'
465
+
466
+ ), '', $str);
467
+
468
+ // eliminate extraneous space
469
+ return trim($str);
470
+ }
471
+
472
+ /**
473
+ * decodes a JSON string into appropriate variable
474
+ *
475
+ * @param string $str JSON-formatted string
476
+ *
477
+ * @return mixed number, boolean, string, array, or object
478
+ * corresponding to given JSON input string.
479
+ * See argument 1 to Amazonjs_JSON() above for object-output behavior.
480
+ * Note that decode() always returns strings
481
+ * in ASCII or UTF-8 format!
482
+ * @access public
483
+ */
484
+ function decode($str)
485
+ {
486
+ $str = $this->reduce_string($str);
487
+
488
+ switch (strtolower($str)) {
489
+ case 'true':
490
+ return true;
491
+
492
+ case 'false':
493
+ return false;
494
+
495
+ case 'null':
496
+ return null;
497
+
498
+ default:
499
+ $m = array();
500
+
501
+ if (is_numeric($str)) {
502
+ // Lookie-loo, it's a number
503
+
504
+ // This would work on its own, but I'm trying to be
505
+ // good about returning integers where appropriate:
506
+ // return (float)$str;
507
+
508
+ // Return float or int, as appropriate
509
+ return ((float)$str == (integer)$str)
510
+ ? (integer)$str
511
+ : (float)$str;
512
+
513
+ } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
514
+ // STRINGS RETURNED IN UTF-8 FORMAT
515
+ $delim = substr($str, 0, 1);
516
+ $chrs = substr($str, 1, -1);
517
+ $utf8 = '';
518
+ $strlen_chrs = strlen($chrs);
519
+
520
+ for ($c = 0; $c < $strlen_chrs; ++$c) {
521
+
522
+ $substr_chrs_c_2 = substr($chrs, $c, 2);
523
+ $ord_chrs_c = ord($chrs{$c});
524
+
525
+ switch (true) {
526
+ case $substr_chrs_c_2 == '\b':
527
+ $utf8 .= chr(0x08);
528
+ ++$c;
529
+ break;
530
+ case $substr_chrs_c_2 == '\t':
531
+ $utf8 .= chr(0x09);
532
+ ++$c;
533
+ break;
534
+ case $substr_chrs_c_2 == '\n':
535
+ $utf8 .= chr(0x0A);
536
+ ++$c;
537
+ break;
538
+ case $substr_chrs_c_2 == '\f':
539
+ $utf8 .= chr(0x0C);
540
+ ++$c;
541
+ break;
542
+ case $substr_chrs_c_2 == '\r':
543
+ $utf8 .= chr(0x0D);
544
+ ++$c;
545
+ break;
546
+
547
+ case $substr_chrs_c_2 == '\\"':
548
+ case $substr_chrs_c_2 == '\\\'':
549
+ case $substr_chrs_c_2 == '\\\\':
550
+ case $substr_chrs_c_2 == '\\/':
551
+ if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
552
+ ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
553
+ $utf8 .= $chrs{++$c};
554
+ }
555
+ break;
556
+
557
+ case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
558
+ // single, escaped unicode character
559
+ $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
560
+ . chr(hexdec(substr($chrs, ($c + 4), 2)));
561
+ $utf8 .= $this->utf162utf8($utf16);
562
+ $c += 5;
563
+ break;
564
+
565
+ case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
566
+ $utf8 .= $chrs{$c};
567
+ break;
568
+
569
+ case ($ord_chrs_c & 0xE0) == 0xC0:
570
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
571
+ //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
572
+ $utf8 .= substr($chrs, $c, 2);
573
+ ++$c;
574
+ break;
575
+
576
+ case ($ord_chrs_c & 0xF0) == 0xE0:
577
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
578
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
579
+ $utf8 .= substr($chrs, $c, 3);
580
+ $c += 2;
581
+ break;
582
+
583
+ case ($ord_chrs_c & 0xF8) == 0xF0:
584
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
585
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
586
+ $utf8 .= substr($chrs, $c, 4);
587
+ $c += 3;
588
+ break;
589
+
590
+ case ($ord_chrs_c & 0xFC) == 0xF8:
591
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
592
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
593
+ $utf8 .= substr($chrs, $c, 5);
594
+ $c += 4;
595
+ break;
596
+
597
+ case ($ord_chrs_c & 0xFE) == 0xFC:
598
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
599
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
600
+ $utf8 .= substr($chrs, $c, 6);
601
+ $c += 5;
602
+ break;
603
+
604
+ }
605
+
606
+ }
607
+
608
+ return $utf8;
609
+
610
+ } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
611
+ // array, or object notation
612
+
613
+ if ($str{0} == '[') {
614
+ $stk = array(AMAZONJS_JSON_IN_ARR);
615
+ $arr = array();
616
+ } else {
617
+ if ($this->use & AMAZONJS_JSON_LOOSE_TYPE) {
618
+ $stk = array(AMAZONJS_JSON_IN_OBJ);
619
+ $obj = array();
620
+ } else {
621
+ $stk = array(AMAZONJS_JSON_IN_OBJ);
622
+ $obj = new stdClass();
623
+ }
624
+ }
625
+
626
+ array_push($stk, array('what' => AMAZONJS_JSON_SLICE,
627
+ 'where' => 0,
628
+ 'delim' => false));
629
+
630
+ $chrs = substr($str, 1, -1);
631
+ $chrs = $this->reduce_string($chrs);
632
+
633
+ if ($chrs == '') {
634
+ if (reset($stk) == AMAZONJS_JSON_IN_ARR) {
635
+ return $arr;
636
+
637
+ } else {
638
+ return $obj;
639
+
640
+ }
641
+ }
642
+
643
+ //print("\nparsing {$chrs}\n");
644
+
645
+ $strlen_chrs = strlen($chrs);
646
+
647
+ for ($c = 0; $c <= $strlen_chrs; ++$c) {
648
+
649
+ $top = end($stk);
650
+ $substr_chrs_c_2 = substr($chrs, $c, 2);
651
+
652
+ if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == AMAZONJS_JSON_SLICE))) {
653
+ // found a comma that is not inside a string, array, etc.,
654
+ // OR we've reached the end of the character list
655
+ $slice = substr($chrs, $top['where'], ($c - $top['where']));
656
+ array_push($stk, array('what' => AMAZONJS_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
657
+ //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
658
+
659
+ if (reset($stk) == AMAZONJS_JSON_IN_ARR) {
660
+ // we are in an array, so just push an element onto the stack
661
+ array_push($arr, $this->decode($slice));
662
+
663
+ } elseif (reset($stk) == AMAZONJS_JSON_IN_OBJ) {
664
+ // we are in an object, so figure
665
+ // out the property name and set an
666
+ // element in an associative array,
667
+ // for now
668
+ $parts = array();
669
+
670
+ if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
671
+ // "name":value pair
672
+ $key = $this->decode($parts[1]);
673
+ $val = $this->decode($parts[2]);
674
+
675
+ if ($this->use & AMAZONJS_JSON_LOOSE_TYPE) {
676
+ $obj[$key] = $val;
677
+ } else {
678
+ $obj->$key = $val;
679
+ }
680
+ } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
681
+ // name:value pair, where name is unquoted
682
+ $key = $parts[1];
683
+ $val = $this->decode($parts[2]);
684
+
685
+ if ($this->use & AMAZONJS_JSON_LOOSE_TYPE) {
686
+ $obj[$key] = $val;
687
+ } else {
688
+ $obj->$key = $val;
689
+ }
690
+ }
691
+
692
+ }
693
+
694
+ } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != AMAZONJS_JSON_IN_STR)) {
695
+ // found a quote, and we are not inside a string
696
+ array_push($stk, array('what' => AMAZONJS_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
697
+ //print("Found start of string at {$c}\n");
698
+
699
+ } elseif (($chrs{$c} == $top['delim']) &&
700
+ ($top['what'] == AMAZONJS_JSON_IN_STR) &&
701
+ ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
702
+ // found a quote, we're in a string, and it's not escaped
703
+ // we know that it's not escaped becase there is _not_ an
704
+ // odd number of backslashes at the end of the string so far
705
+ array_pop($stk);
706
+ //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
707
+
708
+ } elseif (($chrs{$c} == '[') &&
709
+ in_array($top['what'], array(AMAZONJS_JSON_SLICE, AMAZONJS_JSON_IN_ARR, AMAZONJS_JSON_IN_OBJ))) {
710
+ // found a left-bracket, and we are in an array, object, or slice
711
+ array_push($stk, array('what' => AMAZONJS_JSON_IN_ARR, 'where' => $c, 'delim' => false));
712
+ //print("Found start of array at {$c}\n");
713
+
714
+ } elseif (($chrs{$c} == ']') && ($top['what'] == AMAZONJS_JSON_IN_ARR)) {
715
+ // found a right-bracket, and we're in an array
716
+ array_pop($stk);
717
+ //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
718
+
719
+ } elseif (($chrs{$c} == '{') &&
720
+ in_array($top['what'], array(AMAZONJS_JSON_SLICE, AMAZONJS_JSON_IN_ARR, AMAZONJS_JSON_IN_OBJ))) {
721
+ // found a left-brace, and we are in an array, object, or slice
722
+ array_push($stk, array('what' => AMAZONJS_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
723
+ //print("Found start of object at {$c}\n");
724
+
725
+ } elseif (($chrs{$c} == '}') && ($top['what'] == AMAZONJS_JSON_IN_OBJ)) {
726
+ // found a right-brace, and we're in an object
727
+ array_pop($stk);
728
+ //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
729
+
730
+ } elseif (($substr_chrs_c_2 == '/*') &&
731
+ in_array($top['what'], array(AMAZONJS_JSON_SLICE, AMAZONJS_JSON_IN_ARR, AMAZONJS_JSON_IN_OBJ))) {
732
+ // found a comment start, and we are in an array, object, or slice
733
+ array_push($stk, array('what' => AMAZONJS_JSON_IN_CMT, 'where' => $c, 'delim' => false));
734
+ $c++;
735
+ //print("Found start of comment at {$c}\n");
736
+
737
+ } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == AMAZONJS_JSON_IN_CMT)) {
738
+ // found a comment end, and we're in one now
739
+ array_pop($stk);
740
+ $c++;
741
+
742
+ for ($i = $top['where']; $i <= $c; ++$i)
743
+ $chrs = substr_replace($chrs, ' ', $i, 1);
744
+
745
+ //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
746
+
747
+ }
748
+
749
+ }
750
+
751
+ if (reset($stk) == AMAZONJS_JSON_IN_ARR) {
752
+ return $arr;
753
+
754
+ } elseif (reset($stk) == AMAZONJS_JSON_IN_OBJ) {
755
+ return $obj;
756
+
757
+ }
758
+
759
+ }
760
+ }
761
+ }
762
+
763
+ /**
764
+ * @todo Ultimately, this should just call PEAR::isError()
765
+ */
766
+ function isError($data, $code = null)
767
+ {
768
+ if (class_exists('pear')) {
769
+ return PEAR::isError($data, $code);
770
+ } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
771
+ is_subclass_of($data, 'services_json_error'))) {
772
+ return true;
773
+ }
774
+
775
+ return false;
776
+ }
777
+ }
778
+
779
+ if (class_exists('PEAR_Error')) {
780
+
781
+ class Amazonjs_JSON_Error extends PEAR_Error
782
+ {
783
+ function Amazonjs_JSON_Error($message = 'unknown error', $code = null,
784
+ $mode = null, $options = null, $userinfo = null)
785
+ {
786
+ parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
787
+ }
788
+ }
789
+
790
+ } else {
791
+
792
+ /**
793
+ * @todo Ultimately, this class shall be descended from PEAR_Error
794
+ */
795
+ class Amazonjs_JSON_Error
796
+ {
797
+ function Amazonjs_JSON_Error($message = 'unknown error', $code = null,
798
+ $mode = null, $options = null, $userinfo = null)
799
+ {
800
+
801
+ }
802
+ }
803
+
804
+ }
805
+
806
+ ?>
lib/Services_JSON/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Redistribution and use in source and binary forms, with or without
2
+ modification, are permitted provided that the following conditions are
3
+ met:
4
+
5
+ Redistributions of source code must retain the above copyright notice,
6
+ this list of conditions and the following disclaimer.
7
+
8
+ Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+
12
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15
+ NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
16
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
lib/json.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! function_exists( 'json_encode' ) ) {
3
+ require_once dirname( __FILE__ ) . '/Services_JSON/JSON.php';
4
+ function json_encode( $content, $assoc = false ) {
5
+ $json = new Amazonjs_JSON( ($assoc) ? AMAZONJS_JSON_LOOSE_TYPE : 0 );
6
+ return $json->encode( $content );
7
+ }
8
+ }
media-upload-type-amazonjs.php ADDED
@@ -0,0 +1,405 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once dirname( __FILE__ ) . '/amazonjs-aws-params.php';
3
+
4
+ /**
5
+ * @var Amazonjs $amazonjs
6
+ */
7
+ global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types, $amazonjs;
8
+ add_filter( 'media_upload_tabs', array( $amazonjs, 'media_upload_tabs' ) );
9
+ media_upload_header();
10
+ $text_domain = $amazonjs->text_domain;
11
+ $access_key_id = $amazonjs->settings['accessKeyId'];
12
+ $secret_access_key = $amazonjs->settings['secretAccessKey'];
13
+ $error = (empty( $access_key_id ) || empty( $secret_access_key ));
14
+
15
+ amazonjs_aws_params( $amazonjs );
16
+ ?>
17
+ <div id="media_amazon">
18
+ <?php if ( empty( $access_key_id ) || empty( $secret_access_key ) ) : ?>
19
+ <div class="updated error">
20
+ <p><?php printf( __( 'The Access Key ID or Secret Access Key is empty. Please specify it in <a href="%s" target="_blank">settings</a>.', $text_domain ), $amazonjs->option_page_url ); ?></p>
21
+ </div>
22
+ <?php endif ?>
23
+ <form id="search_form" class="amazonjs_search_form" method="get" action="<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php">
24
+ <input type="hidden" nama="tab" value="<?php echo esc_attr( $tab ); ?>"/>
25
+ <input type="hidden" id="search_page" name="ItemPage" value="1"/>
26
+ <?php if ( 'amazonjs_keyword' == $tab ) : ?>
27
+ <fieldset>
28
+ <select id="search_locale" name="CountryCode"></select>
29
+ <select id="search_index" name="SearchIndex"></select>
30
+ </fieldset>
31
+ <input type="text" id="search_query" name="Keywords" placeholder="<?php _e( 'Input Keyword', $text_domain ) ?>"/>
32
+ <?php elseif ( 'amazonjs_id' == $tab ) : ?>
33
+ <fieldset>
34
+ <select id="search_locale" name="CountryCode"></select>
35
+ </fieldset>
36
+ <input type="text" id="search_query" name="ID" placeholder="<?php _e( 'Input ASIN or URL', $text_domain ) ?>"/>
37
+ <?php endif ?>
38
+ <input type="submit" value="<?php _e( 'Search', $text_domain ) ?>" class="button button-large"/>
39
+ </form>
40
+ <div id="search_results">
41
+ <div id="pager"></div>
42
+ <ul id="items"></ul>
43
+ </div>
44
+ </div>
45
+ <div id="overlay"></div>
46
+ <form id="template_form" onsubmit="return false" style="display: none;">
47
+ <h2><?php _e( 'Select template', $text_domain ) ?></h2>
48
+
49
+ <div id="select_template" class="select_template">
50
+ <fieldset>
51
+ <legend><?php _e( 'Simple Html', $text_domain ) ?></legend>
52
+ <input type="radio" id="template_link" name="template" value="link" class="html"/>
53
+ <label for="template_link"><?php _e( 'Title', $text_domain ) ?></label>
54
+ <input type="radio" id="template_small_image" name="template" value="smallImage" class="html has_image"/>
55
+ <label for="template_small_image" class="has_image"><?php _e( 'Small Image', $text_domain ) ?></label>
56
+ <input type="radio" id="template_medium_image" name="template" value="mediumImage" class="html has_image"/>
57
+ <label for="template_medium_image" class="has_image"><?php _e( 'Medium Image', $text_domain ) ?></label>
58
+ <input type="radio" id="template_large_image" name="template" value="largeImage" class="html has_image"/>
59
+ <label for="template_large_image" class="has_image"><?php _e( 'Large Image', $text_domain ) ?></label>
60
+ </fieldset>
61
+ <fieldset>
62
+ <legend><?php _e( 'Dynamic Template', $text_domain ) ?></legend>
63
+ <input type="radio" id="template_amazonjs" name="template" value="shortCode" class="shortcode"/>
64
+ <label for="template_amazonjs"><?php _e( 'Default', $text_domain ) ?></label>
65
+ <input type="radio" id="template_amazonjs_small" name="template" value="shortCodeSmall" class="shortcode"/>
66
+ <label for="template_amazonjs_small"><?php _e( 'Small', $text_domain ) ?></label>
67
+ </fieldset>
68
+ </div>
69
+ <h2><?php _e( 'Preview', $text_domain ) ?></h2>
70
+
71
+ <div id="preview"></div>
72
+ <textarea id="preview_code"></textarea>
73
+
74
+ <div id="buttons" class="buttons">
75
+ <input id="cancel" type="button" value="<?php _e( 'Cancel', $text_domain ) ?>" class="button"/>
76
+ <input id="insert" type="submit" value="<?php _e( 'Insert', $text_domain ) ?>" class="button button-primary"/>
77
+ </div>
78
+ </form>
79
+ <script type="text/javascript">
80
+ <!--
81
+ (function ($) {
82
+ $(document).ready(function () {
83
+ var $insert = $('#insert'),
84
+ $cancel = $('#cancel'),
85
+ $form = $('#search_form'),
86
+ $results = $('#search_results'),
87
+ $searchLocale = $('#search_locale'),
88
+ $searchIndex = $('#search_index'),
89
+ $searchPage = $('#search_page'),
90
+ $searchQuery = $('#search_query'),
91
+ $templateForm = $('#template_form'),
92
+ $overlay = $('#overlay'),
93
+ loading = false,
94
+ selectedItem,
95
+ defaultLocale = '<?php echo esc_js( $amazonjs->default_country_code() ); ?>',
96
+ countries = <?php echo json_encode( $amazonjs->countries );?>,
97
+ searchIndexes = <?php echo json_encode( $amazonjs->search_indexes );?>
98
+ ;
99
+
100
+ $.each(countries, function (key, value) {
101
+ $searchLocale.append('<option value="' + key + '">' + value.label + '</option>')
102
+ });
103
+ function loadSearchIndex(locale) {
104
+ $searchIndex.empty();
105
+
106
+ var unsupportedOptions = [];
107
+ $.each(searchIndexes, function (key, value) {
108
+ if (value[locale]) {
109
+ $searchIndex.append(
110
+ '<option value="' + key + '">' + value.label + ' (' + key + ')' + '</option>'
111
+ );
112
+ } else {
113
+ unsupportedOptions.push('<option value="' + key + '">!' + value.label + ' (' + key + ')' + '</option>')
114
+ }
115
+ });
116
+ $searchIndex.append(unsupportedOptions.join(''));
117
+ }
118
+
119
+ $searchLocale.change(function () {
120
+ loadSearchIndex($(this).val());
121
+ });
122
+ $searchLocale.val(defaultLocale).change();
123
+ $searchIndex.change(function () {
124
+ $searchPage.val(1)
125
+ });
126
+ $searchQuery.change(function () {
127
+ $searchPage.val(1)
128
+ });
129
+ $cancel.click(function () {
130
+ hideTemplateForm();
131
+ });
132
+
133
+ $.amazonjs.initTemplate();
134
+ $.template('amazonjsSearchIndexHeaderTpl', '<?php _e( '<h3 class="searchindex"><a href="#" rel="${IndexName}">${Label}</a> (${Results} hits)</h3>', $text_domain )?>');
135
+ $.template('amazonjsSearchPagerTpl', '<?php _e( '<div class="searchpager">{{if prev}}<button class="button prev">Prev</button>{{/if}}${startIndex} - ${endIndex} / ${totalResults}{{if next}}<button class="button next">Next</button>{{/if}}</div>', $text_domain )?>');
136
+ $.template('amazonjsSearchItemTpl',
137
+ [
138
+ '<li id="asin_${ASIN}" class="amazonjs_searchitem">',
139
+ '<a href="${DetailPageURL}" title="${Title}" target="_blank">',
140
+ '{{if SmallImage}}',
141
+ '<img src="${SmallImage.src}" width="${SmallImage.width}" height="${SmallImage.height}" alt="${Title}"/>',
142
+ '{{else}}',
143
+ '<img src="<?php echo esc_attr( $amazonjs->url ); ?>/images/noimage-small.jpg" alt="${Title}"/>',
144
+ '{{/if}}',
145
+ '</a>',
146
+ '<h4><a href="${DetailPageURL}" title="${Title}" target="_blank">${Title}</a></h4><br/>',
147
+ '{{if ListPrice}}&nbsp;ListPrice: ${ListPrice.FormattedPrice}<br/>{{/if}}',
148
+ '{{if OfferSummary.LowestNewPrice}}&nbsp;Price: ${OfferSummary.LowestNewPrice.FormattedPrice}<br/>{{/if}}',
149
+ '{{if PublicationDate}}&nbsp;${PublicationDate}<br/>{{/if}}',
150
+ '{{if SalesRank}}&nbsp;Rank: ${SalesRank}<br/>{{/if}}',
151
+ '<button id="btn_${ASIN}" class="button select"><?php _e( 'Select', $text_domain )?></button>',
152
+ '<div class="amazonjs_footer"></div>',
153
+ '</li>'
154
+ ].join(''));
155
+
156
+ $form.submit(function () {
157
+ try {
158
+ if (!loading) {
159
+ request();
160
+ }
161
+ } catch (e) {
162
+ }
163
+ return false;
164
+ });
165
+
166
+ function insertToEditor(text) {
167
+ var window = top, editor;
168
+ if (typeof window.tinyMCE != 'undefined' && (editor = window.tinyMCE.activeEditor) && !editor.isHidden()) {
169
+ editor.focus();
170
+ if (window.tinymce.isIE) {
171
+ editor.selection.moveToBookmark(window.tinymce.EditorManager.activeEditor.windowManager.bookmark);
172
+ }
173
+ editor.execCommand('mceInsertContent', false, text);
174
+ } else if (typeof window.edInsertContent == 'function') {
175
+ top.edInsertContent(top.edCanvas, text);
176
+ } else {
177
+ $canvas = window.jQuery(top.edCanvas);
178
+ $canvas.val($canvas.val() + text);
179
+ }
180
+ }
181
+
182
+ function close() {
183
+ top.tb_remove();
184
+ }
185
+
186
+ function request(params) {
187
+ params = params || {};
188
+ params['action'] = 'amazonjs_search';
189
+ $.each([$searchLocale, $searchIndex, $searchPage, $searchQuery], function (i, $field) {
190
+ params[$field.attr('name')] = $field.val();
191
+ });
192
+ $.ajax({
193
+ url: $form.attr('action'),
194
+ dataType: 'json',
195
+ data: params,
196
+ beforeSend: function (xhr) {
197
+ loading = true;
198
+ $results.html('<span class="indicator"></span>');
199
+ $form.find('input,select,button').attr('disabled', 'disabled');
200
+ },
201
+ success: function (data, textStatus, jqXHR) {
202
+ onLoaded(data, params);
203
+ },
204
+ error: function (jqXHR, textStatus, errorThrown) {
205
+ var responseText = (jqXHR && jqXHR.responseText) ? jqXHR.responseText : '';
206
+ var message = textStatus;
207
+ if (typeof(responseText) == 'string' && responseText.length > 0) {
208
+ message = responseText;
209
+ }
210
+ else if (typeof(errorThrown) == 'string') {
211
+ message = errorThrown;
212
+ }
213
+ else if (errorThrown && errorThrown.message) {
214
+ message = errorThrown.message
215
+ }
216
+ onLoaded({
217
+ success: false,
218
+ message: message
219
+ });
220
+ }
221
+ });
222
+ }
223
+
224
+ function onLoaded(data, params) {
225
+ loading = false;
226
+ $results.empty();
227
+ $form.find('input,select,button').attr('disabled', null);
228
+ if (!data || !data.items || data.items.length == 0) {
229
+ if (data && data.success) {
230
+ var $u = $('<div/>').addClass('error').html('<p>No Items</p>');
231
+ $results.append($u);
232
+ } else {
233
+ var msg = (data) ? (data.message || 'Error') : 'Amazonjs Search Error';
234
+ var $e = $('<div/>').addClass('error').html('<p>' + msg + '</p>');
235
+ if (data.error_code) {
236
+ var $errorCode = $('<strong/>').html(data.error_code);
237
+ $('<p/>').append($errorCode).appendTo($e);
238
+ }
239
+ if (data.error_message) {
240
+ $e.append($('<p/>').html(data.error_message));
241
+ }
242
+ if (data.error_body) {
243
+ $e.append($('<pre/>').addClass('error_body').text(data.error_body));
244
+ }
245
+ if (data && data.ob) {
246
+ $e.append($('<div/>').html(data.ob));
247
+ }
248
+ $results.append($e);
249
+ }
250
+ return;
251
+ }
252
+ var items = data.items, length = items.length;
253
+
254
+ function find(asin) {
255
+ for (var i = 0; i < length; i++) {
256
+ if (items[i].ASIN == asin) return items[i];
257
+ }
258
+ }
259
+
260
+ if (params.SearchIndex == 'Blended') {
261
+ $.each(data.resultMap.SearchIndex, function (i, searchIndex) {
262
+ var subItems = [];
263
+ var asins = ('string' == typeof(searchIndex.ASIN)) ? [searchIndex.ASIN] : searchIndex.ASIN;
264
+ $.each(asins, function (i, asin) {
265
+ subItems.push(find(asin));
266
+ });
267
+ searchIndex.Label = (searchIndexes[searchIndex.IndexName]) ? searchIndexes[searchIndex.IndexName].label : searchIndex.IndexName;
268
+ $results.append($.tmpl("amazonjsSearchIndexHeaderTpl", searchIndex));
269
+ var $ul = $('<ul/>');
270
+ $ul.append($.tmpl("amazonjsSearchItemTpl", subItems));
271
+ $results.append($ul);
272
+ });
273
+ } else {
274
+ var os = data.os;
275
+ if (data.operation == 'ItemSearch') {
276
+ os.prev = (os.Query.startPage > 1);
277
+ os.next = (os.Query.startPage < os.totalPages);
278
+ os.endIndex = Math.min(os.startIndex + os.itemsPerPage - 1, os.totalResults);
279
+ var $pager = $.tmpl("amazonjsSearchPagerTpl", os);
280
+ $results.append($pager);
281
+ }
282
+ var $ul = $('<ul/>');
283
+ $ul.append($.tmpl("amazonjsSearchItemTpl", items));
284
+ $results.append($ul);
285
+ if ($pager) {
286
+ $results.append($pager.clone());
287
+ }
288
+ }
289
+ $results.find('.searchindex > a').click(function () {
290
+ var index = $(this).attr('rel');
291
+ $searchIndex.val(index);
292
+ $form.submit();
293
+ return false;
294
+ });
295
+ $results.find('.prev').click(function () {
296
+ var page = parseInt($searchPage.val());
297
+ if (page > 1) {
298
+ $searchPage.val(page - 1);
299
+ $form.submit();
300
+ }
301
+ return false;
302
+ });
303
+ $results.find('.next').click(function () {
304
+ var page = parseInt($searchPage.val());
305
+ $searchPage.val(page + 1);
306
+ $form.submit();
307
+ return false;
308
+ });
309
+ $results.find('.select').click(function () {
310
+ var asin = $(this).attr('id').split('_')[1];
311
+ showTemplateForm(selectedItem = find(asin));
312
+ return false;
313
+ });
314
+ }
315
+
316
+ var $container = $('#media_amazon'),
317
+ $preview = $('#preview'),
318
+ $previewCode = $('#preview_code'),
319
+ $imageTemplateSelect = $('#select_template input.has_image'),
320
+ $imageTemplateSelectLabel = $('#select_template label.has_image'),
321
+ $templateSelect = $('#select_template input').change(function () {
322
+ var shortcode = $(this).hasClass('shortcode'),
323
+ html = $(this).hasClass('html');
324
+ if (html) {
325
+ var tplName = $(this).val() + 'AmazonItem';
326
+ var $item = $.tmpl(tplName, selectedItem);
327
+ $preview.empty().append($item);
328
+ $previewCode.val($preview.html());
329
+ } else { // shortcode
330
+ var val = $(this).val();
331
+ var tplName = 'shortCodeAmazonItem';
332
+ selectedItem.EscapeTitle = selectedItem.Title.replace(/\[|\]/g, '');
333
+ selectedItem.Tmpl = (val == 'shortCode') ? null : val.replace('shortCode', '');
334
+ var $shortCode = $.tmpl(tplName, selectedItem);
335
+ var $item = $.amazonjs.tmpl(selectedItem, $.amazonjs.formatTmplName(selectedItem.Tmpl));
336
+ $preview.empty().append($item);
337
+ $previewCode.val($shortCode[0].textContent);
338
+ //console.log($item[0]);
339
+ }
340
+ $insert.attr({disabled: null});
341
+ });
342
+
343
+ // display template
344
+ {
345
+ $.template('linkAmazonItem', '<a href="${DetailPageURL}" title="${Title}" target="_blank">${Title}</a>');
346
+ $.template('smallImageAmazonItem',
347
+ [
348
+ '<a href="${DetailPageURL}" title="${Title}" target="_blank">',
349
+ '{{if SmallImage}}',
350
+ '<img src="${SmallImage.src}" width="${SmallImage.width}" height="${SmallImage.height}" alt="${Title}"/>',
351
+ '{{/if}}',
352
+ '</a>'
353
+ ].join(''));
354
+ $.template('mediumImageAmazonItem',
355
+ [
356
+ '<a href="${DetailPageURL}" title="${Title}" target="_blank">',
357
+ '{{if MediumImage}}',
358
+ '<img src="${MediumImage.src}" width="${MediumImage.width}" height="${MediumImage.height}" alt="${Title}"/>',
359
+ '{{/if}}',
360
+ '</a>'
361
+ ].join(''));
362
+ $.template('largeImageAmazonItem',
363
+ [
364
+ '<a href="${DetailPageURL}" title="${Title}" target="_blank">',
365
+ '{{if LargeImage}}',
366
+ '<img src="${LargeImage.src}" width="${LargeImage.width}" height="${LargeImage.height}" alt="${Title}"/>',
367
+ '{{/if}}',
368
+ '</a>'
369
+ ].join(''));
370
+ $.template('shortCodeAmazonItem', '[amazonjs asin="${ASIN}" locale="${CountryCode}"{{if Tmpl}} tmpl="${Tmpl}"{{/if}} title="${EscapeTitle}"]');
371
+ }
372
+
373
+ $insert.click(function () {
374
+ insertToEditor($previewCode.val());
375
+ //hideTemplateForm();
376
+ close();
377
+ });
378
+
379
+ // template form
380
+ function showTemplateForm(item) {
381
+ $imageTemplateSelect.attr({disabled: (item.SmallImage) ? null : 'disabled'});
382
+ if (item.SmallImage) {
383
+ $imageTemplateSelectLabel.removeClass('disabled');
384
+ } else {
385
+ $imageTemplateSelectLabel.addClass('disabled');
386
+ }
387
+ $overlay.height($container.height() + 40).show();
388
+ $preview.empty();
389
+ $previewCode.val('');
390
+ $templateSelect.attr('checked', null);
391
+ $insert.attr({disabled: 'disabled'});
392
+ $templateForm.show();
393
+ var top = ($(window).height() / 2 - $templateForm.height() / 2) + $(window).scrollTop();
394
+ $templateForm.css('top', top < 0 ? 0 : top);
395
+ $('#template_amazonjs').attr('checked', 'checked').change();
396
+ }
397
+
398
+ function hideTemplateForm() {
399
+ $overlay.hide();
400
+ $templateForm.hide();
401
+ }
402
+ });
403
+ })(jQuery);
404
+ //-->
405
+ </script>
readme.txt ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Amazon JS ===
2
+ Contributors: makoto_kw
3
+ Tags: Amazon, books, post, media, affiliate, japanese
4
+ Requires at least: 3.3
5
+ Tested up to: 4.4.2
6
+ Stable tag: trunk
7
+ License: GPLv2 or later
8
+
9
+ Easy to add an Amazon product to your post and you can customize display it by using jQuery template.
10
+
11
+ == Description ==
12
+
13
+ AmazonJS displays Amazon products on your WordPress posts and pages. AmazonJS adds a search form to WordPress post form. Then you can search Amazon products by keyword, ASIN or URL, and add shortcode or html to your post from results of search.
14
+
15
+ AmazonJS uses `amazonjs' shortcode and jQuery template to display Amazon products. View the work data at runtime, Javascript allows various representations. AmazonJS has some template to Amazon products for each Product Group, it can how to display the different Amazon products, such as books and music.
16
+
17
+ * Requires WorPress 3.3 or later
18
+ * Requires your Amazon Product Advertising API
19
+ * Plugin Uses API cache by using Transients API
20
+ * Customize template by using jQuery template
21
+ * Supports Amazon domains ([US](http://www.amazon.com), [UK](http://www.amazon.co.uk), [Germany](http://www.amazon.de), [France](http://www.amazon.fr), [Japan](http://www.amazon.co.jp/), [Canada](http://www.amazon.ca), [China](http://www.amazon.cn), [Italy](http://www.amazon.it), [Spain](http://www.amazon.es))
22
+
23
+ = Using Amazon Product Advertising API =
24
+
25
+ AmazonJS requires [Amazon Product Advertising API](https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html)
26
+ in order to get Amazon product information from ASIN or keyword.
27
+ Thus, you have to sign up Amazon Product Advertising API and specify your **Access Key** and **Secret Access Key**.
28
+ And you must set your associate tags for Amazon Associates also.
29
+
30
+ = Shortcode =
31
+
32
+ AmazonJS adds a media link above an editor in the editing post page. The form that searches an Amazon product is shown when you click it. AmazonJS adds a simple html code (like WP-amazon) or an `amazonjs` shortcode from form.
33
+
34
+ AmazonJS supports the `amazonjs' shortcode.
35
+
36
+ ex)
37
+ [amazonjs asin="B00005ED8E" locale="JP" tmpl="Small" title="D・N・A"]
38
+
39
+ * *asin*: (required) ASIN (ProductID of Amazon)
40
+ * *locale*: (required) `US`, `UK`, `DE`, `FR`, `JP`, `CA`, `CN`, `IT` or `ES`
41
+ * *tmpl*: (optional) `Small`. if tmpl is empty, apply a template via Product Group of Amazon Product Advertising API.
42
+ * *title*: (optional) It will be used for loading message.
43
+ * *imgsize*: (optional) Thumbnail image size. `small`, `medium` or `large`.
44
+
45
+ = Display by javascript =
46
+
47
+ In first, AmazonJS converts <a/> tag from `amazonjs` short code in server side. Second, in window.load, `amazonjs.js` (it is added by plugin) will replace <a/> tag with formatted html to display Amazon Product by using jQuery template.
48
+
49
+ = Link =
50
+
51
+ * GitHub Repository (latest source code and old versions): https://github.com/makotokw/wp-amazonjs
52
+ * Japanese article: http://blog.makotokw.com/portfolio/wordpress/amazonjs/
53
+
54
+ == Installation ==
55
+
56
+ 1. Upload `amazonjs` to the `/wp-content/plugins/` directory
57
+ 1. Activate the plugin through the `Plugins` menu in WordPress
58
+ 1. Set your associate tags and your keys of the Product Advertising API through the `Settings` > `Amazonjs` menu in WordPress
59
+
60
+ = Directory structure =
61
+
62
+ /wp-content
63
+ /plugins/amazonjs
64
+ + /css/*
65
+ + /images/*
66
+ + /js/*
67
+ + /languages/*
68
+ + /lib/*
69
+ - *.*
70
+
71
+ = Settings =
72
+
73
+ 1. Access to /wp-admin/ and click Settings > AmazonJS on menu
74
+ 1. Set your keys for Product Advertising API
75
+ 1. Set your Amazon Associate Tag via Amazon Domain
76
+
77
+ == Frequently Asked Questions ==
78
+
79
+ == Screenshots ==
80
+
81
+ 1. Click the gray Amazon icon to go to search form in editing entry page.
82
+
83
+ == Upgrade Notice ==
84
+
85
+ == Changelog ==
86
+
87
+ = 0.8 =
88
+
89
+ * Supported Transients API for cache (file cache is no longer in use)
90
+ * Improved to start rendering
91
+ * Fixed to use `get_locale()` instead of `WPLANG`
92
+
93
+ = 0.7.3 =
94
+
95
+ * Fixed to save settings by checkbox
96
+ * Fixed image url over https
97
+
98
+ = 0.7.2 =
99
+
100
+ * Fixed PHP Short Open Tag in PHP5.3 or earlier by @shield-9
101
+ * Improved timeout to request Product Advertising API
102
+ * Required WordPress 3.3
103
+
104
+ = 0.7.1 =
105
+
106
+ * Fixed to parse ItemID into https URL
107
+ * Fixed Japanese translation of search form
108
+ * Improved to display to display the error response of Product Advertising API
109
+ * Bundle the jquery.tmpl
110
+ * WordPress Cording Standard
111
+
112
+ = 0.7 =
113
+
114
+ * Supported click tracking by Google Analytics
115
+ * Added option to overwrite !important style of theme in v0.6.1
116
+
117
+ = 0.6.1 =
118
+
119
+ * Fixed to overwrite !important style of theme
120
+ * Fixed `imgsize`
121
+
122
+ = 0.6 =
123
+
124
+ * Added option to allow animation
125
+ * Supported `imgsize` attr of shortcode
126
+ * Fixed to display same ASIN for some countries
127
+ * Fixed style for smart phone and dark theme
128
+
129
+ = 0.5 =
130
+
131
+ * Added DVD template
132
+ * Optimized style for WordPress 3.8
133
+ * Used wp-ajax to search product in admin page
134
+ * Removed minify css and js to avoid to conflict W3 Total Cache
135
+
136
+ = 0.4.2 =
137
+
138
+ * Fixed to work in footer with jQuery
139
+ * Fixed to enqueue jQuery in admin page
140
+ * Fixed to find config file above ABSPATH
141
+ * Fixed and improved to display error message
142
+
143
+ = 0.4.1 =
144
+
145
+ * Added amazonjs.js script only when needed
146
+ * minify css and js
147
+
148
+ = 0.4 =
149
+
150
+ * Added option to display customer review, default is off
151
+ * Added option to display an Amazon official widget when disabled javascript in web browser, default is off
152
+ * Changed priority of wp_print_footer_scripts to execute before other plugin occurred error
153
+
154
+ = 0.3 =
155
+
156
+ * Used MediumImage in blog feed for the magazine view of feedly
157
+ * Add an Amazon product url to indicator if it has cache data
158
+ * Supported disable javascript to display amazon link widget
159
+ * Fixed to fetch more 10 products at once
160
+ * Fixed some php warnings
161
+
162
+ = 0.2.1 =
163
+
164
+ * Fixed to display image on the IE 8
165
+
166
+ = 0.2 =
167
+
168
+ * Fixed to use custom style on the child theme
169
+ * Improved to display an error message
170
+
171
+ = 0.1beta5 =
172
+
173
+ * Added ItemGroup Template for Amazon Kindle Book
174
+ * Fixed to display price
175
+
176
+ = 0.1beta4 =
177
+
178
+ * Allow to use Unsupported Search Index of Amazon Product Advertising API
179
+ * Amazon Product Advertising API Version 2011-08-01
180
+
181
+ = 0.1beta3d =
182
+
183
+ * Fixed to return json response with error log
184
+
185
+ = 0.1beta3c =
186
+
187
+ * Fixed to detect WP_CONTENT_DIR
188
+
189
+ = 0.1beta3b =
190
+
191
+ * Supported WordPress 3.3(beta3)
192
+ * Fixed to remove deprecated
193
+ * Fixed template
194
+
195
+ = 0.1beta3a =
196
+
197
+ * Supported to search by ASIN or URL
198
+ * Amazon Product Advertising API Version 2010-11-01
199
+
200
+ = 0.1beta2 =
201
+
202
+ * Initial release
screenshot-1.png ADDED
Binary file